Say goodbye to clunky, unreliable communication systems and hello to crystal-clear calls with Kamailio SIP server! If you’re ready to take your VoIP to the next level, read on to discover how you can easily install Kamailio from GitHub.
Advantages:
Installing Kamailio from source code has following advantages:
1) OS independent process, we can install on any Linux distro, MacOS and even on Windows (Using WSL2) .
2) We can install any version of Kamailio.
Preparation:
Before we begin, we need to install some dependencies that Kamailio requires. Run the following command to install them. I am using Ubuntu OS but these commands should work with most linux distros:
sudo apt-get update
sudo apt-get install -y git gcc g++ flex bison default-mysql-server libmysqlclient-dev make autoconf pkg-config unzip
if you want to enable more modules, some of them require extra libraries:
TLS: apt-get install libssl-dev
Curl: apt-get install libcurl4-openssl-dev
XML: apt-get install libxml2-dev
Regex: apt-get install libpcre3-dev
Next, we’ll download the Kamailio raw code from Github by running the following command:
curl -L --max-redirs 3 -o 5.3.8.zip https://github.com/kamailio/kamailio/archive/a5815595511d298a9948027fb0d9410a2fd65e66.zip
The above command will download kamailio 5.3.8 version. The important parameter in the above command is the name of the zip file that we are downloading. The name is actually the Secure Hash Algorithms (SHA) of the last commit for the version that we want to download.
To find the SHA value go to https://github.com/kamailio/kamailio, then click on the commits and click the copy button to copy the SHA. Check the screenshot below for more details.

Next, unzip the downloaded zip file 5.3.8.zip using the below command then change the directory to the one that was just created:
unzip 5.3.8.zip
cd kamailio-a5815595511d298a9948027fb0d9410a2fd65e66
Installation:
Now we’ll run the make commands to build and install Kamailio from source. This may take some time depending on the speed of your server:
make include_modules="db_mysql tls" cfg
make all
make install
The following binaries and scripts get installed in /usr/local/sbin directory.
kamailio - Kamailio SIP server
kamdbctl - script to create and manage database
kamctl - script to manage and control Kamailio
kamcmd - CLI tool to interface with Kamailio
The kamailio configuration and kamctlrc files are installed in /usr/local/etc/kamailio/kamailio.cfg.
Configure Kamailio Database:
Now the fun part begins. Edit the following parameters in kamctlrc file.
SIP_DOMAIN=<Kamailio_server_ip>
DBENGINE=MYSQL
DBRWPW="kamailiorw"
Next run the below command to create the database used by Kamailio:NOTE: Use character set latin1 if asked during database creation. If asked for root password of MySQL server, just press ENTER if none was set during installation of MySQL server.
/usr/local/sbin/kamdbctl create
The above script will create kamailio database with two users.
| Username | Default Password | Privilege |
| kamailio | kamailiorw | full access rights |
| kamailioro | kamailioro | read only access |
Next adding the following lines to kamailio.cfg to enable the database integration:
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
To start and stop kamailio we need to setup systemd unit file or the init.d script. If your system supports init.d script then run the following command in kamailio source code directory:
make install-initd-debian
Then you can start/stop Kamailio using the following commands:
/etc/init.d/kamailio start
/etc/init.d/kamailio stop
Alternately to install the systemd unit, run in Kamailio source code directory:
make install-systemd-debian
Then you can start/stop Kamailio using the following commands:
systemctl start kamailio
systemctl stop kamailio
Testing:
We are all set to make test calls!. Lets configure two users by running the following commands:
kamctl add user01 passwd01
kamctl add user02 passwd02
We can now use the username and password configured in the above commands to make test calls. You can use softphones like Jitsi desktop or Zoiper to make test calls.
Conclusion:
In conclusion, Kamailio is a powerful open-source SIP server that can be used to handle and route SIP calls. By following the steps outlined in this blog post, you can install Kamailio from source using GIT on an Ubuntu server and start handling SIP calls.
Reference: https://kamailio.org/docs/tutorials/5.6.x/kamailio-install-guide-git/
Akash Gupta
Senior VoIP Engineer and AI Enthusiast

AI and VoIP Blog
Thank you for visiting the Blog. Hit the subscribe button to receive the next post right in your inbox. If you find this article helpful don’t forget to share your feedback in the comments and hit the like button. This will helps in knowing what topics resonate with you, allowing me to create more that keeps you informed.
Thank you for reading, and stay tuned for more insights and guides!

Leave a comment