Žilinská univerzita > Fakulta riadenia a informatiky > Katedra informačných sietí

Installing Kamailio from GIT - debian lenny

In some situation is direct installation of precompiled kamailio packages from prepared repositories not appropriate. There is a simple way to keep a touch with latest kamailio releases with using GIT (an revision control system).  The article describe a simple way how to manually compile and install Kamamilio and its module from source code offered through GIT.

Install kamailio from GIT



To fullfill all tasks, we will need following packages, so we will install them:

apt-get install git-core gcc flex bison libmysqlclient-dev make libssl-dev libcurl4-openssl-dev libxml2-dev libpcre3-dev

In a case of some missing dependencies install also other required packages.


Then we make a folder where we will download kamailio source files

mkdir -p /usr/local/src/kamailio-3.2
cd /usr/local/src/kamailio-3.2

then download main files

git clone --depth 1 git://git.sip-router.org/sip-router kamailio
Cloning into kamailio...
remote: Counting objects: 24459, done.

remote: Compressing objects: 100% (13723/13723), done.
Receiving objects: 100% (24459/24459), 16.83 MiB | 7.18 MiB/s, done.
remote: Total 24459 (delta 17363), reused 15407 (delta 10395)
Resolving deltas: 100% (17363/17363), done.
cd kamailio git checkout -b 3.2 origin/3.2 Branch 3.2 set up to track remote branch 3.2 from origin.
Switched to a new branch '3.2'

Setting makefiles

Since the version 3.0.0, Kamailio and SER are built from same source code, so the most important and first step is to set build flavour to kamailio.

root@homer:/usr/local/src/kamailio-3.2/kamailio# make FLAVOUR=kamailio cfg
target architecture <x86_64>, host architecture <x86_64>
making config...
rm -f modules.lst
make --no-print-directory modules.lst
saving modules list...

If you forget to set the flavour to kamailio, the default build is SER.

Next step is to enable required modules for compilation, for example here mysql and sipcapture:

root@homer:/usr/local/src/kamailio-3.2/kamailio# make modules-cfg include_modules="db_mysql sipcapture"
rm -f modules.lst
make --no-print-directory modules.lst
saving modules list...

or alternatively we may manually edit module.lst file and mark/unmark/edit required lines:

vim module.lst

or manually edit debian compilation rules at:

vim pkg/kamailio/deb/debian/rules

Compilation and installation

We start the compilation and after installation with following commands:

make all
make install

Attention, the binaries and executable scripts were installed in:


modules in:


man pages in:


and config files are located in


To be able to use the binaries from command line, make sure that '/usr/local/sbin' is set in PATH environment variable. You can check that with 'echo $PATH'. If not and you are using 'bash', open '/root/.bash_profile' and at the end add:

  export PATH

More info at: http://www.kamailio.org/wiki/install/3.2.x/git

Prepare init.d script and /etc/default/kamailio script

Be able to use usual /etc/init.d/kamailio start | stop syntax we have to prepad init scripts. So for debian just copy init.d script

cp /usr/local/src/kamailio-3.2/kamailio/pkg/kamailio/deb/debian/kamailio.init /etc/init.d/kamailio

and set chmod

chmod 755 /etc/init.d/kamailio

Then open the file

vim /etc/init.d/kamailio

and edit DAEMON value to point out on correct place, so change default DAEMON=/usr/sbin/kamailio change to


plus change CFGFILE value to point out to correct kamailio.cfg file


Finally copy default config file:

cp /usr/local/src/kamailio-3.2/kamailio/pkg/kamailio/deb/debian/kamailio.default /etc/default/kamailio

edit them and change RUN_KAMAILIO=no to yes.


Future maintenance

The future maintenance process is very simple:

cd /usr/local/src/kamailio-3.2/kamailio
git pull origin
make all
make install
/etc/init.d/kamailio restart