Installing Asterisk 11 + FreePBX on CentOS 6.5 1


Step by step instructions for installing software PBX Asterisk 11.x and control panel FreePBX on CentOS 6.5

Conditions:

CentOS installed and has access to the Internet.

Before install:

  1. # yum -y update
  2. Turn off SELinux:
    # vi /etc/selinux/config
  3. # reboot
  4. Additional repos:
    # rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm 
    # rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    
  5. # yum -y install mc make gcc kernel-devel gcc-c++ ncurses-devel httpd mysql-server mysql mysql-devel php iksemel iksemel-devel crypto-utils openssl-devel gmime gmime-devel spandsp spandsp-devel openldap openldap-devel popt-devel libresample libresample-devel speex speex-devel libcurl-devel speex-tools svn sqlite-devel mod_ssl php-mysql php-pear-MDB2-Driver-mysqli php-mbstring php-gd php-mcrypt libxml2-devel lame bison audiofile-devel sox php-pear-DB php-posix
    
  6. # cd /root
  7. # wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz 
    # tar -zxf asterisk-11-current.tar.gz
  8. # wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
    # tar -zxf libpri-1.4-current.tar.gzwget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
    # tar -zxf dahdi-linux-complete-current.tar.gz

Installing DAHDI, libPRI and Asterisk

  1. # cd dahdi-linux-complete-2.9.0+2.9.0.1
    #make all
    #make install
    #make config
  2. # cd libpri-1.4.14
    # make
    # make install
    
  3. # cd asterisk-11.7.0
    # ./configure --prefix=/usr --exec-prefix=/usr --with-crypto --with-dahdi --with-iconv -with-libcurl --with-gmime --with-iksemel --with-mysqlclient --disable-xmldoc --with-pri --with-spandsp --with-ldap --with-libcurl --with-popt --with-resample --with-speex
    # make menuselect
    # contrib/scripts/get_mp3_source.sh
    # make
    # make install
    # make samples
    
  4. # ln -s /usr/lib/libasteriskssl.so.1 /usr/lib64/libasteriskssl.so.1
    # ln -s /usr/lib/libpri.so.1.4 /usr/lib64/libpri.so.1.4
    # cat contrib/init.d/rc.redhat.asterisk | sed 's/__ASTERISK_SBIN_DIR__/\/usr\/sbin/' > /etc/init.d/asterisk
    # chkconfig --add asterisk
    # cp -rf configs/* /etc/asterisk/
    
  5. # service dahdi start
    # service asterisk start
    

Installing FreePBX

  1.  # wget “http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.5.5/phpMyAdmin-3.5.5-all-languages.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fphpmyadmin%2Ffiles%2FphpMyAdmin%2F3.5.5%2FphpMyAdmin-3.5.5-all-languages.tar.gz%2Fdownload&ts=1358931580&use_mirror=ignum”
    # tar -zxf phpMyAdmin-3.5.5-all-languages.tar.gz -C /var/www/
  2. in /etc/hosts:
    [IP PBX] pbx-mysql.example.com 
    [IP PBX] pbx.example.com
  3. to  /etc/httpd/httpd.conf:
    NameVirtualHost *:443
  4. to /etc/httpd/conf.d/ssl.conf:
    DocumentRoot "/var/www/phpmyadmin"
    ServerName pbx-mysql.example.com:443
    ErrorLog logs/ssl_phpmyadmin_error_log
    TransferLog logs/ssl_phpmyadmin_access_log
    LogLevel warn
    SSLEngine on
    
    SSLProtocol all -SSLv2
    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
    SSLCertificateFile /etc/pki/tls/certs/localhost.crt
    SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
    
    SSLOptions +StdEnvVars
    
    <Directory "/var/www/cgi-bin">
    SSLOptions +StdEnvVars
    
    SetEnvIf User-Agent ".*MSIE.*" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
    
    CustomLog logs/ssl_phpmyadmin_request_log \
    "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
    
    <Directory "/var/www/phpmyadmin">
    Order allow,deny
    Allow from [Admin IP]
    
    DocumentRoot "/var/www/html"
    ServerName pbx.example.com:443
    ErrorLog logs/ssl_html_error_log
    TransferLog logs/ssl_html_access_log
    LogLevel warn
    SSLEngine on
    
    SSLProtocol all -SSLv2
    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
    SSLCertificateFile /etc/pki/tls/certs/localhost.crt
    SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
    
    SSLOptions +StdEnvVars
    
    <Directory "/var/www/cgi-bin">
    SSLOptions +StdEnvVars
    
    SetEnvIf User-Agent ".*MSIE.*" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
    
    CustomLog logs/ssl_html_request_log \
    "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
    
    <Directory "/var/www/html">
    Order allow,deny
    Allow from [Admin IP]
    
  5. # cd /var/www/
    # ln -s phpMyAdmin-3.5.5-all-languages phpmyadmin
    # service httpd restart
    # chkconfig --levels 345 mysqld on
    # chkconfig --levels 345 httpd on
    # service mysqld start
    # /usr/bin/mysql_secure_installation
    

    Change root password for MySQL

  6. # cd /root
    # wget http://mirror.freepbx.org/freepbx-2.11.0.tar.gz
    # tar -zxf freepbx-2.11.0.tar.gz -C /usr/src 
    # cd /usr/src/freepbx-2.11.0
  7. Edit php.ini:
    # vi /etc/php.ini (or /etc/php4/apache2/php.ini)
    upload_max_filesize=20M
    
  8. # mysqladmin create asteriskcdrdb -p
    # mysql -p asteriskcdrdb < SQL/cdr_mysql_table.sql
    # mysqladmin create asterisk -p
    # mysql -p asterisk < SQL/newinstall.sql 
    # mysql -p 
    mysql> GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY '[your password]';
    mysql> GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY '[your password]';
    mysql> flush privileges;
  9. # groupadd asterisk 
    # useradd -c "asterisk PBX" -d /var/lib/asterisk -s /sbin/nologin -g asterisk asterisk
  10. Edit:
    # vi /etc/httpd/conf/httpd.conf (or /etc/apache2/apache2.conf):
    User asterisk
    Group asterisk
    
  11. # chown asterisk /var/lib/php/session
  12. # ./install_amp
  13. In the database named asterisk for table named freepbx_settings change password for asterisk manager:
    # mysql -p
    mysql> UPDATE `asterisk`.`freepbx_settings` SET `value` = '[your password 2]' WHERE `freepbx_settings`.`keyword` = 'AMPMGRPASS';
  14. # chown asterisk /etc/modprobe.d/dahdi.conf
  15. # rm /etc/asterisk/ccss.conf /etc/asterisk/logger.conf /etc/asterisk/iax.conf /etc/asterisk/extensions.conf /etc/asterisk/sip_notify.conf /etc/asterisk/features.conf /etc/asterisk/sip.conf
  16. Change something in freepbx admin panel, click Apply (default username/password – admin/admin)
  17. Change default password

Additional installation:

  1.  # yum -y install bind bind-utils mailx ntp
    # chkconfig --add named
    # chkconfig --add ntpdate
    # service ntpdate start
    # service named start
    # echo “nameserver 127.0.0.1” > /etc/resolv.conf
    # echo “nameserver 8.8.8.8” >> /etc/resolv.conf
  2. # yum -y install xinetd tftp-server 
    # vi /etc/xinetd.d/tftp
    -s /tftp -c
    # mkdir /tftp && 
    # chown nobody /tftp 
    # vi /etc/sysconfig/iptables 
    # service xinetd start
    
  3. Add to iptables config:
     -A INPUT -m udp -p udp -d [IP PBX]/32 --dport 5060 -m hashlimit --hashlimit 10/m --hashlimit-burst 10 --hashlimit-mode srcip,dstip,dstport --hashlimit-htable-expire 180 --hashlimit-name SIP -j ACCEPT

 

 


Leave a comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

One thought on “Installing Asterisk 11 + FreePBX on CentOS 6.5

  • Hunter

    This tutorial feels like a lot to digest when reading. There are some steps I skipped because they were not necassarry for the config of my machine. However maybe I missed something? I wouldn’t know because of the sheer lack of comments. Excellent article but please consider adding more substance in between as some people will not just gladly follow by pasting your code to their terminal like me.

    Thank you for this article however as I haven’t ran into any issues.