Contact

Blogs

Take a look at the things that interest us.

Install Asterisk 18 on Centos 7

Wesley Wesley 3 years
Install Asterisk 18 on Centos 7

In today's blog post we are going to install the new Asterisk 18 on our centos 7 system. To get started we first update our centos system.

$ yum update all

After this, let's install the packages that are needed for Asterisk 18.

$ yum install vim epel-release gcc gcc-c++ wget make bzip2 patch subversion json-c json-c-devel unixODBC unixODBC-devel mysql-connector-odbc libtool-ltdl libtool-ltdl-devel jansson-devel libsrtp-devel openssl openssl-devel dmidecode ncurses-devel libxml2-devel newt-devel kernel-devel sqlite-devel libuuid-devel gtk2-devel binutils-devel libedit libedit-devel svn

SELinux

When all the required packages are installed, we will disable SELinux to make sure that Asterisk works without any problems. To view the current SELinux status and the policy that is being used on your Centos 7 system, use the sestatus command:

$ sestatus
output
SELinux status:                                 enabled
SELinuxfs mount:                                /sys/fs/selinux
SELinux root directory:                         /etc/selinux
Loaded policy name:                             targeted
Current mode:                                   enforcing
Mode from config file:                          enforcing
Policy MLS status:                              enabled
Policy deny_unknown status:                     allowed
Max kernel policy version:                      31

You can see from the output above that SELinux is enabled and set to enforcing mode.

SELinux has three modes:

  • Enforcing: SELinux allows access based on SELinux policy rules.
  • Permissive: SELinux only logs actions that would have been denied if running in enforcing mode.
  • Disabled: No SELinux policy is loaded.

By default, in CentOS 7, SELinux is enabled and in enforcing mode.

How to disable selinux

To permanently disable SELinux on your CentOS 7 system, follow the steps below:

Open the SELinux config file.

$ vim /etc/selinux/config

Set the SELinux mod to disabled

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#       targeted - Targeted processes are protected,
#       mls - Multi Level Security protection.
SELINUXTYPE=targeted

Now save the file and reboot the system.

$ sudo shutdown -r now

Once the system has been rebooted you can check the SELinux status again with the following command.

$ sestatus
output
SELinux status:                 disabled

Install Pjsip

The next step is to install Pjsip, this package is used within Asterisk. Let's download the Pjsip package and set it up

$ cd /usr/src/
$ wget https://github.com/pjsip/pjproject/archive/2.10.tar.gz
$ tar zxvf 2.10.tar.gz
$ rm -f 2.10.tar.gz

Now it's time to install Pjsip on our Centos 7 system.

$ cd pjproject-2.10
$ ./configure CFLAGS="-DNDEBUG -DPJ_HAS_IPV6=1" --prefix=/usr --libdir=/usr/lib64 --enable-shared --disable-video --disable-sound --disable-opencore-amr
$ make dep
$ make
$ make install
$ ldconfig

Install Asterisk 18

After Pjsip has been installed we can start installing the Asterisk 18 application. Let's start with downloading Asterisk 18 on our Centos 7 system.

$ cd /usr/src/
$ wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz
$ tar xvfz asterisk-18-current.tar.gz
$ rm -f asterisk-18-current.tar.gz

Now we can install Asterisk 18

$ cd /usr/src/asterisk-18*/
$ contrib/scripts/install_prereq install
$ ./configure --libdir=/usr/lib64 --with-jansson-bundled
$ make menuselect.makeopts
$ menuselect/menuselect --enable chan_ooh323 --enable format_mp3 --enable CORE-SOUNDS-JA-WAV --enable CORE-SOUNDS-JA-ULAW --enable CORE-SOUNDS-JA-ALAW --enable CORE-SOUNDS-JA-GSM --enable CORE-SOUNDS-JA-G729 --enable CORE-SOUNDS-JA-G722 --enable CORE-SOUNDS-JA-SLN16 --enable CORE-SOUNDS-JA-SIREN7 --enable CORE-SOUNDS-JA-SIREN14 --enable app_macro --disable BUILD_NATIVE
$ contrib/scripts/get_mp3_source.sh
$ make
$ make install
$ make samples
$ make config
$ ldconfig

After Asterisk 18 has been installed we need to make sure that Asterisk is started and enabled.

$ sudo systemctl enable asterisk
$ sudo systemctl start asterisk

Now let's verify that Asterisk 18 has been started.

$ sudo systemctl status asterisk
output
● asterisk.service - LSB: Asterisk PBX
   Loaded: loaded (/etc/rc.d/init.d/asterisk; bad; vendor preset: disabled)
   Active: active (running) since Wed 2020-11-18 00:36:12 UTC; 1min 5s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 20001 ExecStop=/etc/rc.d/init.d/asterisk stop (code=exited, status=0/SUCCESS)
  Process: 20027 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited, status=0/SUCCESS)

Now Asterisk 18 has been installed on your Centos 7 system.

Install Asterisk 18 on Centos 7 2021-08-18 09:16:17

There are no comments.

4587

Have questions about our services?

Contact our Sales team to get answers.

Contact Us
gomibako@aska-ltd.jp