Bobcares

Install Kamailio SIP proxy server on CentOS 7 with ease

by | Dec 9, 2020

Wondering how to install Kamailio sip proxy server on centos 7? We can help you with it.

Here at Bobcares, we have seen several such CentOS related queries as part of our Server Management Services for web hosts and online service providers.

Today we’ll see how to install phpIPAM on CentOS.

 

Know more about Kamailio

Kamailio is a distribution of SER. It mainly provides a scalable SIP server suitable for small through to carrier-grade installations.

It can handle over 5000 call setups per second. Also, it can serve up to 300,000 active subscribers with just a 4GB Ram System.

Moreover, it functions as a Registrar server, Location server, Proxy server, SIP Application server, and Redirect server.

 

How we install Kamailio sip proxy server on CentOS 7

Now let’s take a look at how our Support Engineers install the Kamailio sip proxy server.

 

Step 1: Setting SELinux to a Permissive/Disabled mode

Here is the command we run to set the SELinux to permissive mode.

$ sudo setenforce 0
$ sudo sed -i ‘s/^SELINUX=.*/SELINUX=permissive/g’ /etc/selinux/configCopy Code

Or else we can also permanently disable it by rebooting the CentOS system.

$ sudo setenforce 0
$ sudo sed -i ‘s/^SELINUX=.*/SELINUX=disabled/g’ /etc/selinux/config
$ sudo rebootCopy Code

After rebooting, we confirm SELinux status:

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

 

Step 2: Install MariaDB Database server

Kamailio requires a database server to function. For this, we will install the MariaDB database server by running the below commands.

$ sudo yum -y install mariadb-server
$ sudo systemctl enable –now mariadb
$ sudo mysql_secure_installationCopy Code

 

Step 3: Add Kamailio RPM Repository

CentOS 8:

$ sudo wget -O /etc/yum.repos.d/kamailio.repo http://download.opensuse.org/repositories/home:/kamailio:/v5.3.x-rpms/CentOS_8/home:kamailio:v5.3.x-rpms.repoCopy Code

Some packages are not on CentOS 8 repository. We have to use Fedora 29 repository on CentOS 8. If the same issue happens to you, change the repository by running the commands below.

$ sudo wget -O /etc/yum.repos.d/kamailio.repo http://download.opensuse.org/repositories/home:/kamailio:/v5.3.x-rpms/Fedora_29/home:kamailio:v5.3.x-rpms.repoCopy Code

CentOS 7:

$ sudo wget -O /etc/yum.repos.d/kamailio.repo http://download.opensuse.org/repositories/home:/kamailio:/v5.3.x-rpms/CentOS_7/home:kamailio:v5.3.x-rpms.repoCopy Code

 

Step 4: Install Kamailio SIP Server on CentOS 8/CentOS 7

Once we add the repository, we install the Kamailio SIP Server on CentOS 8/CentOS 7 Linux.

$ sudo yum install vim kamailio kamailio-presence kamailio-ldap kamailio-mysql kamailio-debuginfo kamailio-xmpp kamailio-unixodbc kamailio-utils kamailio-tls kamailio-outbound kamailio-gzcompressCopy Code

Dependency tree will be shown. In that we enter the ‘Y’ key to begin installation.

Then we confirm Kamailio version.

$ kamailio -version
version: kamailio 5.3.3 (x86_64/linux) c918a3
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: c918a3
compiled on 14:32:52 Mar 16 2020 with gcc 8.2.1Copy Code

 

Step 5: Configuring Kamailio SIP proxy server on CentOS 8/CentOS 7

Now we edit the file /etc/kamailio/kamctlrc and make sure the DBENGINE variable is set to MySQL. Then we remove the pound symbol to uncomment it.

$ sudo vi /etc/kamailio/kamctlrcCopy Code

After that, we set the database engine to MySQL.

DBENGINE=MYSQL
DBHOST=localhost

We run the below command to create users and tables required by Kamailio (Schema).

$ sudo kamdbctl create
MySQL password for root:
INFO: test server charset
INFO: creating database kamailio 
INFO: granting privileges to database kamailio 
INFO: creating standard tables into kamailio 
INFO: Core Kamailio tables succesfully created.
Install presence related tables? (y/n): y
INFO: creating presence tables into kamailio 
INFO: Presence tables succesfully created.
Install tables for imc cpl siptrace domainpolicy carrierroute
drouting userblacklist htable purple uac pipelimit mtree sca mohqueue
rtpproxy rtpengine secfilter? (y/n): y
INFO: creating extra tables into kamailio 
INFO: Extra tables succesfully created.
Install tables for uid_auth_db uid_avp_db uid_domain uid_gflags
uid_uri_db? (y/n): y
INFO: creating uid tables into kamailio 
INFO: UID tables succesfully created.Copy Code

When asked for a root password, we enter the MySQL root user password as configured through mysql_secure_installation

Then we answer all the questions that follow. Next we edit /etc/kamailio/kamailio.cfg to configure Kamailio:

$ sudo vi /etc/kamailio/kamailio.cfgCopy Code

Then we add the following lines just below #!KAMAILIO.

#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
#!define WITH_NAT
#!define WITH_PRESENCE
#!define WITH_ACCDB

After that, we start Kamailio

$ sudo systemctl restart kamailioCopy Code

Then we enable the service to start on boot.

$ sudo systemctl enable kamailioCopy Code

Finally, now we have a running Kamailio SIP server on CentOS.

$ systemctl status kamailio
● kamailio.service - Kamailio (OpenSER) - the Open Source SIP Server
Loaded: loaded (/usr/lib/systemd/system/kamailio.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2020-12-05 16:35:23 EAT; 12s ago
Main PID: 9648 (kamailio)
Tasks: 41 (limit: 24003)
Memory: 50.0M
CGroup: /system.slice/kamailio.service
├─9648 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9649 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9650 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9651 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9652 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9653 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9654 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9655 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9656 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9658 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9659 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
......Copy Code

[Need any further assistance with CentOS queries? – We are here to help you.]

 

Conclusion

In today’s writeup, we saw how our Support Engineers install Kamailio sip proxy on CentOS.

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Speed issues driving customers away?
We’ve got your back!