Here’s an updated guide for installing FreePBX on Ubuntu 12.04. I found a different guide to installing FreePBX against the 12.04 LTS with some minor tweaks.
I have opted for installing 2.9.x of FreePBX because the changes in 2.10 (surely version 3?) at the time of write to be not suitable for production purposes but I will go through install 2.10 as well. Whilst the UI need a to be brought up to date and the project has done with it’s new fancy UI, it needs more time to mature and post install was a mess.
I managed to get FreePBX working with the repository version of Asterisk which was 1.8.x at the time. This will make maintaining Asterisk a lot easier but also have to be careful of future updates which may be incompatible with FreePBX. To install:
sudo apt-get install asterisk asterisk-mysql asterisk-mp3
The above will also install all the dependencies such as MySQL if it’s not installed. MySQL will prompt for a admin password for MySQL. DO NOT FORGET THIS. Other prompts may include the country code i.e 44 for UK.
The install for 2.9 and 2.10 is fairly similar. The Post install is where it differs.
sudo apt-get install apache2 libapache2-mod-php5 php5-gd php5-mysql php-pear php-db sox curl mysql-server mysql-workbench
Go to the source directory:
cd /tmp
Download FreePBX 2.9
wget http://mirror.freepbx.org/freepbx-2.9.0.tar.gz
or 2.10
wget http://mirror.freepbx.org/freepbx-2.10.0.tar.gz
Go to src directory:
cd /usr/src
Extract the downloaded zip containing FreePBX:
sudo tar xvzf /tmp/freepbx-2.9.0.tar.gz
or this line for 2.10
sudo tar xvzf /tmp/freepbx-2.10.0.tar.gz
Go into the extracted FreePBX directory:
cd freepbx-2.9.0/
or
cd freepbx-2.10.0/
Create the necessary databases with the commands below:
mysqladmin create asterisk -u root -p
mysqladmin create asteriskcdrdb -u root -p
mysql -u root -p asterisk < SQL/newinstall.sql
mysql -u root -p asteriskcdrdb < SQL/cdr_mysql_table.sql
Run each line separately which will prompt for the root password.
Log into MySQL:
mysql -u root -p
Create and grant the new database user access to the database created above:
GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY 'password';
flush privileges;
quit;
For the above run each line separately and also replace password for the actual password of the new user.
Copy the module configuration file because running the install scripts creates a broken version of the file:
sudo cp /etc/asterisk/modules.conf ~/asterisk-modules.conf
Start the install script:
sudo ./install_amp
The script will prompt for some inputs to setup FreePBX. below is the output and my input (if any). Press enter to submit after each question:
Enter your USERNAME to connect to the ‘asterisk’ database:
[asteriskuser] asterisk
Enter your PASSWORD to connect to the ‘asterisk’ database:
[amp109] password
Enter the hostname of the ‘asterisk’ database:
[localhost]
Enter a USERNAME to connect to the Asterisk Manager interface:
[admin]
Enter a PASSWORD to connect to the Asterisk Manager interface:
[amp111] anotherPassword
Enter the path to use for your AMP web root:
[/var/www/html]
/var/www
Created /var/www
Enter the IP ADDRESS or hostname used to access the AMP web-admin:
[xx.xx.xx.xx]
Enter a PASSWORD to perform call transfers with the Flash Operator Panel:
[passw0rd] thirdPassword
Use simple Extensions [extensions] admin or separate Devices and Users [deviceanduser]?
[extensions]
Enter directory in which to store AMP executable scripts:
[/var/lib/asterisk/bin]Created /var/lib/asterisk/bin
Enter directory in which to store super-user scripts:
[/usr/local/sbin]
Ensure you you use the password from the database setup when it prompts for Enter your PASSWORD to connect to the ‘asterisk’ database. Other password prompts should be new ones.
Move the configuration file previously backed up back to the newly installed FreePBX:
sudo cp ~/asterisk-modules.conf /etc/asterisk/modules.conf
Add the web user (www-data) to the asterisk group so that asterisk can serve and make changes using the web server:
sudo adduser www-data asterisk
Add the following to the end of a /etc/amportal.conf
AMPASTERISKUSER=www-data
AMPASTERISKGROUP=asterisk
AMPASTERISKWEBUSER=www-data
AMPASTERISKWEBGROUP=asterisk
Start FreePBX:
sudo amportal start
Restart Apache web server to take hold of the new permissions:
sudo service apache2 restart
If FreePBX started successfully then it has been installed correctly. Continue below to start FreePBX on computer startup.
Remove Asterisk from startup because FreePBX will start it:
sudo update-rc.d -f asterisk remove
Run the background checker:
sudo sed -e s/BACKGROUND=0/BACKGROUND=1/ -i /usr/sbin/safe_asterisk
Add the line below in /etc/rc.local above the line exit 0:
/usr/local/sbin/amportal start
This is the post install for 2.9. Go to the web page to start configuring FreePBX. If the install path was the same as in the above /var/www/ then open up a web browser and point it to the IP address of the machine. Go to the module admin page and ensure all the basic modules are up to date.
FreePBX 2.10 post install is slightly longer because it does not include the modules during the install. Instead the modules have to be downloaded after but this is not very obvious and the webpage does not load properly until this is done.
As per 2.9, go to the website which is usually the IP address of the computer. Running the following will list the network interfaces and their details:
ifconfig
Go to the page and click on FreePBX Administration This should prompt for a username and password. The default for this is admin and admin.
Once logged in, a welcome page appears.
First, install the relevant modules. Click on the Admin link at the top. Ensure the Basic repository is checked and not the others. Click on the Check Online button.
When the page refreshes, there will be a list of modules in with radio buttons for each one along with various badly formatted text. By default a list of modules will have download but keep disabled checked. Change the selection for the following:
Once selected, click on the Process button and then Confirm button. Take note that the process should have a loading icon as if the page is loading. A small window with a scroll bar should appear towards the top right hand side. Scroll down to the bottom and press Return. If this does not appear, wait for the page to complete “loading”. The page will not change the loading icon in the browser will stop / disappear which means it has finished updating. Click on the Admin link at the top and the page to make the Apply Config button to appear at the top. Once that is done, log out and log back in. This time the interface should change and look much cleaner and doesn’t look broken.
Change the admin password in Admin > Administrators from the top menu bar and select admin from the right side of the page to edit the admin user account. Hit the red Apply Config button at the top whenever it appears.
Go back to the modules and check for updates. Whilst they were enabled, the updates were not applied but now it’s easier to navigate the menus. Continue with the rest of the setup as normal such as adding extensions, trunks, etc.
The install is fairly painless to the previous install of FreePBX on Ubuntu 10.04 because it used the repository version of Asterisk which means there is no compiling required.
Whilst installing was easy, I have not managed to get the setup above working with my systems because Asterisk won’t register properly. I hope you have more luck than I have.
Asterisk and FreePBX on Ubuntu Server 10.10
Hey,
I followed your guide and at the last moment im stuck:
/usr/local/sbin/amportal: No such file or directory
Can you help me at this point?
Greetings,
Maomanna
When does that message come up?
after running
sudo amportal start
it respond with:
sudo: amportal: command not found
I guess the command
sudo ./install_amp
went wrong. i’ll retry
after reinstalling AMP i think it worked.
the output is:
/usr/src/freepbx-2.11.0beta1$ sudo amportal start
Fetching FreePBX settings with gen_amp_conf.php..
SETTING FILE PERMISSIONS
Permissions OK
STARTING ASTERISK
Asterisk is already running
it works!
i only can not open the webinterface.
maybe can u help me
mkdir: missing operand
Try `mkdir –help’ for more information.
**** ERROR: COULD NOT CREATE ****
Attempt to execute ‘mkdir -p ‘ failed with an exit code of 1
You must create this directory and the try again.
i just get this message when i start am portal.
Check your config files to see if you have any unescaped special characters in your username / passwords.
Hi i get this errors by am portal restart
STOPPING FOP SERVER
FOP Server Stopped
SETTING FILE PERMISSIONS
chmod: cannot operate on dangling symlink `/var/lib/asterisk/bin/ampbackup.php’
chmod: cannot operate on dangling symlink `/var/lib/asterisk/bin/callerid’
chmod: cannot operate on dangling symlink `/var/lib/asterisk/bin/callerid_updater.php’
chmod: cannot operate on dangling symlink `/var/lib/asterisk/bin/caller_updater.php’
chmod: cannot operate on dangling symlink `/var/lib/asterisk/bin/dumpastdb.php’
chmod: cannot operate on dangling symlink `/var/lib/asterisk/bin/fax-process.pl’
chmod: cannot operate on dangling symlink `/var/lib/asterisk/bin/restoreastdb.php’
chown: cannot dereference `/var/www/html/freepbx’: No such file or directory
Now i can see 1 problem at the last rule i dont use /var/www/html/freepbx but without html. But i dont no where i can change it