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.


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.


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 -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
tar zxvf lame-3.98.4.tar.gz
cd lame-3.98.4
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

Installing Asterisk 1.8

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

cd /usr/src
tar xvfz asterisk-1.8-current.tar.gz
cd asterisk-1.8.0
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 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
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.


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;

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.


This is the database user you specified earlier.


This is the password for the database user.


Use the default value.


The username for the FreePBX administrator.


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


Use the default value.


The public IP that will be used.


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


Use the default value.


Use the default value.


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.


Change the AUTHTYPE entry to database to enable authentication.


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


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.