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:
[code lang=”text”]
yum update
yum install system-config-firewall system-config-firewall-tui system-config-network-tui system-config-network
reboot
[/code]
Please note that the
reboot
command is essential.
Development Packages
Install development packages:
[code lang=”text”]
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
[/code]
Web and Database Server
Install Apache2 web server and MySQL database server:
[code lang=”text”]
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
[/code]
Server Init
Follow all instructions to initialize your server.
Disable Firewall
Disable firewall from system config tool:
[code lang=”text”]
system-config-firewall
[/code]
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
:
[code lang=”text”]
vi /etc/sysconfig/selinux
[/code]
Configure Web Server
Add user for Asterisk and change files ownership:
[code lang=”text”]
useradd asterisk
chown asterisk.asterisk -R /var/www/html /var/lib/php
[/code]
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
[code lang=”text”]
vi /etc/httpd/conf/httpd.conf
/etc/init.d/httpd restart
[/code]
Make sure the web server run as user asterisk
:
[code lang=”text”]
ps aux | grep httpd
[/code]
Configure Database Server
Set root
password for MySQL database server, in this example we will use simple password password
:
[code lang=”text”]
/etc/init.d/mysqld restart
mysqladmin -uroot -p password ‘password’
[/code]
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:
[code lang=”text”]
mkdir -p /root/src
cd ~/src
[/code]
Get the latest Asterisk, current release is Asterisk 11.21.1:
[code lang=”text”]
wget -c http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-11.21.1.tar.gz
[/code]
Get the latest PRI library, current release is libpri 1.4.15:
[code lang=”text”]
wget -c http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.4.15.tar.gz
[/code]
Get the latest Asterisk hardware drivers, current release is dahdi 2.11.0:
[code lang=”text”]
wget -c http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-2.11.0+2.11.0.tar.gz
[/code]
Get Secure RTP library, we will be using SRTP 1.4.2:
[code lang=”text”]
wget -c http://srtp.sourceforge.net/srtp-1.4.2.tgz
[/code]
Compile and Install SRTP
Install Secure RTP library:
[code lang=”text”]
cd ~/src
tar -zxf srtp-1.4.2.tgz
cd srtp
./configure CFLAGS=-fPIC
make
make runtest
make install
ldconfig
cd ../
[/code]
Compile and Install DAHDI
Install Asterisk hardware drivers DAHDI:
[code lang=”text”]
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 ../
[/code]
Please note that DAHDI must be installed before libpri and Asterisk.
Compile and Install libpri
Install PRI library:
[code lang=”text”]
cd ~/src
tar -zxf libpri-1.4.15.tar.gz
cd libpri-1.4.15
make
make install
ldconfig
cd ../
[/code]
Compile and Install Asterisk
Only after SRTP, DAHDI and libpri then we can install Asterisk:
[code lang=”text”]
cd ~/src
tar -zxf asterisk-11.21.1.tar.gz
cd asterisk-11.21.1
./contrib/scripts/get_mp3_source.sh
./configure
make menuselect
[/code]
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:
[code lang=”text”]
make
make install
make samples
chown asterisk.asterisk -R /etc/asterisk /var/lib/asterisk /usr/lib/asterisk /var/log/asterisk
cd ../
[/code]
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:
[code lang=”text”]
cd ~/src
wget -c http://mirror.freepbx.org/modules/packages/freepbx/freepbx-12.0-latest.tgz
[/code]
FreePBX Dependencies
Add databases and install PEAR-DB 1.7.14:
[code lang=”text”]
mysqladmin -uroot -p create asterisk
mysqladmin -uroot -p create asteriskcdrdb
pear install db-1.7.14
[/code]
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:
[code lang=”text”]
cd ~/src
tar -zxf freepbx-12.0-latest.tgz -C /var/
chown asterisk.asterisk -R /var/freepbx
[/code]
Asterisk must be running during FreePBX installation. FreePBX provides a script to run the Asterisk:
[code lang=”text”]
cd /var/freepbx
./start_asterisk restart
ps aux | grep asterisk
[/code]
Remove existing /var/www/html
otherwise the install script will fail. You can explicitly remove the directory or just move it somewhere:
[code lang=”text”]
mv /var/www/html /var/www/html.orig
[/code]
Continue to install FreePBX:
[code lang=”text”]
cd /var/freepbx
./install_amp –installdb –cleaninstall –install-moh
cd ../
[/code]
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
:
[code lang=”text”]
echo ‘/usr/local/sbin/amportal start’ >> /etc/rc.local
[/code]
Last step, reboot the server:
[code lang=”text”]
reboot
[/code]
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.
rm -rf /var/www/html why are we removing this html folder, my http page is now giving an error
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.
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.
in the manual the /var/www/html did removed but then it will be created again by next command the install_amp
Hello! What bin your Centos (32 or 64?).
was using centos minimal 64bit
(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.локал вручную.
Пишу это, может кому-то будет полезно, если будут получатся ошибки, как у меня.
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.
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.
its working, tested
Sorry, earned -successful installation