← Back to list

How to Install Kamailio SIP Server on Ubuntu (Step-by-Step Guide)

Introduction

himanshu · 2025-08-31 09:08 · 0 claps · 1.7 min read
#kamailio #linux #telephony #voip #sip
Open on Medium ↗
Wiki topics: 🔓 · Open Source

How to Install Kamailio SIP Server on Ubuntu (Step-by-Step Guide)

Introduction

Kamailio is a powerful open-source SIP server used for VoIP signaling, SIP routing, and high-performance real-time communications. It can handle thousands of simultaneous calls and acts as a proxy, registrar, or load balancer for SIP networks.

In this guide, you’ll learn how to install Kamailio on Ubuntu and configure it for basic use.

📌 Why Kamailio?

  • Scalability: Handles millions of SIP requests per second.
  • Flexibility: Acts as SIP proxy, registrar, or redirect server.
  • Extensible: Supports modules for presence, security, and NAT traversal.

✅ Prerequisites

  • Ubuntu 20.04 or later
  • Root or sudo access
  • Basic understanding of SIP

Step 1: Update the System

Update your package index:

sudo apt update && sudo apt upgrade -y

Step 2: Install Dependencies

Install essential packages for building and running Kamailio:

sudo apt install -y build-essential pkg-config libssl-dev libxml2-dev libcurl4-openssl-dev libpcre3-dev \
    libunistring-dev bison flex git make gcc g++ systemd

Step 3: Add Kamailio Official Repository

Kamailio provides its own repository for easier installation:

sudo apt install -y gnupg2 wget lsb-release
wget -O- https://deb.kamailio.org/kamailiodebkey.gpg | sudo apt-key add -
echo "deb http://deb.kamailio.org/kamailio$(lsb_release -rs) main" | sudo tee /etc/apt/sources.list.d/kamailio.list
echo "deb-src http://deb.kamailio.org/kamailio$(lsb_release -rs) main" | sudo tee -a /etc/apt/sources.list.d/kamailio.list

Update package lists:

sudo apt update

Step 4: Install Kamailio and Modules

Install Kamailio core and commonly used modules:

sudo apt install -y kamailio kamailio-extra-modules kamailio-mysql-modules kamailio-utils-modules kamailio-presence-modules kamailio-tls-modules

Step 5: Configure Kamailio

Edit the main configuration file:

sudo nano /etc/kamailio/kamailio.cfg

Basic checks:

  • Set listen parameter for your IP:
listen=udp:YOUR_SERVER_IP:5060
  • Ensure SIP domain is configured in:
#!define WITH_MYSQL

if using database integration.

Step 6: Enable and Start Kamailio Service

Enable Kamailio to start on boot:

sudo systemctl enable kamailio

Start the service:

sudo systemctl start kamailio

Check status:

sudo systemctl status kamailio

Step 7: Verify Installation

Check Kamailio version:

kamailio -V

Tail logs:

journalctl -u kamailio -f

✅ Kamailio is Installed!

Your SIP server is now running on port 5060 (UDP). You can use a SIP client like Zoiper, Linphone, or integrate Kamailio with FreeSWITCH or Asterisk.

Optional: Configure Database Support

Kamailio can store users, domains, and routing info in a database like MySQL or PostgreSQL.

Install PostgreSQL and Follow the Steps

  • List all the required installation for kamailio
sudo apt search kamailio
sudo apt install kamailio-postgres-modules
  • Edit kamailio.cfg and write
#!define WITH_POSTGRES
loadmodule "db_postgres.so"
#!define DBURL "postgres://username:password@localhost:5432/dbname"
  • To create the database structure needed by Kamailio, run:
export PGPASSWORD='postgres_password' && kamdbctl create

Adding Subscribers To add subscribers (users), you can use the kamctl command:

kamctl add userid password

메타데이터
post_id
b093c888d30d
slug
how-to-install-kamailio-sip-server-on-ubuntu-step-by-step-guide-b093c888d30d
url
https://medium.com/@himanshugkp13/how-to-install-kamailio-sip-server-on-ubuntu-step-by-step-guide-b093c888d30d
canonical_url
https://medium.com/@himanshugkp13/how-to-install-kamailio-sip-server-on-ubuntu-step-by-step-guide-b093c888d30d
author_url
https://medium.com/@himanshugkp13
status
ok
fetched_at
2026-08-10 14:58:03