$Id$ =========================================== Kamailio Installation Notes http://www.kamailio.org/ =========================================== This memo gives you hints how to set up KAMAILIO quickly. To understand how KAMAILIO works and how to configure it properly, read the admin's guide available from KAMAILIO website. Additional information and tutorials can be found on our wiki. If you've any problems, just contact us at the user list. Users of previous releases are encouraged to read in the wiki about the major changes to learn how to move to this new KAMAILIO version. They also might be interested in reading the migration notes from OpenSER to Kamailio after the project renaming. Table of contents 1. Supported Architectures and Requirements 2. Howto Build Kamailio From Source Distribution A) Basic building B) Advanced building C) Additional make targets D) Install the build 3. Quick-Start Installation Guide A) Getting Help B) Disclaimers C) Quick Start D) Kamailio with Persistent Data Storage 4. Troubleshooting 1. Supported Architectures and Requirements ------------------------------------------- Supported architectures: - Linux/i386, Linux/amd64, Linux/armv4l, - FreeBSD/i386, OpenBSD/i386, NetBSD/sparc64 - Solaris/sparc64, Solaris/i386 Compile requirements: - gcc / suncc / icc : gcc >= 2.9x; 4.x recommended Any current distribution or operation system should have a suitiable compiler. - bison or yacc - flex - GNU make (on Linux this is the standard "make", on FreeBSD and Solaris is called "gmake") version >= 3.79. - sed and tr (used in the makefiles) - GNU tar ("gtar" on Solaris) and gzip if you want "make tar" to work - GNU install or BSD install (on Solaris "ginstall") if you want "make install", "make bin", "make sunpkg" to work - openssl if you want to compile the TLS support - libsctp if you want to compile the SCTP support - libmysqlclient & libz (zlib) -libs and devel headers- if you want mysql DB support (the db_mysql module) - libpq / postgresql -libs and devel headers- if you want postgres DB support (the db_postgres module) - unixodbc -libs and devel headers- if you want unixodbc DB support (the db_unixodbc module) - libexpat if you want the jabber gateway support (the jabber module) or the XMPP gateway support - libxml2 if you want to use the cpl-c (Call Processing Language) or the presence modules (presence and pua*) - libradius-ng -libs and devel headers- if you want to use functionalities with radius support - authentication, accounting, group support, etc - unixodbc - libs and devel headers - if you want UNIXODBC support as DB underlayer - libxmlrpc-c3 - libs and devel headers - if you want to have XML-RPC support for the Management interface (MI) - libperl - libs and devel headers - if you want PERL connector to support perl scripting from you config file (perl module) - libsnmp9 - libs and devel headers - if you want SNMP client functionality (SNMP AgentX subagent) for Kamailio - libldap libs and devel headers v2.1 or greater - if you want LDAP support - libconfuse and devel headers - if you want to compile the carrierroute module - libpcre libs and devel headers - if you want to compile the lcr and dialplan modules OS Notes: - FreeBSD/OpenBSD/NetBSD: make sure gmake, bison or yacc & flex are installed - Solaris: as above; you can use Solaris's yacc instead of bison. You might need also gtar and ginstall. - For other architectures or operating system the Makefiles might need to be edited. There are various configuration options defined in the Makefile. 2. Howto Build Kamailio From Source Distribution ------------------------------------------- Kamailio don't use autoconf for build configuration, it uses only makefiles. If you compile on a non-linux system, the normal "make" probably will not work correctly, use "gmake" here instead. In the following sections several compile options are explained. If you just want to build a "default" version, you can skip the advanced cases. IMPORTANT: starting with v3.1.0, first thing you must do is to set the build flavour to kamailio, using command: make FLAVOUR=kamailio cfg A) Basic building: - builds only the Kamailio core with default options make - build all modules without external library depencies make modules-all B) Advanced building: - build everything make all -compile debug mode version make mode=debug all -compile only the textops module make modules=modules_k/textops modules -compile all the "default" modules except textops and db_mysql make skip_modules="textops db_mysql" modules-all -compile all default modules and include uri_radius (not compiled by default): make include_modules="uri_radius" modules-all -compile all the modules from the modules subdirectory (even the one excluded by default): make exclude_modules="" modules-all -compile all the modules from the modules subdirectory excluding exec: make exclude_modules=exec modules-all or make exclude_modules="" skip_modules=exec modules-all -generate README file for textops module make modules=modules_k/textops modules-readme - compile with gcc-3.2 instead of gcc make CC=gcc-3.2 all or CC=gcc-3.2 make all C) Additional make targets Make targets: Clean: make clean (clean the modules too) make proper (clean also the dependencies) make distclean (the same as proper) make mantainer-clean (clean everything, including auto generated files, tags, *.dbg a.s.o) Compile: make proper make (or gmake on non-Linux systems) make modules or make modules exclude_modules="exec" etc. Make tags: make TAGS Create a tar.gz with the sources (in ../): make tar Create a tar.gz with the binary distribution (in ../): make bin Create a gzipped solaris package (in ../): make sunpkg Create debian packages (in ../): make deb or dpkg-buildpackage D) Install the build - install in the "/usr/local" directory make prefix=/usr/local install Note: If you use prefix parameter in make install then you also need to use this parameter in previous make commands, i.e. make, make modules, or make all. If you fail to do this then Kamailio will look for the default configuration file in a wrong directory, because the directory of the default configuration file is hard coded into Kamailio during compile time. When you use a different prefix parameter when installing then the directory hard coded in Kamailio and the directory in which the file will be installed by make install will not match. You can specify the exact location of the configuration file using the "-f" startup parameter of kamailio. For example, if you do the following: make all make prefix=/ install Then the installation will put the default configuration file into /etc/kamailio/kamailio.cfg (because prefix is /), but Kamailion will look for the file in /usr/local/etc/kamailio/kamailio.cfg (because there was no prefix parameter in make all and /usr/local is the default value of prefix). The workaround is trivial, use the same parameters in all make commands: make prefix=/ all make prefix=/ install That applies to other make parameters as well, for example the parameters "modules" or "excluded_modules". 3. Quick-Start Installation Guide ---------------------------------------------- A) Getting Help This guide gives you instructions on how to quickly set up Kamailio on your box. In case the default configuration does not work for you, check the documentation at Kamailio site http://www.kamailio.org/ and our wiki at http://kamailio.org/dokuwiki/ to learn how to configure Kamailio for your site. If the documentation does not resolve your problem you may try contacting our user forum by E-mail at users@lists.kamailio.org -- that is the mailing list of Kamailio community. To participate in the mailing list, subscribe at the following web address: http://www.kamailio.org/cgi-bin/mailman/listinfo/users B) Disclaimers Note that the default "quick-start" configuration is very simple in order to be easily installable. It provides only minimum features. Particularly, authentication is by default disabled, which means anyone can register using any name with the server. This is done on purpose to avoid installation dependencies on MySQL which is needed for storing user credentials. C) Quick Start The following step-by step guide gives you instructions how to install the sql-free distribution of Kamailio. If you need persistence and authentication, then you have to install additional MySQL support -- proceed to section D) after you are finished with C). 1) Download an RPM or debian package from our site http://kamailio.org/pub/kamailio/latest/packages/ If for the latest release is now binary package available check the previous release. If you don't use an rpm or debian based distribution, see if some corresponding packages are available or try our tar.gz'ed binaries. If you use Gentoo Linux, FreeBSD or OpenBSD you do not have to download a package. For debian, packages are available via the Debian official repositories for stable, testing and unstable. 2) install the package RPM: rpm -i debian: dpkg -i or if APT repository is used: apt-get install gentoo: emerge kamailio (or if use only stable packets: ACCEPT_KEYWORDS="~x86" emerge kamailio) tar.gz: cd /; tar zxvf _os_arch.tar.gz (it will install in /usr/local/, and the configuration file in /usr/local/etc/kamailio/kamailio.cfg) Solaris: gunzip .gz ; pkgadd -d *BSD: pkg_add package_name Note that the Kamailio package is in the FreeBSD package tree included, but is not present in the OpenBSD and NetBSD repository. You'll probably have more luck trying to build directly from the source with the tar.gz, as the package files for this systems are somewhat out of date at the moment. 3) start the server RPM + gentoo: /etc/init.d/kamailio start debian: kamailio is started automatically after the install (in case something fails you can start it with /etc/init.d/kamailio start) tar.gz: the tar.gz does not include an init.d script, you'll have to create one of your own or adapt one from the source distribution (debian/init.d, rpm/kamailio.init.*, gentoo/kamailio.init) You can start Kamailio directly with /usr/local/sbin/kamailio. Solaris: check the tar.gz. content for futher informations 4) optionally, you can watch the server's health using the kamctl utility - to do so, first set the environment variable SIP_DOMAIN to your domain name, e.g., in Bourne shell, call export SIP_DOMAIN="myserver.foobar.com" - if you are using other than 'localhost' mysql server for maintaining subscriber database, change the variable 'SQL_HOST' to the proper host name in the kamctl script - run the kamctl utility /usr/sbin/kamctl moni or /usr/local/sbin/kamctl moni (if you installed from a tar.gz or solaris package) - you can create a resource file for kamctl, name it .kamctlrc and place it in your home directory. You can set there the values for kamctl variables (e.g., SIP_DOMAIN, SQL_HOST, SQL_USER, SQL_DB ...) - also possible is to edit the system wide resource file, normally placed in /etc/kamailio/kamctlrc, or /usr/local/etc/kamailio/kamctlrc 5) Register with the server using your favourite SIP User Agent. For example, users of Windows Messenger need to set in Tools->Options->Accounts the following values: Sign-in Name: @ Advanced->Configure Settings (on) Advanced->Server: Connect Using: UDP D) Kamailio with Persistent Data Storage The default configuration is very simple and features many simplifications. In particular, it does not authenticate users and loses User Location database on reboot. To provide persistence, keep user credentials and remember users' locations across reboots, Kamailio can be configured to use MySQL. Before you proceed, you need to make sure MySQL is installed on your box. 1) Download the package containing mysql support for Kamailio from: http://www.kamailio.org/pub/kamailio/ (rpm and deb provides this, most of the binary tar.gz distributions and the solaris package include it too; if it is not present you'll have to rebuild from the source). For gentoo please include 'mysql' to your USE variable in /etc/make.conf or give it as variable to the emerge command. 2) install the package RPM based: rpm -i DEB based: dpkg -i or if APT repository is used apt-get install Gentoo Linux: emerge kamailio (if do not want to put 'mysql' into your USE variable you can type: USE="mysql" emerge kamailio) 3) create SQL tables You must specify your database type in the /etc/kamctlrc file, e.g. MySQL. See section 7) for an explanation of further possible parameters. - if you have a previously installed Kamailio on your system, use /usr/sbin/kamdbctl migrate to convert your Kamailio database into new structures. NOTE: the "migrate" command is available only for MySQL DBs - otherwise, if this is your very first installation, use /usr/sbin/kamdbctl create to create Kamailio database structures. You will be prompted for a password of the MySQL "root" user. 4) configure Kamailio to use SQL uncomment all lines in configuration file kamailio.cfg which are related to authentication: - loadmodule "db_mysql.so" - loadmodule "auth.so" - loadmodule "auth_db.so" - modparam("usrloc", "db_mode", 2) - modparam("auth", "calculate_ha1", yes) - modparam("auth_db", "password_column", "password") - if (!www_authorize("sip.org", "subscriber")) { www_challenge("sip.org", "0"); exit; }; 5) be sure to replace realm, the first parameter in www_* actions, with the name of your server; some broken UAC implementations don't authenticate otherwise; the authentication command in your configuration script should look then like this: if (!www_authorize("myserver.foobar.com", "subscriber")) { www_challenge("myserver.foobar.com", "0"); exit; } 6) restart the server /etc/init.d/kamailio restart 7) You can now start managing the server using the kamctl utility, you need to first set the environment variable SIP_DOMAIN to your local SIP realm, e.g., export SIP_DOMAIN="myserver.foobar.com" or you can configure via the resource file for kamctlrc. The default file is installed in the etc/ directory of your installation (along with the Kamailio config file). For per user configuration, create .kamctlrc in your home directory. You can set there the values for kamctl variables like: SIP_DOMAIN - your SIP domain DBENGINE - database type: MYSQL, PGSQL or DBTEXT by default none is loaded DBHOST - database host DBNAME - database name DBRWUSER - database read/write user DBROUSER - database read only user DBROPW - password for database read only user DBROOTUSER - database super user ALIASES_TYPE - type of aliases used: DB - database aliases UL - usrloc aliases default none CTLENGINE - control engine: FIFO or UNIXSOCK OSER_FIFO - path to FIFO file VERBOSE - verbose - debug purposes - default '0' a) watch the server status using 'kamctl moni' b) try to login with your SIP client as user 'admin' with the password 'openserrw' c) try adding new users using 'kamctl add ' 8) default values (database url, users and passwords) are: - DEFAULT_DB_URL="mysql://openser:openserrw@localhost/openser" - r/w user: openser ; passwd: openserrw - r/o user: openserro ; passwd: openserro VERY IMPORTANT NOTE: for security reasons, do change the values of passwords after installation 4. Troubleshooting ------------------ - take a look to our FAQ in the wiki at: http://www.kamailio.org/dokuwiki/doku.php/troubleshooting:faq - ask at our users list at users@lists.kamailio.org or the IRC channel #kamailio on freenode.net