This article explains how to install Kamailio SIP Server on Ubuntu 24.04.
Kamailio is an open-source SIP (Session Initiation Protocol) server that excels at managing VoIP (Voice over Internet Protocol) communications. It is scalable and flexible, making it a preferred choice for real-time communication applications such as VoIP, messaging, and presence services.
Kamailio integrates seamlessly with various systems like databases and billing, improving its functionality.
Installing Kamailio on Ubuntu offers a stable and reliable platform since Ubuntu is among the most popular distributions for server environments.
Install MariaDB
Kamailio requires a database server to store its content. A great open-source database server to consider is MariaDB.
Run the command below to install it on Ubuntu.
sudo apt update
sudo apt install mariadb-server
After installing MariaDB, continue below.
Add Kamailio repository
Once MariaDB is installed, run the command below to add Kamailio’s repository to Ubuntu.
Kamailio packages are not available in the default repositories of Ubuntu, so you need to add its repository to install them.
But first, 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. At the time of this writing, the latest version is 6.0.
Use the link below to download the latest version if it becomes available.
sudo tee /etc/apt/sources.list.d/kamailio.list<<EOF
deb http://deb.kamailio.org/kamailio60 noble main
deb-src http://deb.kamailio.org/kamailio60 noble main
EOF
After adding its repository key and file, run the command below to install Kamailio and related modules.
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
Now that Kamailio is installed, you can begin configuring it.
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.
Then, run the command below to create a database for Kamailio. The command below will create users and tables needed by Kamailio( Schema).
sudo kamdbctl create
You will be prompted to provide a MySQL root password. If you haven’t set up a root password, leave it blank and 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.
Another user named “kamailioro” with password “kamailioro” will be created. It has read-only access permissions to the Kamailio database.
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:
Installing the Kamailio SIP Server on Ubuntu 24.04 provides a robust solution for managing VoIP communications. Here are the key takeaways:
- 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.
With these steps completed, Kamailio is fully operational, providing a powerful VoIP and related services platform.
Leave a Reply Cancel reply