Introduction
Do It Yourself an IPPBX.
This article is divided into three parts:
- Part 1: Prepare The Server
- Part 2: Install Asterisk 11
- Part 3: Install FreePBX 12
The goal is to get the PC provides Private Branch eXchange services, a phone system, using Free and Open Source Software.
Part 1: Prepare The Server
Linux CentOS 6.7 Minimal
Linux server installation:
- You may use VirtualBox or any other virtualization software, or a real server
- You need fast Internet connection, we will be downloading lots of stuffs from the server
- Install CentOS 6.7 minimal version, get minimal version of ISO here
- Configure the network so that the server will have access to the Internet
- Access the server using SSH, work from outside
- You will need to login as root during installation
Suggestion on partition layout:
- 4GB for /
- 1GB for swap
- the rest of available space for /var
Update CentOS and install basic system config tools:
yum update yum install system-config-firewall system-config-firewall-tui system-config-network-tui system-config-network reboot
Please note that the
reboot
command is essential.
Development Packages
Install development packages:
yum install wget perl subversion gcc gcc-c++ make kernel-devel ncurses-devel newt-devel mysql-devel openssl-devel libxml2-devel zlib-devel curl-devel speex-devel unixODBC-devel libtool-ltdl-devel sqlite-devel
Web and Database Server
Install Apache2 web server and MySQL database server:
yum install httpd mysql-server mysql php php-mysql php-gd php-cli php-pear php-posix php-xml php-mbstring chkconfig httpd on chkconfig mysqld on /etc/init.d/httpd start /etc/init.d/mysqld start
Server Init
Follow all instructions to initialize your server.
Disable Firewall
Disable firewall from system config tool:
system-config-firewall
Please note that you can enable the firewall again later after successful installation.
Disable SELINUX
Edit /etc/sysconfig/selinux
and change SELINUX=enforcing
to SELINUX=disabled
:
vi /etc/sysconfig/selinux
Configure Web Server
Add user for Asterisk and change files ownership:
useradd asterisk chown asterisk.asterisk -R /var/www/html /var/lib/php
Edit /etc/httpd/conf/httpd.conf
and change these optios:
– User and Group setting, go to line 242-243 and change User apache
to User asterisk
and Group apache
to Group asterisk
– Allow access .htaccess
, go to line 338 change AllowOverride None
to AllowOverride All
vi /etc/httpd/conf/httpd.conf /etc/init.d/httpd restart
Make sure the web server run as user asterisk
:
ps aux | grep httpd
Configure Database Server
Set root
password for MySQL database server, in this example we will use simple password password
:
/etc/init.d/mysqld restart mysqladmin -uroot -p password 'password'
Please note that the initial password for MySQL server is empty, just press ENTER.
Part 2: Install Asterisk 11
Download Source Codes
Prepare sources directory in /root/src
, in there we will gather all software source codes:
mkdir -p /root/src cd ~/src
Get the latest Asterisk, current release is Asterisk 11.21.1:
wget -c http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-11.21.1.tar.gz
Get the latest PRI library, current release is libpri 1.4.15:
wget -c http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.4.15.tar.gz
Get the latest Asterisk hardware drivers, current release is dahdi 2.11.0:
wget -c http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-2.11.0+2.11.0.tar.gz
Get Secure RTP library, we will be using SRTP 1.4.2:
wget -c http://srtp.sourceforge.net/srtp-1.4.2.tgz
Compile and Install SRTP
Install Secure RTP library:
cd ~/src tar -zxf srtp-1.4.2.tgz cd srtp ./configure CFLAGS=-fPIC make make runtest make install ldconfig cd ../
Compile and Install DAHDI
Install Asterisk hardware drivers DAHDI:
cd ~/src tar -zxf dahdi-linux-complete-2.11.0+2.11.0.tar.gz cd dahdi-linux-complete-2.11.0+2.11.0 make all make install make config cd ../
Please note that DAHDI must be installed before libpri and Asterisk.
Compile and Install libpri
Install PRI library:
cd ~/src tar -zxf libpri-1.4.15.tar.gz cd libpri-1.4.15 make make install ldconfig cd ../
Compile and Install Asterisk
Only after SRTP, DAHDI and libpri then we can install Asterisk:
cd ~/src tar -zxf asterisk-11.21.1.tar.gz cd asterisk-11.21.1 ./contrib/scripts/get_mp3_source.sh ./configure make menuselect
Inside make menuselect
you may choose which packages you want to install or remove.
Here is the recommended options:
- Add-ons tab select chan_ooh323, format_mp3 and cdr_mysql
- Applications tab select app_meetme
- Core Sound Packages tab select EN WAV, ULAW, ALAW, GSM, G729, G722, SLN16
- Music On Hold File Packages tab select EN WAV, ULAW, ALAW, GSM, G729, G722, SLN16
- Extras Sound Packages tab select EN WAV, ULAW, ALAW, GSM, G729, G722, SLN16
Please note that sound files and music on hold files are essential, but the selection type can be minimized into just EN WAV, GSM and G729.
Continue to compile and install Asterisk:
make make install make samples chown asterisk.asterisk -R /etc/asterisk /var/lib/asterisk /usr/lib/asterisk /var/log/asterisk cd ../
Please note that most Asterisk installation howto will suggest you to install init script for Asterisk but not this time. Since we will be installing FreePBX as well the start and stop script will be handled by
amportal
, the init script from FreePBX.
Part 3: Install FreePBX 12
Download Source
Get the current stable release of FreePBX, FreePBX 12:
cd ~/src wget -c http://mirror.freepbx.org/modules/packages/freepbx/freepbx-12.0-latest.tgz
FreePBX Dependencies
Add databases and install PEAR-DB 1.7.14:
mysqladmin -uroot -p create asterisk mysqladmin -uroot -p create asteriskcdrdb pear install db-1.7.14
Please note that the PEAR-DB version must be 1.7.14. The latest version of PEAR-DB cannot be used by FreePBX 12.
FreePBX Installation
Install FreePBX, pay attention to details, you will be asked several important questions and you must answer them correctly:
cd ~/src tar -zxf freepbx-12.0-latest.tgz -C /var/ chown asterisk.asterisk -R /var/freepbx
Asterisk must be running during FreePBX installation. FreePBX provides a script to run the Asterisk:
cd /var/freepbx ./start_asterisk restart ps aux | grep asterisk
Remove existing /var/www/html
otherwise the install script will fail. You can explicitly remove the directory or just move it somewhere:
mv /var/www/html /var/www/html.orig
Continue to install FreePBX:
cd /var/freepbx ./install_amp --installdb --cleaninstall --install-moh cd ../
After installation process the server must be configured to start amportal
on boot and rebooted.
Insert /usr/local/sbin/amportal start
at the bottom of /etc/rc.local
:
echo '/usr/local/sbin/amportal start' >> /etc/rc.local
Last step, reboot the server:
reboot
Please note that the server reboot is required.
FreePBX Setup
Open browser and browse the server’s IP address to login to FreePBX. Create the admin username and password for FreePBX, login as admin user and hit the red Apply Config button on top.
At this point the IPPBX is ready, but before proceeding with other configuration we should consider to update the FreePBX first. Visit Module Admin menu from the Admin tab, and then hit the Check Online button. To continue the update process click the Upgrade all button followed by Process button.
IPPBX installation finished.
Author
This howto is written by Anton Raharja and at some point edited and double-checked by Asoka Wardhana.
Sorry, earned -successful installation
LikeLike
(Google translate) First of all, thank you for the article Anton. This is the only guide that I have earned. But in my case there were some errors such as “asterisk: error while loading shared libraries: libasteriskssl.so.1: can not open shared object file: No such file or directory”. Solution: Add the file /etc/ld.so.konf Stork / usr / local / lib64. There were also a few errors. Fully error-free installation I have occurred after the following modifications:
compile Asterisk I used ./configure –libdir = / usr / lib64 instead of ./configure
2.chown asterisk.asterisk -R / var / run / asterisk
chown asterisk.asterisk -R / usr / lib64 / asterisk
mysql -u root -pWsHshFj4VnEDycQn -e “GRANT ALL PRIVILEGES ON asterisk * TO asteriskuser @ localhost IDENTIFIED BY ‘fkdjfifs7d8s9JGHjhsa’;.”
163 mysql -u root -pWsHshFj4VnEDycQn -e “GRANT ALL PRIVILEGES ON asteriskcdrdb * TO asteriskuser @ localhost IDENTIFIED BY ‘fkdjfifs7d8s9JGHjhsa’;.”
164 mysql -u root -pWsHshFj4VnEDycQn -e “flush privileges;”
../install_amp –username = asteriskuser –password = fkdjfifs7d8s9JGHjhsa –installdb –cleaninstall (without using the –install-moh)
Line echo ‘/ usr / local / sbin / amportal start’ & amp; amp; amp; amp; amp; gt; & amp; amp; amp; amp; amp; gt; /etc/rc.lokal not worked, corrected file /etc/rc.lokal manually.
I am writing this, can someone be useful if you will get an error like mine.
(Original)
Прежде всего спасибо Антон за статью. Это единственное руководство, которое у меня заработало. Но в моем случае возникали некоторые ошибки например “asterisk: error while loading shared libraries: libasteriskssl.so.1: cannot open shared object file: No such file or directory”. Решение: добавить в файл /etc/ld.so.конф сторку /usr/local/lib64. Так же были еще несколько ошибок. Полностью безошибочная установка у меня произошла после следующих доработок:
при компиляции астериск я использовал ./configure –libdir=/usr/lib64 вместо ./configure
2.chown asterisk.asterisk -R /var/run/asterisk
chown asterisk.asterisk -R /usr/lib64/астериск
mysql -u root -pWsHshFj4VnEDycQn -e “GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY ‘fkdjfifs7d8s9JGHjhsa’;”
163 mysql -u root -pWsHshFj4VnEDycQn -e “GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY ‘fkdjfifs7d8s9JGHjhsa’;”
164 mysql -u root -pWsHshFj4VnEDycQn -e “flush privileges;”
../install_amp –username=asteriskuser –password=fkdjfifs7d8s9JGHjhsa –installdb –cleaninstall (без параметра –install-moh)
Строка echo ‘/usr/local/sbin/amportal start’ >> /etc/rc.локал не работала, поправил файл /etc/rc.локал вручную.
Пишу это, может кому-то будет полезно, если будут получатся ошибки, как у меня.
LikeLike
Im not sure about the requirement to include /usr/lib64 as I didn’t notice it during writing the tutorial, I always tests several times, were u using CentOS minimal 6.7 64bit with the same asterisk version ? As for the & its translated by WordPress, thanks for that, will check and fix it.
LikeLike
I used Asterisk 11.21.1, same as you. Иy the way, that command “chown asterisk.asterisk -R /etc/asterisk /var/lib/asterisk /usr/lib/asterisk /var/log/asterisk” not working in one line.
LikeLike
its working, tested
LikeLike
Hello! What bin your Centos (32 or 64?).
LikeLike
was using centos minimal 64bit
LikeLike
in the manual the /var/www/html did removed but then it will be created again by next command the install_amp
LikeLike
rm -rf /var/www/html why are we removing this html folder, my http page is now giving an error
LikeLike
sorry about that, its the tutorial article, and supposed to be installed on new CentOS minimal 6.7. the html folder need to be removed otherwise the FPBX12 install script will fail.
LikeLike
Thanks for the quick response Anton. Maybe my question is my httpd fails to start because of the missing html folder. “Starting httpd: Syntax error on line 292 of /etc/httpd/conf/httpd.conf:
DocumentRoot ‘/var/www/html’ is not a directory, or is not readable
[FAILED]”
That is the error i get my CentOS is 6.7. i didnt see where to uncomment the document root path in the tutorial. your assistance will be greatly appreciated.
LikeLike