Cài đặt Freepbx 12 và Asterisk 13 trên Centos 6.5
1. Cài đặt Centos 6.5 - Cài đặt bình thường. Chọn chế độ cài đặt Basic Server.2. Initial System Setup 2.1. Disable selinux - vi /etc/sysconfig/selinux sửa dòng sau: SELINUX=disabled - Restart server: reload - Kiểm tra trạng thái selinux: sestatus 2.2. Update Your System yum -y update yum groupinstall core yum groupinstall base2.3. Install Additional Required Dependenciesyum 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-develIPTablesSee the current status: chkconfig iptables --listDisable iptables:chkconfig --level 0123456 iptables offStop the service (this skips rebooting again):service iptables stopAuto Start MySQLYou 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 onThen start mysqld if you don't plan on rebooting during the installation phase: service mysqld startAuto Start ApacheYou 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 onThen start apache if you don't plan on rebooting during the installation phase:service httpd startInstall PearDBpear channel-update pear.php.netpear install db-1.7.14You may receive a warning:WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"At this time it is safe to ignore that message2.8. Reboot server rebootInstall Dependencies for Google Voice (If needed/wanted)3.1. Install iksemel cd /usr/srcwget https://iksemel.googlecode.com/files/iksemel-1.4.tar.gztar xf iksemel-*.tar.gzcd iksemel-*./configuremakemake installAdd the Asterisk Useradduser asterisk -M -c "Asterisk User"Install and Configure Asterisk5.1. Download Asterisk source files. cd /usr/srcwget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gzwget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gzwget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gzgit clone https://github.com/akheron/jansson.gitwget http://www.pjsip.org/release/2.2.1/pjproject-2.2.1.tar.bz2Compile and install DAHDI and LibPRIcd /usr/srctar xvfz dahdi-linux-complete-current.tar.gztar xvfz libpri-1.4-current.tar.gzrm -f dahdi-linux-complete-current.tar.gz libpri-1.4-current.tar.gzcd dahdi-linux-complete-*make allmake installmake configcd /usr/src/libpri-1.4.*makemake installCompile and install pjprojectIf you are doing this on a 64 bit system, please note that you MUST set the following during configure: --libdir=/usr/lib64 /usr/srctar -xjvf pjproject-2.2.1.tar.bz2cd pjproject-2.2.1CFLAGS='-DPJ_HAS_IPV6=1' ./configure --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr --libdir=/usr/libmake depmakemake install--libdir=/usr/lib64cd /usr/src/janssonautoreconf -i./configure --libdir=/usr/libmakemake installCompile and install AsteriskIf you are doing this on a 64 bit system, please note that you MUST set the following during configure: --libdir=/usr/lib64cd /usr/srctar xvfz asterisk-13-current.tar.gzrm -f asterisk-13-current.tar.gzcd asterisk-*contrib/scripts/install_prereq install./configure --libdir=/usr/libcontrib/scripts/get_mp3_source.shmake menuselect![]() After selecting 'Save & Exit' you can then continue makemake installmake configldconfigInstall Asterisk-Extra-SoundsNote that this installs the (8khz) 'wav' soundfiles and G722 (High Definition 'Wideband') audio. mkdir -p /var/lib/asterisk/soundscd /var/lib/asterisk/soundswget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gztar xfz asterisk-extra-sounds-en-wav-current.tar.gzrm -f asterisk-extra-sounds-en-wav-current.tar.gz# Wideband Audio downloadwget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-g722-current.tar.gztar xfz asterisk-extra-sounds-en-g722-current.tar.gzrm -f asterisk-extra-sounds-en-g722-current.tar.gz# Wideband Audio download G729wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-g729-current.tar.gztar xfz asterisk-extra-sounds-en-g729-current.tar.gzrm -f asterisk-extra-sounds-en-g729-current.tar.gzInstall and Configure FreePBX6.1. Download and extract FreePBX. wget http://mirror.freepbx.org/freepbx-12.0.3.tgztar vxfz freepbx-12.0.3.tgzSet ownership permissions.chown asterisk. /var/run/asteriskchown -R asterisk. /etc/asteriskchown -R asterisk. /var/{lib,log,spool}/asteriskchown -R asterisk. /usr/lib/asteriskchown -R asterisk. /usr/lib64/asteriskmkdir /var/www/htmlchown -R asterisk. /var/www/A few small modifications to Apache.sed -i 's/(^upload_max_filesize = ).*/120M/' /etc/php.inicp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf_origsed -i 's/^(User|Group).*/1 asterisk/' /etc/httpd/conf/httpd.confservice httpd restartConfigure Asterisk database in MYSQL. cd /usr/src/freepbxexport ASTERISK_DB_PW=amp109mysqladmin -u root create asterisk mysqladmin -u root create asteriskcdrdb 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 --installdb --username=asteriskuser --password=${ASTERISK_DB_PW}amportal chownamportal a ma installallamportal a reloadamportal a ma refreshsignaturesamportal chownIf 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.6.7. Finally, one last mod and start FreePBX. ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3amportal restartStart FreePBXNavigate: http://yourlocalipaddress/html or if you prefer http://localhost/admin 8. Install and Setup Commercial Modules 8.1. Enable the FreePBX Commercial yum repos wget -P /etc/yum.repos.d/ -N http://yum.schmoozecom.net/schmooze-commercial/schmooze-commercial.repoyum clean all to clean out yum cache so it will find out new RPMsyum clean allyum install needed RPMs for Commercial Modulesyum -y install php-5.3-zend-guard-loader sysadmin fail2ban incron ImageMagick8.4. Restart Apache and Install Sysadminservice httpd restartamportal a ma download sysadminamportal a ma install sysadmin9. Troubleshooting Problem 9.1. CDR not working... I fiddled with this a bit without knowing a huge amount about what was going on with the adaptive CDRs. Apparently just writing to mySQL is being deprecated, and adaptive CDR is what you want. Who knew. Anyway: I had to install the mysql connector to ODBC:
Then, I made the /etc/odbc.ini file to point to the database that the instructions had created: [
You can test that you have gotten this far with isql:
Type "help" and if you see the cdr (call data records) and cel (channel event logs) databases, then you're pretty far along. There was no /etc/asterisk/cdr_adaptive_odbc.conf created, so I created one:
Then a restart and a CLI> cdr show status and an example call showed that it was all working. Problem: Security Issue .htaccess files are disable on this webserver. Please enable them. This is a critical issue and should be resolved urgently Solve: Open httpd.conf in your favorite text editor (normally in /etc/httpd/conf/httpd.conf) Look for the context "<Directory "/var/www/html">" Within that context make sure "AllowOverride" is uncommented and set to "All" ![]() Restart Apache by running: service httpd restart |


Leave a Reply Cancel Reply