Skip to content
Follow
Ubuntu Linux

Install Kamailio SIP Server on Ubuntu 24.04

Richard
Written by
Richard
Mar 20, 2025 Updated Oct 11, 2026 8 min read
Install Kamailio SIP Server on Ubuntu 24.04
Install Kamailio SIP Server on Ubuntu 24.04

Kamailio is a free, open-source SIP server. It acts as a switchboard for internet phone calls, voice chats and instant messages: it takes SIP requests from clients and routes them to the right destination. SIP (Session Initiation Protocol) is the standard set of rules for setting up online voice and video sessions. Kamailio uses it to link callers together over a network.

Advertisement

This tutorial installs Kamailio on a server running Ubuntu 24.04 LTS. You need a user with sudo rights and a working internet connection. A fresh server is best, because the setup changes the database and the Kamailio configuration files.

⚡ Quick Answer

To install Kamailio SIP Server on Ubuntu 24.04, first run sudo apt install mariadb-server to set up the database Kamailio uses. Next, download the Kamailio project’s GPG key, add its repository for Ubuntu 24.04, then run sudo apt update && sudo apt install kamailio. Check the install by running kamailio -V.

Advertisement

Install MariaDB

Kamailio keeps its user accounts and routing data in a database, so install the database server first. MariaDB is a MySQL-compatible database, and Kamailio’s MySQL settings work with it. Follow these steps:

  1. Open a terminal on your Ubuntu 24.04 server.
  2. Run the command sudo apt install mariadb-server.
  3. If apt asks for confirmation, type Y and press Enter.
  4. Wait for apt to return to the prompt without errors. This means the package installed.
📝Good to KnowThe MariaDB service normally starts on its own after installation, and no restart is needed.

This must be done before the main Kamailio installation steps.

🐧Bash / Shell
sudo apt update
sudo apt install mariadb-server

With MariaDB installed, Kamailio has somewhere to store its data. The command shown here is the same one from the previous step. If you already ran it successfully, you do not need to run it again.

Add Kamailio repository

Next, add the Kamailio project’s own software repository. Ubuntu’s default software lists may not carry the Kamailio version you want. If they do carry it, it is usually older than the project’s current release. Adding the project repository gives apt access to up-to-date packages.

Advertisement

Before adding the repository, download the project's official GPG key. A GPG key is a cryptographic signature. It lets your system check that the packages really come from the Kamailio project and were not altered on the way, so apt can install them without signature errors.

Packages from the project repository stay separate from the default Ubuntu sources, so the repository has to be added by hand. Download the GPG key first, as shown in the commands below. Once the key is in place, apt trusts the new source.

Do this step first:

  1. Run the key download command shown below.
  2. Check that the command finishes without an error. If it fails with a network or name resolution error, confirm the server can reach the internet and try again.
💻Code
wget -O- http://deb.kamailio.org/kamailiodebkey.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/kamailio.gpg

Now add the repository built for Ubuntu 24.04. Version 6.0 is the current release at the time of writing. Create the repository entry as shown below, and make sure the Ubuntu version and the Kamailio version both match your system and your target release.

Advertisement

Future updates come from the official repository at https://deb.kamailio.org, which serves packages for Ubuntu 24.04. Once the entry is added, apt will pull Kamailio updates from there along with your normal system updates. To undo this, delete the repository entry file you created and run apt update again.

With the repository key and repository file in place, install Kamailio:

  1. Run the command sudo apt update && sudo apt install kamailio.
  2. Confirm the installation with Y if apt asks.
  3. Wait for apt to finish. You should see Kamailio and its related modules being unpacked and set up, and then the prompt returns.

The apt update part refreshes the package lists so apt sees the new repository. This makes sure you get the latest Kamailio version it offers.

Advertisement
🐧Bash / Shell
sudo apt update
sudo apt install kamailio kamailio-mysql-modules kamailio-websocket-modules kamailio-tls-modules

After installation, check that the application is available:

  1. Run the command kamailio -V.
  2. Look at the output. It should show Kamailio's version and build information.

If the shell says the command is not found, the install did not complete. Go back and check the output of the install step for errors.

💻Code
kamailio -V

By default, the Kamailio binary file is installed at /usr/sbin/kamailio. Use this path if you need to run the binary directly or point a script at it.

Configure Kamailio

Kamailio has to be told which database to use. That is set in the control tool's configuration file at /etc/kamailio/kamctlrc. The file belongs to root, so open it in a text editor with sudo. Then find the DBENGINE setting and point it to MySQL. That way Kamailio knows which database backend to use for user data and routing rules.

Advertisement

Database connectivity is configured in /etc/kamailio/kamctlrc. Edit it like this:

  1. Open /etc/kamailio/kamctlrc in a text editor with root privileges.
  2. Find the DBENGINE variable. It is usually commented out with a # at the start of the line.
  3. Remove the # to uncomment the line, and make sure the value points to MySQL.

MariaDB uses the MySQL setting, so there is no separate MariaDB value to choose.

🐧Bash / Shell
sudo nano /etc/kamailio/kamctlrc

Change the highlighted line in the file so it matches the screenshot. Only the highlighted line needs to change. Leave the other commented lines as they are.

💻Code
## the SIP domain
SIP_DOMAIN=srv1.example.com

## chrooted directory
# CHROOT_DIR="/path/to/chrooted/directory"

## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE
## by default none is loaded
##
## If you want to setup a database with kamdbctl, you must at least specify
## this parameter.
DBENGINE=MYSQL

## database host
DBHOST=localhost

Save your changes and close the editor. The change takes effect the next time you run a Kamailio control command, and no restart is needed yet.

Advertisement

The next command creates the Kamailio database in MariaDB. This schema contains the tables Kamailio needs to manage routing data and user profiles. It also creates the database user accounts. Note that this is a MySQL/MariaDB database, matching the setting you just made, and not PostgreSQL.

🐧Bash / Shell
sudo kamdbctl create

During the process, the tool asks for the MySQL root password. On a fresh MariaDB install no root password has been set yet, so just press Enter to skip the prompt. If you have set a root password, type it instead.

The tool also asks a few yes/no questions, such as whether to create extra tables. Enter the highlighted values from the screenshot to answer the prompts. When it finishes, you should see a message that the database was created, with no error lines.

💻Code
Enter character set name: 
latin1
INFO: creating database kamailio ...
INFO: granting privileges to database kamailio ...
INFO: creating standard tables into kamailio ...
INFO: Core Kamailio tables successfully created.
Create the presence related tables? (y/n): y
INFO: creating presence tables into kamailio ...
INFO: Presence tables successfully created.
Create the tables for imc cpl siptrace domainpolicy carrierroute drouting userblocklist htable purple uac pipelimit mtree sca mohqueue rtpproxy rtpengine secfilter ims_icscf? (y/n): y
INFO: creating extra tables into kamailio ...
INFO: Extra tables successfully created.
Create the 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 successfully created.

The process creates a MySQL user named "kamailio" with the password "kamailiorw." This account has read and write privileges on the Kamailio database. Kamailio uses it to store and update data.

Advertisement

A second user, `kamailioro`, uses the password `kamailioro`. This account has read-only permissions. It can view records but cannot change them, which protects the data from accidental or unauthorized edits.

⚠️WarningThese are well-known default passwords.

For anything other than a test server, change them to your own passwords. If you do, remember to update the password wherever Kamailio is configured to use it.

Next, edit the main Kamailio configuration file, /etc/kamailio/kamailio.cfg. It also belongs to root, so open it in a text editor with sudo. Make a backup copy of the file first so you can roll back if something goes wrong.

🐧Bash / Shell
sudo nano /etc/kamailio/kamailio.cfg
  1. Find the line #!KAMAILIO near the top of the file. This is a marker for Kamailio and not an ordinary comment, so leave it as it is.
  2. Insert the highlighted lines directly underneath it.
  3. Check that you typed them exactly as shown. A typo here is the most common reason Kamailio fails to start later.
💻Code
#!KAMAILIO
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
#!define WITH_ACCDB
#

Save the file and exit the editor.

Kamailio reads its configuration only when it starts. Restart the service as shown below to apply all the changes made so far. If the restart reports an error, re-open the configuration file and look for a typo in the lines you added.

🐧Bash / Shell
sudo systemctl restart kamailio

Run the command below to confirm that the service is active. If the output is long, press q to return to the prompt.

💻Code
systemctl status kamailio

If everything worked, the output looks like the example below. Look for a status of active (running). If you see failed instead, read the log lines at the bottom of the output. They usually name the line in the configuration file that caused the problem.

💻Code
 Loaded: loaded (/usr/lib/systemd/system/kamailio.service; enabled; preset: enabled)
Active: active (running) since Thu 2025-03-20 10:40:23 CDT; 38s ago
Process: 6194 ExecStart=/usr/sbin/kamailio -P /run/kamailio/kamailio.pid -f $CFGFILE >
Main PID: 6196 (kamailio)
Tasks: 33 (limit: 4551)
Memory: 23.8M (peak: 24.1M)
CPU: 113ms
CGroup: /system.slice/kamailio.service

Kamailio is installed and running.

The configuration is complete.

Conclusion:

Kamailio SIP Server is now installed and ready to manage VoIP (Voice over IP) communications on Ubuntu 24.04. Here are the core steps again:

  • Open-Source Flexibility: Kamailio is a highly scalable and flexible SIP server suitable for real-time communication applications.
  • Database Integration: The installation requires configuring MariaDB as a database server to store Kamailio's data.
  • Repository Addition: Adding the Kamailio repository and its GPG key is essential to install the latest packages.
  • Configuration Steps: Configuration includes setting up the database connection in kamctlrc and adding the required lines to kamailio.cfg.
  • Service Management: After installation, Kamailio can be managed using systemd, which keeps it running in the background and lets you start, stop and restart it.

Following these steps gives you a scalable base for VoIP routing. Kamailio is often cited as handling up to 500,000 concurrent connections. The real figure depends on your hardware and configuration. Before using the server in production, change the default database passwords and test with a few SIP clients.

Have a question about this guide?

Answered by AI from this guide. Good questions may be added to this page — please don't include personal details.

Did this guide fix your problem?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

3 Comments

  • Do you have a tutorial to install RTPProxy with kamailio?

    Reply
  • I spent about a week using other guides but to no avail, this has helped massively! Thanks Richard!

    Reply

Leave a Comment

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