Skip to content

Instal on CentOS 7

Phantom edited this page Jul 19, 2019 · 21 revisions

Disable selinux

In /etc/sysconfig/selinux , change the following lines:

sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/sysconfig/selinux
sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config

reboot, and verify the selinux status by running 'sestatus'. It should say:

SELinux status: disabled

Update Your System

yum -y update
yum -y groupinstall core base "Development Tools"

Add the Asterisk User

adduser asterisk -m -c "Asterisk User"

firewall-cmd --zone=public --add-port=2000/tcp --permanent
firewall-cmd --zone=public --add-service=tftp --permanent
firewall-cmd --zone=public --add-port=6970/tcp --permanent
firewall-cmd --zone=public --add-port=5060/udp --permanent
firewall-cmd --zone=public --add-port=5061/udp --permanent
firewall-cmd --zone=public --add-port=4569/udp --permanent
firewall-cmd --zone=public --add-port=5060/tcp --permanent
firewall-cmd --zone=public --add-port=5061/tcp --permanent
firewall-cmd --zone=public --add-port=5038/tcp --permanent
firewall-cmd --zone=public --add-port=10000-20000/udp --permanent
firewall-cmd --zone=public --add-service=ntp --permanent 
firewall-cmd --reload

Install Additional Required Dependencies

yum -y install lynx tftp-server unixODBC mysql-connector-odbc mariadb-server mariadb \
 httpd ncurses-devel sendmail sendmail-cf sox newt-devel libxml2-devel libtiff-devel \
 audiofile-devel gtk2-devel subversion kernel-devel git crontabs cronie \
 cronie-anacron wget vim uuid-devel sqlite-devel net-tools gnutls-devel python-devel texinfo \
 libuuid-devel

Install php 5.6 repositories

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Install php5.6w

yum remove php*
yum install php56w php56w-pdo php56w-mysql php56w-mbstring php56w-pear php56w-process php56w-xml php56w-opcache    php56w-ldap php56w-intl php56w-soap

Install nodejs

curl -sL https://rpm.nodesource.com/setup_8.x | bash -
yum install -y nodejs

Enable and Start MariaDB

You must have MariaDB running for freepbx to operate normally. It must start automatically, and be running continuously.

systemctl enable mariadb.service
systemctl start mariadb

Enable and Start Apache

FreePBX uses the Apache web server, so this must be started and running.

systemctl enable httpd.service
systemctl start httpd.service

Now that our MariaDB database is running, we want to run a simple security script that will remove some dangerous defaults and lock down access to our database system a little bit

mysql_secure_installation

Increase Mysql Group Concat Max.Length

cd /etc/
nano my.cnf

And add the following line below [mysqld] as shown below

[mysql]
group_concat_max_len = 8192

Install Additional packadge

yum install -y install mpg321 lame sox bc mpg123* lame* sox* bc libao libao-devel libmad \
libmad-devel libsamplerate libsamplerate-devel sox cdparanoia flac-devel id3lib id3lib-devel  \
libid3tag libid3tag-devel libXmu-devel tftp tftp-server* xinetd* bind bind-utils dhcp ntp

yum install -y unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel mysql-connector-odbc

Asterisk 15

Compile and Install jansson

cd /usr/src
wget -O jansson.tar.gz https://github.com/akheron/jansson/archive/v2.10.tar.gz
tar vxfz jansson.tar.gz
rm -f jansson.tar.gz
cd jansson-*
autoreconf -i
./configure --libdir=/usr/lib64
make && make install

Compile and Install Asterisk 15

cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-15-current.tar.gz
tar xvfz asterisk-15-current.tar.gz
rm -f asterisk-*-current.tar.gz
cd asterisk-*
contrib/scripts/install_prereq install
./configure --libdir=/usr/lib64 --with-pjproject-bundled
contrib/scripts/get_mp3_source.sh
make menuselect

After selecting 'Save & Exit' you can then continue

make
make install
make config
ldconfig
chkconfig asterisk off

Set Asterisk ownership permissions.

chown asterisk. /var/run/asterisk
chown -R asterisk. /etc/asterisk
chown -R asterisk. /var/{lib,log,spool}/asterisk
chown -R asterisk. /usr/lib64/asterisk
chown -R asterisk. /var/www/

FreePBX

Install and Configure FreePBX

A few small modifications to Apache.

sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php.ini
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/httpd/conf/httpd.conf
sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf
systemctl restart httpd.service

Download and install FreePBX.

cd /usr/src
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-14.0-latest.tgz
tar xfz freepbx-14.0-latest.tgz
rm -f freepbx-14.0-latest.tgz
cd freepbx
./start_asterisk start
./install -n

Perform an asterisk web setup before proceeding.


Automatic Startup

Please note you need to set up FreePBX to start asterisk (and it's associated services) on bootup. You can view an example systemd startup script here.

Download and install Chan Sccp.

cd /usr/src
git clone https://github.com/chan-sccp/chan-sccp.git chan-sccp
cd chan-sccp
./configure --enable-conference --enable-advanced-functions --enable-distributed-devicestate --enable-video
make -j2 && make install && make reload
mysql -p asterisk < /usr/src/chan-sccp/conf/mysql-v5_enum.sql

Go to asterisk web. Open page "Asterisk Modules"

  • Add Excluded Modules : chan_skinny.so
  • Add Manually Loaded Modules : chan_sccp.so

Download and install Sccp Manager.

asterisk -rx "core reload now"
cd /var/www/html/admin/modules/
git clone https://github.com/PhantomVl/sccp_manager.git
amportal chown
amportal a ma install sccp_manager

Download and install Provision Sccp.

cd /usr/src
git clone https://github.com/dkgroot/provision_sccp.git
mkdir /tftpboot
cp -R /usr/src/provision_sccp/tftpboot/firmware /tftpboot/firmware
cp -R /usr/src/provision_sccp/tftpboot/ringtones /tftpboot/ringtones
cp -R /usr/src/provision_sccp/tftpboot/wallpapers /tftpboot/Desktops
cp -R /usr/src/provision_sccp/tftpboot/locales/languages /tftpboot/languages
cp /usr/src/provision_sccp/tftpboot/index.php /tftpboot/index.php
cp /usr/src/provision_sccp/etc/apache2/conf.d/tftpboot.conf /etc/httpd/conf.d/tftpboot.conf
cp /var/www/html/admin/modules/sccp_manager/contrib/rewrite.rules /tftpboot/rewrite.rules
cp /var/www/html/admin/modules/sccp_manager/contrib/index.cnf /tftpboot/index.cnf
mv /tftpboot/languages/Russian_Russia /tftpboot/languages/Russian_Russian_Federation
chown -R asterisk. /tftpboot
yes |cp --force /var/www/html/admin/modules/sccp_manager/contrib/tftp.xinetd /etc/xinetd.d/tftp

Go to asterisk web. Open page "SCCP Connectivity -> Server Config"

  • TFTP SERVER remapping support : "Provision"
  • Click "Submit"

Configure DHCP

manual (https://github.com/chan-sccp/chan-sccp/wiki/setup-dhcp-service)

Configure Named (Bind)

service named start
chkconfig named on

Configure NTP

/etc/ntp.conf

# line 18: add the network range you allow to receive requests
restrict 10.0.0.0 mask 255.255.255.0 nomodify notrap
# change servers for synchronization
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org

systemctl start ntpd 
systemctl enable ntpd 
ntpq -p