This guide will help you to install Latest Kamailio SIP Server on CentOS 7 / CentOS 8 Linux server. This is part of Series tutorials on Building an Enterprise VOIP System. Kamailio is a distribution of SER and provides a scalable SIP server suitable for small through to carrier grade installations.

Features of Kamailio

Kamailio’s main advantages for use alongside Media server like Asterisk are:

  • Kamailio can handle over 5000 call setups per second.
  • Can serve up to 300,000 active subscribers with just a 4GB Ram System.
  • Clustering can easily be realized by adding more Kamailio servers

Kamailio can function as:
● Registrar server
● Location server
● Proxy server
● SIP Application server
● Redirect server

Other Features of Kamailio are:

  • NAT traversal support for SIP and RTP traffic
  • Load balancing with many distribution algorithms and
    failover support
  • Provides flexible least cost routing
  • Easy to realize routing failover
  • Support both IPv4 and IPv6
  • SCTP multi-homing and multi-streaming
  • Communication can be over UDP, TCP, TLS, and SCTP
  • Digest SIP User authentication
  • Provides event-based accounting
  • Data storage can be to database, Radius or Diameter
  • Extensible Java, Python, Lua and Perl Programming interface
  • TLS support for SIP signaling and transparent handling of SRTP for secure audio

We have tested this guide on:

  • Kamailio 5.x
  • CentOS 7 / CentOS 8

Install Kamailio SIP Server on CentOS 7 / CentOS 8

Before we dive deep into the installation process, let’s get some heads up on basics about Kamailio SIP Server.

Step 1: Set SELinux to a Permissive/Disabled mode

If you’re not SELinux lover, I recommend you put it in Permissive mode:

sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config

If you decide to permanently disable it, you’ll need to reboot your  CentOS system:

sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
sudo reboot

After rebooting, 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: 31

Step 2: Install MariaDB Database server

Kamailio requires a database server to function. For this, we’ll use the MariaDB database server which can be installed on CentOS 7 / CentOS 8:

sudo yum -y install mariadb-server
sudo systemctl enable --now mariadb
sudo mysql_secure_installation

Step 3: Add Kamailio RPM Repository

CentOS 8:

sudo wget -O /etc/yum.repos.d/kamailio.repo

As of this article update, some packages are not on CentOS 8 repository. I had 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

CentOS 7:

sudo wget -O /etc/yum.repos.d/kamailio.repo

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

Once the repository is added, install 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-gzcompress

Dependency tree should be shown nd you can hit th y key in your keyboard to begin installation.

Dependencies resolved.
 Package                           Arch                Version                                             Repository                              Size
 kamailio                          x86_64              5.3.3-4.1                                           home_kamailio_v5.3.x-rpms              5.6 M
 kamailio-debuginfo                x86_64              5.3.3-4.1                                           home_kamailio_v5.3.x-rpms              3.8 M
 kamailio-gzcompress               x86_64              5.3.3-4.1                                           home_kamailio_v5.3.x-rpms               19 k
 kamailio-ldap                     x86_64              5.3.3-4.1                                           home_kamailio_v5.3.x-rpms               99 k
 kamailio-mysql                    x86_64              5.3.3-4.1                                           home_kamailio_v5.3.x-rpms               74 k
 kamailio-outbound                 x86_64              5.3.3-4.1                                           home_kamailio_v5.3.x-rpms               24 k
 kamailio-presence                 x86_64              5.3.3-4.1                                           home_kamailio_v5.3.x-rpms              673 k
 kamailio-tls                      x86_64              5.3.3-4.1                                           home_kamailio_v5.3.x-rpms              187 k
 kamailio-unixodbc                 x86_64              5.3.3-4.1                                           home_kamailio_v5.3.x-rpms               39 k
 kamailio-utils                    x86_64              5.3.3-4.1                                           home_kamailio_v5.3.x-rpms               37 k
 kamailio-xmpp                     x86_64              5.3.3-4.1                                           home_kamailio_v5.3.x-rpms               53 k
 vim-common                        x86_64              2:8.0.1763-13.el8                                   AppStream                              6.3 M
 vim-enhanced                      x86_64              2:8.0.1763-13.el8                                   AppStream                              1.4 M
Installing dependencies:
 mysql-common                      x86_64              8.0.17-3.module_el8.0.0+181+899d6349                AppStream                              143 k
 mysql-libs                        x86_64              8.0.17-3.module_el8.0.0+181+899d6349                AppStream                              1.2 M
 unixODBC                          x86_64              2.3.7-1.el8                                         AppStream                              458 k
Installing weak dependencies:
 kamailio-debugsource              x86_64              5.3.3-4.1                                           home_kamailio_v5.3.x-rpms              3.7 M
Enabling module streams:
 mysql                                                 8.0                                                                                             

Transaction Summary
Install  15 Packages
Upgrade   2 Packages

Total download size: 24 M
Is this ok [y/N]: y

Confirm installed Kamailio version:

$ kamailio -version
version: kamailio 5.3.3 (x86_64/linux) c918a3
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.1

Step 5: Configuring Kamailio on CentOS 8 / CentOS 7

Edit the file /etc/kamailio/kamctlrc  and make sure the DBENGINE variable is set to MySQL. Remove the pound symbol to uncomment it.

sudo vi /etc/kamailio/kamctlrc

Set Database engine to MYSQL

kamailio 5 database engine

Run the command below to create users and tables needed 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.

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

Answer Yes to all the questions that follow. The kamdbctl create command will add two Mysql users:

kamailio: With the password.kamailiorw It has read/write access permissions to the Kamailio database.

kamailioro: The password for this user is kamailioro. It has read-only access permissions to the Kamailio database.

Next is to edit /etc/kamailio/kamailio.cfg to configure Kamailio:

sudo vi /etc/kamailio/kamailio.cfg

Add the following lines just below #!KAMAILIO.

#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_NAT
#!define WITH_ACCDB
kamailio configuration

Start Kamailio

sudo systemctl restart kamailio

Enable the service to start on boot:

sudo systemctl enable kamailio

That’s the end. You should now have a running Kamailio SIP server on your CentOS 8 / CentOS 7 Linux.

$ 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 Sun 2020-05-03 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/ -f /etc/kamailio/kamailio.cfg -m 64 -M 4
           ├─9649 /usr/sbin/kamailio -DD -P /var/run/kamailio/ -f /etc/kamailio/kamailio.cfg -m 64 -M 4
           ├─9650 /usr/sbin/kamailio -DD -P /var/run/kamailio/ -f /etc/kamailio/kamailio.cfg -m 64 -M 4
           ├─9651 /usr/sbin/kamailio -DD -P /var/run/kamailio/ -f /etc/kamailio/kamailio.cfg -m 64 -M 4
           ├─9652 /usr/sbin/kamailio -DD -P /var/run/kamailio/ -f /etc/kamailio/kamailio.cfg -m 64 -M 4
           ├─9653 /usr/sbin/kamailio -DD -P /var/run/kamailio/ -f /etc/kamailio/kamailio.cfg -m 64 -M 4
           ├─9654 /usr/sbin/kamailio -DD -P /var/run/kamailio/ -f /etc/kamailio/kamailio.cfg -m 64 -M 4
           ├─9655 /usr/sbin/kamailio -DD -P /var/run/kamailio/ -f /etc/kamailio/kamailio.cfg -m 64 -M 4
           ├─9656 /usr/sbin/kamailio -DD -P /var/run/kamailio/ -f /etc/kamailio/kamailio.cfg -m 64 -M 4
           ├─9658 /usr/sbin/kamailio -DD -P /var/run/kamailio/ -f /etc/kamailio/kamailio.cfg -m 64 -M 4
           ├─9659 /usr/sbin/kamailio -DD -P /var/run/kamailio/ -f /etc/kamailio/kamailio.cfg -m 64 -M 4

Other guides:

Install Asterisk PBX on CentOS 8

Install Asterisk PBX on CentOS 7

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


  1. You need to install kamailio-presence with yum otherwise it will show errors of presence module while starting kamailio

  2. Hi. Very good tutorial. I’m looking forward the next tutorial, about Kamailio and asterisk integration. You will cover IVR and queues also? When you’ll publish it?

  3. Shows this error:

    WARNING: rtpproxy [rtpproxy.c:1405]: rtpp_test(): support for RTP proxy has been disabled temporarily
    ERROR: rtpproxy [rtpproxy.c:1476]: send_rtpp_command(): can’t send command to a RTP proxy
    ERROR: rtpproxy [rtpproxy.c:1511]: send_rtpp_command(): proxy does not respond, disable it


Please enter your comment!
Please enter your name here