X

How To Install FreePBX 14 And Asterisk 14 On CentOS 7

At this time FreePBX is an open source IP telephony system. So I want to show how to install  FreePBX 14 And Asterisk 14 On CentOS 7 using local server or cloud server. Lets start and see my full tutorial and video. If arise any question goto footer and submit your valuable comment.

How To Configure Static IP address On Ubuntu 18.04
How To Install OsTicket On Ubuntu 16.04

Step #01: Disable selinux, add asterisk user and allow firewall-cmd 80 port.

[root@FreePBX-Server ~]#   cat /etc/resolv.conf
[root@FreePBX-Server ~]#   sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/sysconfig/selinux
[root@FreePBX-Server ~]#   sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config
[root@FreePBX-Server ~]#   yum -y update
[root@FreePBX-Server ~]#   yum -y groupinstall core base "Development Tools"
[root@FreePBX-Server ~]#   adduser asterisk -m -c "Asterisk User"
[root@FreePBX-Server ~]#   firewall-cmd --zone=public --add-port=80/tcp --permanent
[root@FreePBX-Server ~]#   firewall-cmd --reload

Step #02: Install database server and web server using below command for FreePBX.

[root@FreePBX-Server ~]#   yum -y install lynx tftp-server unixODBC mysql-connector-odbc mariadb-server mariadb httpd ncurses-devel sendmail sendmail-cf sox newt-devel li bxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion kernel-devel git crontabs cronie cronie-anacron wget vim uuid-devel sqlite-devel net-t ools gnutls-devel python-devel texinfo libuuid-devel

Step #03: Add required repo for install FreePBX 14

[root@FreePBX-Server ~]#   rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@FreePBX-Server ~]#   rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
[root@FreePBX-Server ~]#   yum remove php*

Step #04: Install php required package for install FreePBX 14

[root@FreePBX-Server ~]#   yum install php56w php56w-pdo php56w-mysql php56w-mbstring php56w-pear php56w-process php56w-xml php56w-opcache php56w-ldap php56w-intl php56w- soap

Step #05: Start and enable some service for FreePBX 14.

[root@FreePBX-Server ~]#   curl -sL https://rpm.nodesource.com/setup_8.x | bash -
[root@FreePBX-Server ~]#   yum install -y nodejs
[root@FreePBX-Server ~]#   systemctl enable mariadb.service
[root@FreePBX-Server ~]#   systemctl start mariadb
[root@FreePBX-Server ~]#   systemctl enable httpd.service
[root@FreePBX-Server ~]#   systemctl start httpd.service

Step #06: Download and install iksemel for FreePBX 14

[root@FreePBX-Server ~]#   cd /usr/src
[root@FreePBX-Server src]#   wget -c https://src.fedoraproject.org/lookaside/pkgs/iksemel/iksemel-1.4.tar.gz/md5/532e77181694f87ad5eb59435d11c1ca/iksemel-1.4.tar.gz
[root@FreePBX-Server src]#   tar xf iksemel-1.4.tar.gz
[root@FreePBX-Server src]#   cd iksemel*
[root@FreePBX-Server iksemel-1.4]#   ./configure
[root@FreePBX-Server iksemel-1.4]#   make
[root@FreePBX-Server iksemel-1.4]#   make install

Step #07: Download libpri and asterisk 14 for install FreePBX 14.

[root@FreePBX-Server iksemel-master]#   cd /usr/src
[root@FreePBX-Server src]#   wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz
[root@FreePBX-Server src]#   wget https://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-14.7.7.tar.gz
[root@FreePBX-Server src]# wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
[root@FreePBX-Server src]# tar xvfz dahdi-linux-complete-current.tar.gz 
[root@FreePBX-Server src]# cd dahdi-linux-complete-* 
[root@FreePBX-Server dahdi-linux-complete-3.1.0+3.1.0]# make all 
[root@FreePBX-Server dahdi-linux-complete-3.1.0+3.1.0]# make install 
[root@FreePBX-Server dahdi-linux-complete-3.1.0+3.1.0]# make config 
[root@FreePBX-Server dahdi-linux-complete-3.1.0+3.1.0]# cd /usr/src 
[root@FreePBX-Server src]# tar xf libpri-current.tar.gz 
[root@FreePBX-Server src]# cd libpri*
[root@FreePBX-Server libpri-1.6.0]#   make
[root@FreePBX-Server libpri-1.6.0]#   make install

Step #08: Download jansson for install FreePBX 14.

[root@FreePBX-Server libpri-1.6.0]#   cd /usr/src
[root@FreePBX-Server src]#   wget -O jansson.tar.gz https://github.com/akheron/jansson/archive/v2.10.tar.gz
[root@FreePBX-Server src]#   tar xf jansson.tar.gz
[root@FreePBX-Server src]#   cd jansson*
[root@FreePBX-Server jansson-2.10]#   autoreconf -i
[root@FreePBX-Server jansson-2.10]#   ./configure --libdir=/usr/lib64
[root@FreePBX-Server jansson-2.10]#   make
[root@FreePBX-Server jansson-2.10]#   make install

Step 09: Extract asterisk before download from Step #07 and install for FreePBX 14

[root@FreePBX-Server jansson-2.10]#   cd /usr/src
[root@FreePBX-Server src]#   tar xf asterisk-14.7.7.tar.gz
[root@FreePBX-Server src]#   cd asterisk-14*
[root@FreePBX-Server asterisk-14.7.7]#   contrib/scripts/install_prereq install
[root@FreePBX-Server asterisk-14.7.7]#   ./configure --libdir=/usr/lib64 --with-pjproject-bundled
[root@FreePBX-Server asterisk-14.7.7]#   contrib/scripts/get_mp3_source.sh
[root@FreePBX-Server asterisk-14.7.7]#   make menuselect
[root@FreePBX-Server asterisk-14.7.7]#   make
[root@FreePBX-Server asterisk-14.7.7]#   make install
[root@FreePBX-Server asterisk-14.7.7]#   make config
[root@FreePBX-Server asterisk-14.7.7]#   ldconfig
[root@FreePBX-Server asterisk-14.7.7]#   chkconfig asterisk off

Step #10: Setup asterisk permission and increase upload size for FreePBX 14.

[root@FreePBX-Server asterisk-14.7.7]#   cd 
[root@FreePBX-Server ~]#   chown asterisk. /var/run/asterisk
[root@FreePBX-Server ~]#   chown -R asterisk. /etc/asterisk
[root@FreePBX-Server ~]#   chown -R asterisk. /var/{lib,log,spool}/asterisk
[root@FreePBX-Server ~]#   chown -R asterisk. /usr/lib64/asterisk
[root@FreePBX-Server ~]#   chown -R asterisk. /var/www/
[root@FreePBX-Server ~]#   sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf
[root@FreePBX-Server ~]#   systemctl restart httpd.service

Change upload size from /etc/php.ini file.

upload_max_filesize = 120M

Then save for press Esc type :wq then press Enter.

manually add below two line 66 & 67 edit your /etc/httpd/conf/httpd.conf file.

User asterisk

Group asterisk

[root@FreePBX-Server ~]# vi /etc/httpd/conf/httpd.conf

For save press Esc type :wq then press Enter.

Then save file and start again.

[root@FreePBX-Server ~]# systemctl restart httpd.service

Step #11: Now setup mysql secure installation using below command.

[root@FreePBX-Server ~]#   mysql_secure_installation

Then see output below

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):  << Press enter
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y  << Type Y to setup MariaDB root password
New password:  << Enter MariaDB root password
Re-enter new password:   << Confirm  MariaDB root password
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y << Type Y to remove anonymous users
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y  << Type Y to disable root login remotely
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y << Type Y to remove test database
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y << Type Y to reload privilege tables
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Important now server reboot needed then install FreePBX 14.

Step #12: Download FreePBX 14 then extract and install on my server CentOS 7

[root@FreePBX-Server ~]#   cd /usr/src
[root@FreePBX-Server src]#   wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-14.0-latest.tgz
[root@FreePBX-Server src]#   tar xf freepbx-14.0-latest.tgz
[root@FreePBX-Server src]#   cd freepbx*
[root@FreePBX-Server freepbx]# sestatus
[root@FreePBX-Server freepbx]#   ./start_asterisk start
[root@FreePBX-Server freepbx]#   ./install

Now see output as like below:

Database engine [mysql]: << Press enter
Database name [asterisk]: << Press enter
CDR Database name [asteriskcdrdb]: << Press enter
Database username [root]: << Press enter
Database password: passw0rd << Type your root password
File owner user [asterisk]: << Press enter
File owner group [asterisk]: << Press enter
Filesystem location from which FreePBX files will be served [/var/www/html]: << Press enter
Filesystem location from which Asterisk configuration files will be served [/etc/asterisk]: << Press enter
Filesystem location for Asterisk modules [/usr/lib64/asterisk/modules]: << Press enter
Filesystem location for Asterisk lib files [/var/lib/asterisk]: << Press enter
Filesystem location for Asterisk agi files [/var/lib/asterisk/agi-bin]: << Press enter
Location of the Asterisk spool directory [/var/spool/asterisk]: << Press enter
Location of the Asterisk run directory [/var/run/asterisk]: << Press enter
Location of the Asterisk log files [/var/log/asterisk]: << Press enter
Location of the FreePBX command line scripts [/var/lib/asterisk/bin]: << Press enter
Location of the FreePBX (root) command line scripts [/usr/sbin]: << Press enter
Location of the Apache cgi-bin executables [/var/www/cgi-bin]: << Press enter
Directory for FreePBX html5 playback files [/var/lib/asterisk/playback]: << Press enter

This is last message like as :

Finished setting permissions
Generating default configurations...
Finished generating default configurations
You have successfully installed FreePBX

Important note : must be selinux disable otherwise not install FreePBX 14.

Step #13 : Now browser your server IP address using any browser. Then create your admin account and enjoy IP telephony system. 

http://10.66.40.10/

See some module so if you need more module then update your server.

Goto Module Admin under Admin menu. Now click Check Online then click Download all.  Then click Process and finally click Confirm on the left bottom.

Step #14 : After download complete then click Return and then click Apply Config on the top right corner.

If see any problem so see my YouTube channel. Please subscribe my channel for more update.

5 2 votes
Article Rating
Admin: I am system administrator as Windows and Linux platform. I have 4 years skilled from the professional period. I have to configure Linux based system such as an Asterisk VOIP system, Network monitoring tools (ZABBIX), Virtualization (XEN Server), Cloud computing (Apache CloudStack) etc. Now share my professional skill each interested person. Thanks to all.

View Comments (29)

  • Hello, I have a problem, it is only after installation when freePBX was successfully installed. When I go to my browser and type the IP address of my server, it puts me:
    This page does not work
    Unable to process this request via 192.168.1.20 at this time.
    HTTP ERROR 500

    What to do please, I tried to uninstall the firewall from the beginning, but to no avail.

    • I am already enable 80 port from Step #01. If you use 443 for https so please enable this post same as Step #01 check again.
      Thanks.

      • sir, I have the same problem as mentioned above, I am already using port 80 , please tell me the solution

        • I think your server run multiple web server like httpd and nginx. So stop one then use this.
          Thank you so much!

  • Hello, I have a problem,

    Error communicating with Asterisk. Ensure that Asterisk is properly installed and running                                       as the asterisk user
    Asterisk does not appear to be running
    Try starting Asterisk with the './start_asterisk start' command in this directory

    • Any error you see when run ./start_asterisk start this command. So please send me error log or contact me via my facebook page.
      And also you can check your server 80 port is allow from firewall now you see firewall allow port list for run below command.

      $ firewall-cmd --list-all

      Advanced firewall list for FreePBX

      Thanks.

  • Hello, I have a problem, it is only after installation when freePBX was successfully installed. When I go to my browser and type the IP address of my server, it puts me:

    This page does not work ...... i am using step 1 .
    
    [root@FreePBX-Server ~]#   firewall-cmd --zone=public --add-port=80/tcp --permanent
    [root@FreePBX-Server ~]#   firewall-cmd --reload
    
    

    Warning: ALREADY_ENABLED: 80:tcp

  • hello. i have successfully installed FreePBX
    [root@freepbx ~]# firewall-cmd --list-all
    public (active)
     target: default
     icmp-block-inversion: no
     interfaces: ens33
     sources:
     services: dhcpv6-client sip sips ssh
     ports: 443/tcp 10000-20000/udp 4569/udp 5060/udp 5061/udp 5160/udp 5161/udp 5160/tcp 5060/tcp 81/tcp 4443/tcp 8088/tcp 8089/tcp 8001/tcp 8003/tcp

    and stile i can not access to GUI freepx , plz help me

      • [root@freepbx ~]# tail -f /var/log/httpd/error_log

        [Tue Jul 21 20:34:08.361924 2020] [:error] [pid 1999] [client 192.168.1.3:50564] PHP Warning: include_once(/etc/freepbx.conf): failed to open stream: Permission denied in /var/www/html/admin/config.php on line 126
        
      • [Tue Jul 21 20:34:08.362047 2020] [:error] [pid 1999] [client 192.168.1.3:50564] PHP Warning: include_once(): Failed opening '/etc/freepbx.conf' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/admin/con
        
      • [Tue Jul 21 20:34:08.362103 2020] [:error] [pid 1999] [client 192.168.1.3:50564] PHP Fatal error: Class 'FreePBX' not found in /var/www/html/admin/config.php on line 136
        [Tue Jul 21 20:34:08.362271 2020] [:error] [pid 1999] [client 192.168.1.3:50564] PHP Warning: Unknown: open(/var/lib/php/session/sess_o33gvo9b01i3ft0190phm351l5, O_RDWR) failed: Permission denied (13) in Unknown on line 0
        
        • your web directory permission problem. Please see again Step #10:
          So I think it is solved!

          Thanks.

  • Thank you very much sir, you save my life.
    I'm struggling a week with official FreePBX procedure without any success. Your procedure is awesome thank you

  • [root@78 asterisk-14.7.7]# cd
    [root@78 ~]# chown asterisk. /var/run/asterisk
    chown: invalid user: ‘asterisk.’
    [root@78 ~]# 

  • hello I have a problem Database installation checking credentials and permissions..Erro
    r!
    Invalid Database Permissions. The error was: SQLSTATE[28000] [10
    45] Access denied for user 'GmarvinG'@'localhost' (using passwor
    d: NO)

  • hello when i try to login to webpage by ip it gives error "file(/etc/amportal.conf): failed to open stream: Permission denied"

    how can i solve this sestatus is disabled

  • i am having issue while using ./install .I am new user working on 1 project.
    i have attached copy of error kindly suggest what can i do to fix .

    Checking if Asterisk is running and we can talk to it as the 'asterisk' user...Error!
    Error communicating with Asterisk. Ensure that Asterisk is properly installed and running as the asterisk user
    Asterisk appears to be running as root
    Try starting Asteris

    • First check selinux status, its should be turn off then server reboot and then start asterisk service from freepbx folder. then run ./install command.

      Thanks.

Leave a Comment