Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Installing FreePBX 12 on CentOS 6.5

Table of Contents

Initial System Setup

You MUST run all of these commands as the root user!

...

In /etc/sysconfig/selinux , change the following lines:

Code Block
sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/sysconfig/selinux

reboot, and verify the selinux status by running 'sestatus'. It should say:

Code Block
SELinux status: disabled

Update Your System

Code Block
yum -y update
yum groupinstall core
yum groupinstall base

Install Additional Required Dependencies

Code Block
yum install gcc gcc-c++ lynx bison mysql-devel mysql-server php php-mysql php-pear php-mbstring tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion kernel-devel git subversion kernel-devel php-process crontabs cronie cronie-anacron wget vim php-xml uuid-devel libtool sqlite-devel unixODBC mysql-connector-odbc

IPTables

Info

Keeping IPTables turned off indefinitely is strongly discouraged. You will incur the wrath of high fees and hackers

...

See the current status:   

Code Block
chkconfig iptables --list

Disable iptables:

Code Block
chkconfig --level 0123456 iptables off

Stop the service (this skips rebooting again):

Code Block
service iptables stop

Auto Start MySQL

You must have mysql running for freepbx to operate normally.  You need to set it to start at boot time. with the following command:

Code Block
chkconfig --level 345 mysqld on

Then start mysqld if you don't plan on rebooting during the installation phase:

Code Block
service mysqld start

Auto Start Apache

You will want Apache running, so you can access the FreePBX admin interface,  You need to set it to start at boot time. with the following command:

Code Block
chkconfig --level 345 httpd on

Then start apache if you don't plan on rebooting during the installation phase:

Code Block
service httpd start

Install PearDB

Code Block
pear channel-update pear.php.net
pear install db-1.7.14

Note

You may receive a warning:

Code Block
WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"
Note

At this time it is safe to ignore that message

Reboot server

Code Block
reboot

Install Dependencies for Google Voice (If needed/wanted)

Install iksemel

Code Block
cd /usr/src
wget https://iksemel.googlecode.com/files/iksemel-1.4.tar.gz
tar xf iksemel-*.tar.gz
cd iksemel-*
./configure
make
make install

Add the Asterisk User

Code Block
adduser asterisk -M -c "Asterisk User"

Install and Configure Asterisk

Download Asterisk source files.

Code Block
cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
git clone https://github.com/akheron/jansson.git
wget http://www.pjsip.org/release/2.2.1/pjproject-2.2.1.tar.bz2

Compile and install DAHDI and LibPRI

Note

If you don't have any physical hardware you don't need to run these commands, however, it is still suggested to compile the modules, to allow you to add hardware later.

Code Block
cd /usr/src
tar xvfz dahdi-linux-complete-current.tar.gz
tar xvfz libpri-current.tar.gz
rm -f dahdi-linux-complete-current.tar.gz libpri-current.tar.gz
cd dahdi-linux-complete-*
make all
make install
make config
cd /usr/src/libpri-*
make
make install

Compile and install pjproject

Note

If you are doing this on a 64 bit system, please note that you MUST set the following during configure:

Code Block
--libdir=/usr/lib64
Code Block
cd /usr/src
tar -xjvf pjproject-2.2.1.tar.bz2
cd pjproject-2.2.1
CFLAGS='-DPJ_HAS_IPV6=1' ./configure --prefix=/usr --enable-shared --disable-sound\
  --disable-resample --disable-video --disable-opencore-amr --libdir=/usr/lib64
make dep
make
make install

Compile and Install jansson

Note

If you are doing this on a 64 bit system, please note that you MUST set the following during configure

Code Block
--libdir=/usr/lib64
Code Block
cd /usr/src/jansson
autoreconf -i
./configure --libdir=/usr/lib64
make
make install

Compile and install Asterisk

Note

If you are doing this on a 64 bit system, please note that you MUST set the following during configure

Code Block
--libdir=/usr/lib64
Code Block
cd /usr/src
tar xvfz asterisk-13-current.tar.gz
rm -f asterisk-13-current.tar.gz
cd asterisk-*
contrib/scripts/install_prereq install
./configure --libdir=/usr/lib64
contrib/scripts/get_mp3_source.sh
make menuselect

You will be prompted at the point to pick which modules to build. Most of them will be enabled, but if you want to have MP3 support, you need to manually turn on 'format_mp3' on the first page.

...

After selecting 'Save & Exit' you can then continue

Code Block
make
make install
make config
ldconfig

Install Asterisk-Extra-Sounds

Note that this installs the (8khz) 'wav' soundfiles and G722 (High Definition 'Wideband') audio.

Code Block
mkdir -p /var/lib/asterisk/sounds
cd /var/lib/asterisk/sounds
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
tar xfz asterisk-extra-sounds-en-wav-current.tar.gz
rm -f asterisk-extra-sounds-en-wav-current.tar.gz
# Wideband Audio download
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-g722-current.tar.gz
tar xfz asterisk-extra-sounds-en-g722-current.tar.gz
rm -f asterisk-extra-sounds-en-g722-current.tar.gz

Install and Configure FreePBX

Download and extract FreePBX.

Code Block
cd /usr/src
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-12.0-latest.tgz
tar vxfz freepbx-12-latest.tgz

Set ownership permissions.

Code Block
chown asterisk. /var/run/asterisk
chown -R asterisk. /etc/asterisk
chown -R asterisk. /var/{lib,log,spool}/asterisk
chown -R asterisk. /usr/lib/asterisk
chown -R asterisk. /usr/lib64/asterisk
mkdir /var/www/html
chown -R asterisk. /var/www/

A few small modifications to Apache.

Code Block
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php.ini
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf_orig
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/httpd/conf/httpd.conf
service httpd restart

Configure Asterisk database in MYSQL. 

Code Block
cd /usr/src/freepbx
export ASTERISK_DB_PW=amp109
mysqladmin -u root create asterisk 
mysqladmin -u root create asteriskcdrdb 

Set permissions on MYSQL database.

Code Block
mysql -u root -e "GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';"
mysql -u root -e "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';"
mysql -u root -e "flush privileges;"

Restart Asterisk and install FreePBX.

Code Block
cd /usr/src/freepbx
./start_asterisk start
./install_amp --installdb --username=asteriskuser --password=${ASTERISK_DB_PW}
amportal chown
amportal a ma installall
amportal a reload
amportal a ma refreshsignatures
amportal chown
Note

If you see an error about "Uncaught exception 'RuntimeException' with message 'gpg took too long to run.'" it is safe to run "amportal a ma installall" again.

Finally, one last mod and start FreePBX.

Code Block
ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
amportal restart

Start FreePBX

Navigate: 

http://yourlocalipaddress/html or if you prefer http://localhost/admin

...

Enable the FreePBX Commercial yum repos

Code Block
wget -P /etc/yum.repos.d/ -N http://yum.schmoozecom.net/schmooze-commercial/schmooze-commercial.repo

yum clean all to clean out yum cache so it will find out new RPMs

Code Block
yum clean all

yum install needed RPMs for Commercial Modules

Code Block
yum -y install php-5.3-zend-guard-loader sysadmin fail2ban incron ImageMagick

Restart Apache and Install Sysadmin

Code Block
service httpd restart
amportal a ma download sysadmin
amportal a ma install sysadmin

For Further information see: Installation on CentOS and RHEL based systems