Install Centos 6.3



Initial System Setup

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


You MUST disable selinux.  selinux can cause strange behavior during the install

Disable selinux

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

--- begin lines --- 
SELINUX=disabled
SELINUXTYPE=targeted
--- end lines --- 

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

SELinux status: disabled

Update Your System

yum -y update
yum groupinstall core
yum groupinstall base

Install Required Dependencies

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

IPTables

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

You must disable the default iptables.  You can re-enable it later, once you have made the appropriate changes.  Information on iptables can be found with a quick Google search.  If iptables is left running, it will (at very least) block you from accessing the web interface.
 

See the current status:   

chkconfig iptables --list

Disable iptables:

chkconfig --level 0123456 iptables off

Stop the service (this skips rebooting again):

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:

chkconfig --level 345 mysqld on 

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

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:

chkconfig --level 345 httpd on 

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

service httpd start

Install PearDB

pear install db-1.7.14


You may receive a warning:

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

At this time it is safe to ignore that message

Reboot server

reboot

Install Dependencies for Google Voice

Install iksemel

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

Install and Configure Asteriskfreepbx-2.11.0.43.tgz

Download Asterisk source files.

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-1.4-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz

Compile and install DAHDI.

If you have no TDM cards you can skip this step


If you encounter this message: You do not appear to have the sources for the 2.6.32-358.23.2.el6.x86_64 kernel installed.
Run this command:

yum install -y kernel-headers-`uname -r` kernel-devel-`uname -r` glibc-headers

If that doesn't fix the problem, you may have removed the directory /usr/src/kernels . It's easy to fix. Just run these two commands: 

yum remove kernel-devel
yum install kernel-devel 

You can now repeat the installation steps below.


cd /usr/src
tar xvfz dahdi-linux-complete-current.tar.gz
cd dahdi-linux-complete-*
make all
make install 
make config

Compile and install LIBPRI.

If you have no TDM cards you can skip this step


cd /usr/src
tar xvfz libpri-1.4-current.tar.gz
cd libpri-*
make
make install

Compile and install Asterisk

During the make menuselect, please choose all options you wish to compile into Asterisk.  
For example, if you want to enable srtp, be sure to enable it at:

Resource Modules -> res_srtp



cd /usr/src
tar xvfz asterisk-11-current.tar.gz
cd asterisk-*
./configure
contrib/scripts/get_mp3_source.sh
make menuselect
make
make install
make config
make progdocs

Install Asterisk-Extra-Sounds

cd /var/lib/asterisk/sounds
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-gsm-current.tar.gz
tar xfz asterisk-extra-sounds-en-gsm-current.tar.gz
rm -f asterisk-extra-sounds-en-gsm-current.tar.gz

Install and Configure FreePBX

Download and extract FreePBX.

cd /usr/src
wget http://mirror.freepbx.org/freepbx-2.11.0.43.tgz
tar vxfz freepbx-2.11.0.43.tgz

Now create the Asterisk user and set ownership permissions.

adduser asterisk -M -c "Asterisk User"
chown asterisk. /var/run/asterisk
chown -R asterisk. /etc/asterisk
chown -R asterisk. /var/{lib,log,spool}/asterisk
chown -R asterisk. /usr/lib/asterisk
mkdir /var/www/html
chown -R asterisk. /var/www/

A few small modifications to Apache.

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. 

cd /usr/src/freepbx
export ASTERISK_DB_PW=amp109 
mysqladmin -u root create asterisk 
mysqladmin -u root create asteriskcdrdb 
mysql -u root asterisk < SQL/newinstall.sql 
mysql -u root asteriskcdrdb < SQL/cdr_mysql_table.sql 

Set permissions on MYSQL database.

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.

cd /usr/src/freepbx
./start_asterisk start
./install_amp
amportal a ma installall
amportal a reload


** If “. /install_amp” fails to run correctly, in terminal type:

./install_amp --username=asteriskuser --password=$ASTERISK_DB_PW


Finally, one last mod and start FreePBX.

ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
amportal start 

Start FreePBX

Navigate: 

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

After you enable and update the modules in FreePBX You might see the following error.
Symlink from modules failed 
 

To correct this error do the following: 

Delete the list of failed files

cd /etc/asterisk
rm ccss.conf confbridge.conf features.conf sip.conf iax.conf logger.conf extensions.conf sip_notify.conf

Then on the FreePBX webUI go to the ‘Module Admin’ and uninstall and reinstall the ‘Camp On’ module. This should resolve the Symlink issue.