Install Kamailio SIP Server on Ubuntu 24.04
Kamailio SIP Server on Ubuntu 24.04 provides a powerful way to manage your internet-based calls and messages.
Kamailio is a free, open-source program that acts like the traffic controller for real-time communications. It understands and manages Session Initiation Protocol (SIP), the language used for setting up and managing voice and video calls over the internet.
This server efficiently routes calls, keeps track of who is logged in, and keeps your communication secure. You can use it for things like VoIP phone systems, instant messaging, and checking if someone is available.
This guide shows you the precise steps to install Kamailio on your Ubuntu 24.04 LTS system.
Install Kamailio by first installing MariaDB with `sudo apt install mariadb-server`. Then, add the Kamailio repository and install Kamailio itself with `sudo apt install kamailio kamailio-mysql-modules`. Finally, configure the database connection in `/etc/kamailio/kamctlrc` and create the database schema with `sudo kamdbctl create`.
Install MariaDB
MariaDB must be installed first, as Kamailio requires this database server to store its content. MariaDB version 10.11 is a suitable open-source option for Kamailio on Ubuntu 24.04. Run the following command to install MariaDB: `sudo apt install mariadb-server`.
sudo apt update
sudo apt install mariadb-server
Once MariaDB is installed, we’ll move on to adding the Kamailio repository.
Add Kamailio repository
The Kamailio SIP Server installation on Ubuntu 24.04 requires adding a special software source because Kamailio packages aren’t in Ubuntu’s standard list. Before adding this source, you should get the Kamailio GPG key. This GPG key verifies that the Kamailio packages you download are official and safe to use.
Kamailio packages aren’t included in Ubuntu’s default software repositories, so you’ll need to add Kamailio’s own software source before you can install it. This ensures you can get the latest version, which is currently 5.3.7.
First, though, add the repository GPG key.
wget -O- http://deb.kamailio.org/kamailiodebkey.gpg | sudo apt-key add -
Then, add the repository for Ubuntu 24.04. Right now, the latest version is 6.0.
If Kamailio releases a newer version, you can find the update at the official repository located at https://deb.kamailio.org for installation on your Ubuntu 24.04 system.
After adding the Kamailio repository key and file, run the `sudo apt update && sudo apt install kamailio` command to install Kamailio and its related modules, ensuring you have the latest software version.
sudo apt update
sudo apt install kamailio kamailio-mysql-modules kamailio-websocket-modules kamailio-tls-modules
After the installation, check if the Kamailio application is available by running the command [kamailio -V].
kamailio -V
The Kamailio bin file is installed by default at [/usr/sbin/kamailio].
Configure Kamailio
After Kamailio installation on your Ubuntu system, you will configure Kamailio’s database connection. Edit the kamctlrc file to specify the database Kamailio uses. Set the DBENGINE parameter to MySQL and uncomment the line for this setting to activate the MySQL database connection.
First, make sure the database connection is created. Edit the file [/etc/kamailio/kamctlrc] and make sure the [DBENGINE] variable is set to MySQL. Uncomment the line to turn it on.
sudo nano /etc/kamailio/kamctlrc
Change the highlighted line.
## 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 the file and exit.
This command creates a PostgreSQL database specifically for Kamailio. This database includes the necessary users and tables to support Kamailio’s schema, which is essential for storing call routing information and user data.
sudo kamdbctl create
You’ll be prompted for your MySQL root password. If you haven’t set one up yet, just press Enter.
Use the highlighted value to complete the prompts.
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.
A MySQL user named “kamailio” will be created with the password “kamailiorw.” This user has read and write permission to access the Kamailio database.
The `kamailioro` user, with the password `kamailioro`, is created for database access. This user has read-only permissions, meaning it can view data in the Kamailio database but cannot make any changes, ensuring data integrity.
Next, edit the [/etc/kamailio/kamailio.cfg] file.
sudo nano /etc/kamailio/kamailio.cfg
Add the highlighted lines just below #!KAMAILIO.
#!KAMAILIO
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
#!define WITH_ACCDB
#
Save and exit.
After making all the changes above, restart Kamailio.
sudo systemctl restart kamailio
To check and verify if Kamailio is running, run the command below.
systemctl status kamailio
The command should output lines similar to the one below.
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 ready to use.
That should do it!
Conclusion:
You’ve successfully installed Kamailio SIP Server on Ubuntu 24.04, setting up a robust solution for managing VoIP communications. Let’s recap the main points:
- 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 kamctlrc and modifying kamailio.cfg the required modules.
- Service Management: After installation, Kamailio can be managed using systemd, ensuring it runs consistently in the background.
Kamailio installation is fully operational after completing these steps, providing a powerful platform for Voice over IP (VoIP) and related services, supporting up to 500,000 concurrent connections.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.
Do you have a tutorial to install RTPProxy with kamailio?
Sorry, I haven’t written a tutorial on that topic. I may do it in the future.
I spent about a week using other guides but to no avail, this has helped massively! Thanks Richard!