Install Kamailio SIP Server on Ubuntu 24.04
Kamailio is a free program that routes phone calls and messages over the internet on Ubuntu 24.04. It works as a digital switchboard for voice chats and instant messages.
You need a computer running Ubuntu 24.04 LTS to set up this system. The software handles internet calls by using standard SIP rules to connect people.
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 serves as a suitable open-source option on Ubuntu 24.04. Run the following command to install MariaDB: `sudo apt install mariadb-server`.
sudo apt update
sudo apt install mariadb-server
MariaDB installation paves the way for adding the Kamailio repository.
Add Kamailio repository
Ubuntu does not include Kamailio in its standard software lists. Adding a dedicated repository provides access to the necessary packages.
Kamailio packages remain absent from default software repositories, requiring the addition of external sources. Fetching the GPG key (cryptographic signature verifying software authenticity) ensures package integrity before downloading .
Acquiring the repository GPG key happens first.
wget -O- http://deb.kamailio.org/kamailiodebkey.gpg | sudo apt-key add -
Next, integrate the repository designated for Ubuntu 24.04. Version 6.0 represents the current release.
Future updates reside at the official repository located at https://deb.kamailio.org for deployment on Ubuntu 24.04.
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 access to the latest software version.
sudo apt update
sudo apt install kamailio kamailio-mysql-modules kamailio-websocket-modules kamailio-tls-modules
Following installation, test application availability by executing the command [kamailio -V].
kamailio -V
The Kamailio binary file resides by default at [/usr/sbin/kamailio].
Configure Kamailio
Configuring the database connection follows the installation phase. Modifying the kamctlrc file dictates which database backend Kamailio utilizes. Setting the DBENGINE parameter to MySQL and activating that line establishes the database link.
Database connectivity configuration requires editing the file [/etc/kamailio/kamctlrc]. Ensure the [DBENGINE] variable points to MySQL by uncommenting the relevant line.
sudo nano /etc/kamailio/kamctlrc
Modify the highlighted line accordingly.
## 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 changes and close the editor.
Executing this command generates a PostgreSQL database tailored for Kamailio. This schema contains mandatory tables and user accounts required for managing routing data and user profiles.
sudo kamdbctl create
MySQL root password authentication is required during the prompt. Pressing Enter bypasses this prompt if no password exists yet.
Input the highlighted value to satisfy 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" is provisioned with the password "kamailiorw." This account maintains read and write privileges for the Kamailio database.
The `kamailioro` user, paired with the password `kamailioro`, provides secondary database access. Restricted to read-only permissions, this account views database records while preventing unauthorized modifications, safeguarding data integrity.
Proceed by editing the [/etc/kamailio/kamailio.cfg] file.
sudo nano /etc/kamailio/kamailio.cfg
Insert the highlighted lines directly underneath #!KAMAILIO.
#!KAMAILIO
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
#!define WITH_ACCDB
#
Save and exit the file.
Restarting Kamailio applies all preceding modifications.
sudo systemctl restart kamailio
Executing the command below confirms active service status.
systemctl status kamailio
Successful execution outputs results resembling the following example.
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 fully operational.
Configuration is complete.
Conclusion:
Kamailio SIP Server is now fully installed and ready to manage VoIP (Voice over IP) communications on Ubuntu 24.04. Reviewing the core implementation steps:
- 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 operates at full capacity following these procedures, establishing a scalable platform for Voice over IP (VoIP) routing 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!