Installing FreePBX 2.8 with Asterisk 1.8 on CentOS 5.5

FreePBX has become quite popular over the last few years. Unfortunately, the documentation has not quite caught up to the popularity. At the time of this writing, most of the documentation available was for older versions of CentOS, FreePBX and/or Asterix. Below I have outlined the steps required to get FreePBX 2.8 working with Asterisk 1.8 on CentOS 5.5.


If you are reading this as after having followed the steps in my previous article Installing CentOS 5.5 with Linux Integration Services 2.1 on Hyper-V R2 or if you have not selected the following package groups during your installation of CentOS, make sure you do so now by using the following commands.

Preparations

You will need five different passwords.

PASSWORD1 – Your root password.
PASSWORD2 – Used for the asterisk database user.
PASSWORD3 – Used for the FreePBX administrator.
PASSWORD4 – Used for Flash Operator Panel.
PASSWORD5 – Used for the Asterisk Recording Interface.

Requirements

yum groupinstall "DNS Name Server"
yum groupinstall "Web Server"
yum groupinstall "Mail Server"
yum groupinstall "MySQL Database"
yum groupinstall "Development Tools"

Once you are sure that the needed package groups are installed, you will want to install the prerequisites as follows.

yum install e2fsprogs-devel keyutils-libs-devel krb5-devel libogg libselinux-devel libsepol-devel libxml2-devel libtiff-devel
yum install gmp php-pear php-pear-DB php-gd php-mysql php-pdo kernel-devel ncurses-devel audiofile-devel libogg-devel
yum install openssl-devel mysql-devel zlib-devel perl-DateManip sendmail-cf sox

Make sure you also have wget installed.

yum install wget

Next you will setup named.

echo "options {" >> /var/named/chroot//etc/named.conf
echo " directory \"/var/named\";" >> /var/named/chroot//etc/named.conf
echo " dump-file \"/var/named/data/cache_dump.db\";" >> /var/named/chroot//etc/named.conf
echo " statistics-file \"/var/named/data/named_stats.txt\";" >> /var/named/chroot//etc/named.conf
echo "};" >> /var/named/chroot//etc/named.conf
echo "include \"/etc/rndc.key\";" >> /var/named/chroot//etc/named.conf
cd /var/named/chroot//etc/
chmod 640 named.conf
chgrp named named.conf
ln -s /var/named/chroot//etc/named.conf /etc/named.conf

You will want to adjust the security settings as per your requirements but for the simplicity of this article, we are going to turn off Security-Enhanced Linux and open the firewall fully.

echo "SELINUX=disabled" > /etc/selinux/config
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
iptables -X
/etc/init.d/iptables save

LAME is required for Asterisk’s audio related functions. You will want to download LAME to a source directory, compile and then install it.

cd /usr/src
wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz?ts=1292626574&use_mirror=cdnetworks-us-1
tar zxvf lame-3.98.4.tar.gz
cd lame-3.98.4
./configure
make
make install

You can optionally remove the source once you have installed LAME.

cd ..
rm -fr lame-3.98.4
rm lame-3.98.4.tar.gz

Before continuing, insure that all packages are up to date and then reboot.

yum update
reboot

Installing Asterisk 1.8

Get Asterisk 1.8 and extract it to its own source folder.

cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz
tar xvfz asterisk-1.8-current.tar.gz
cd asterisk-1.8.0
contrib/scripts/get_mp3_source.sh
./configure
make menuconfig

The last command will launch the source configuration manager. The only portions you will want to install are app_mysql, app_saycountpl, cdr_mysql, format_mp3, res_config_mysql and EXTRAS-SOUNDS-EN-GSM (which can be found in the Extra Sound Packages sub-menu). Save your selections and exit. Now compile the source and install.

make
make install

You can optionally remove the source directory once you have installed Asterisk.

cd ..
rm -fR asterisk-1.8.0
rm asterisk-1.8-current.tar.gz

Installing FreePBX 2.8

Get FreePBX 2.8 and extract it to its own source folder.

cd /usr/src
wget http://mirror.freepbx.org/freepbx-2.8.0.tar.gz
tar xvfz freepbx-2.8.0.tar.gz
cd freepbx-2.8.0

Start MySQL, create the asterisk databases and run the initial SQL setup scripts.

/etc/init.d/mysqld start
chkconfig mysqld on
mysqladmin create asterisk
mysqladmin create asteriskcdrdb
mysql asterisk < SQL/newinstall.sql
mysql asteriskcdrdb < SQL/cdr_mysql_table.sql

Start the MySQL command line.

mysql

Define the user and password for each of the databases.

GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'PASSWORD2';
GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'PASSWORD2';
flush privileges;
\q

Change the MySQL user to root.

mysqladmin -u root password 'PASSWORD1'

Create the Asterisk user and set folder permissions.

useradd -c "Asterisk PBX" -d /var/lib/asterisk asterisk
chown -R asterisk:asterisk /var/run/asterisk
chown -R asterisk:asterisk /var/log/asterisk
chown -R asterisk:asterisk /var/lib/php/session/

Update the Apache configuration file.

vi /etc/httpd/conf/httpd.conf

Change User apache and Group apache to User asterisk and Group asterisk.

Change AllowOverride None to AllowOverride All.

Update ServerName to use your server’s FQDN.

Start Apache.

/etc/init.d/httpd start
chkconfig httpd on

Start Asterisk.

./start_asterisk start

Configure FreePBX.

./install_amp --username=asteriskuser --password=PASSWORD2

The next series of prompts will give you default values within square brackets which you can accept by hitting enter. If you wish to change a value, simply type it and hit enter after.

[asteriskuser]

This is the database user you specified earlier.

[PASSWORD2]

This is the password for the database user.

[localhost]

Use the default value.

[admin]

The username for the FreePBX administrator.

[amp111]

The password for the FreePBX administrator. It is important to change this. (Use PASSWORD3 you prepared earlier.)

[/var/www/html]

Use the default value.

[xx.xx.xx.xx]

The public IP that will be used.

[passw0rd]

The Flash Operator Panel password. It is important to change this. (Use PASSWORD4 you prepared earlier.)

[extensions]

Use the default value.

[/var/lib/asterisk/bin]

Use the default value.

[/usr/local/sbin]

Use the default value.

Change the Asterisk Recording Interface password and turn on user authentication for the web interface by editing the amportal.conf file.

vi /etc/amportal.conf

Change the ARI_ADMIN_PASSWORD entry to update the ARI password.

ARI_ADMIN_PASSWORD=PASSWORD5

Change the AUTHTYPE entry to database to enable authentication.

AUTHTYPE=database

Optionally, you can turn off the FOP completely by changing the following settings.

FOPRUN=false
FOPDISABLE=true

Save and exit.

Add FreePBX to the boot process.

echo "/usr/local/sbin/amportal start" >> /etc/rc.local

You can ensure that the administrator user has the proper password in the database by navigating to the Administrators tab, choosing the admin user and clicking on the Update password link. Once your password has been updated, logout by clicking the link at the top right of the page.

Finally, reboot the server one last time.

reboot

25 thoughts on “Installing FreePBX 2.8 with Asterisk 1.8 on CentOS 5.5

  1. Todd

    Thank you for these instructions!

    I’ve been successful following these steps on a fresh install of CentOS 5.5 server (i386) up to the start MySQL command in the Installing FreePBX 2.8 section. The “/etc/init.d/mysqld start” command will not run even when executed directly from the init.d folder. The file is listed in this directory; but all files in this folder are listed in green. The earlier command: yum groupinstall “MySQL Database” reported success.

    Did I miss a step?

    I’m taking advantage of the holiday week to accomplish internal projects; if I can get past this install problem, I’ll look forward to confirming the instructions from the perspective of a Linux lightweight…

  2. Todd

    I must have “fat fingered” one of the earlier steps as after starting over (also moved up to 64 bit CentOS) I did not have a problem: your instructions work perfectly!

    Here are my minor observations in case they help someone else:
    – The Asterisk source configuration manager did not launch after “make menuconfig”, but this does not seem to have impacted the installation’s success.
    – I was able to substitute (as you probably intended) “asterisk-1.8-current.tar.gz” with “asterisk-1.8.1.1.tar.gz” which is the current edition at the moment.
    – I had to restart my install a third time after realizing that special characters cannot be used in some of the passwords.

    I am very grateful to you for putting these instructions together and look forward to testing Asterisk 1.8.1.1 and FreePBX 2.8.0.4 next week.

  3. Rob

    First of all, thanks for this guide!

    I followed it to the letter but I have one issue.
    When finished I go to the administration page: 192.168.1.104
    Here I click on FreePBX administration. When redirected to the /admin page I get prompted for a password.
    Tried every combination I wrote down but no luck :(
    It is not the default freepbx login page, it’s a popup, looks like something from apache?

  4. Pingback: Link: Installing FreePBX 2.8 with Asterisk 1.8 on CentOS 5.5 « The Michigan Telephone blog

  5. yasar telci

    Thank you for this instruction.

    I’m new in linux. I get the following comment. what did I wrong. please help me?

    [root@localhost /]# ./start_asterisk start
    bash: ./start_asterisk: No such file or directory

  6. Krystyna Gordon

    Thanks so much for this! It took me less than an hour to get this up and running! Thanks so much! There were some hiccups along the way, but I have experienced them earlier, and know how to fix them! I didn’t install the DNS server, I figured I could do well without it… do you think I should install it??? Thanks once again!

  7. ronaldo miranda

    i just want to say “THANKS”, people like you turn the life more easy. when you have the knowledge you change yourself, when share the knowledge you change the world. for sure you did it.
    thanks again.

  8. ThinkerIV

    Thanks a lot for these instructions. They were pretty good. However, I did need to change two things to make it work on my install. When I would execute “./start_asterisk start”, it would come up with quite a few problems. Asterisk would still start, and most of them could be ignored. They were things that were taken care of after freePBX was done installing. One of them I needed to take care of though. Asterisk could not access /var/lib/asterisk/astdb. It would get a permission denied error since the owner of this file was root.

    To solve this enter:
    chown -R asterisk:asterisk /var/lib/asterisk/astdb
    when you are changing the other file permissions.

    The next problem was that after I had it all installed I could not login to the web interface. My user name and password would not work. My problem was exactly like Rob described above. The solution to this is that since you set it to AUTHTYPE=database, you need to login to the freepbx admin console with the database user and password. If you used the defaults it will be: user: asteriskuser password: PASSWORD2

  9. ThinkerIV

    EDIT TO THE ABOVE:

    I said to do chown -R asterisk:asterisk /var/lib/asterisk/astdb,

    I actually meant to write chown -R asterisk:asterisk /var/lib/asterisk/

    This changes the permissions on the whole directory not just the astdb

  10. yasar telci

    Jean-Sebastien,

    Thank you very match, its running perfect. I have also activatet the Flash operator panel. But when I run FOP I see the buttons but no any informations such as extensions etc. There is a message at the top of the FOP ” client/server version mismatch!”
    I am very grateful to you for putting these instructions.

  11. Emad Sabar

    Thanks a lot for your hug Support ,
    i have one question , the installation is running perfect but i couldn’t run the ooh323 CHANNEL.

    i do any troubleshooting but without luck .

    can you Pls. help me how to register the ooh323 CHANNEL.

    Emad

  12. Pingback: Virtualzing Asterisk PBX 1.8 and FreePBX 2.8 « Noble Paladin

  13. Steve

    I have did this install twice and cannot get logged into the Web Admin page. doesnt like the username/password. I have copied/pasted your setup exactly. I have looked in the amportal.conf and manager.conf and the username/passwords are correct.

    any help would be great.

  14. kompo

    @ThinkerIV

    I have the same problem as Rob and tried your way, User:asteriskuser Pass:PASSWORD2, but I can’t loggin =( could anyone help me? Please

    Thank you in advance

  15. Steve

    I found the issue…

    another weird thing i came across to. On one of my test systems during the amp_install setup script, I didnt specify a Public IP for FOP. Figured i could go back later into the ampconfig file and edit that per FreePBX documentation but that didnt work. Not sure if that IP is being held in the database as well or not.

  16. Steve

    if use this site to build freepbx 2.9…you will have an issue with AUTHTYPE and getting logged in. You can find the issue here… http://www.freepbx.org/trac/ticket/4847 supposedly they fixed it but i dont see the fix.

    Instead I had to go from 2.8 to 2.9 ….then after it upgrades DO NOT close out your browser, go to the admin page and re-enter the username and password and save it and reload. that will fix it. also, editing ampconfig wont work anymore as with 2.9 they made adjustments, the issue lies in the MySQL database tables.

    This document explains it…http://www.freepbx.org/news/2011-02-28/version-2-9-amportal-conf-advanced-settings-im-confused

  17. Pingback: Installing Asterisk and FreePBX from Scratch | SBG Enterprises, LLC

  18. Omer Ahmad

    Thank you for Great Help!, Just tried all the steps in fresh CentOS 5.5 machine. Everything worked smooth without any error.
    Freepbx is installed successfully…..

  19. steve

    Great write up. I used this for Centos 6.4 Asterisk 11 and FreePBX 2.11. Thank you very much!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>