Ubuntu 安装 kamailio
首先安装前,你已经对kamailio的基本用法了解。可根据情况选择安装方式,本次安装基于Ubuntu18.04系统安装,对于16.04及一下会遇到版本问题,请自己查阅文档解决
安装第三方库
sudo apt-get install gcc flex bison libmysqlclient-dev make libcurl4-openssl-dev libxml2-dev libpcre3-dev libncurses5-dev libreadline6 libreadline-dev e2fsprogs-dev uuid-dev libuuid-dev
确保数据库安装成功
第一种
可直接通过sudo apt-get install kamailio安装
配置
修改/etc/kamailio/kamctlrc,配置mysql
kamdbctl create创建mysql数据库
指定log
修改/etc/rsyslog.d/50-default.conf
#*.*;auth,authpriv.none -/var/log/syslog #注释掉这一行
*.*;auth,authpriv.none,local0.none -/var/log/syslog #新加行
if $syslogfacility-text=='local0' then -/var/log/kamailio.log #新加行
重启 systemctl restart rsyslog
修改/etc/kamailio/kamailio.cfg 配置路由
启动kamactl start
第二种下载源码安装
下载源码包
http://www.kamailio.org/pub/kamailio/latest/src/
解压
tar xvf kamailio-*_src.tar.gz
cd kamailio-*
执行下面指令生成modules.list文件
make FLAVOUR=kamailio cfg
进入modules.list找到"exclude_modules",将等号后面的db_mysql删除(这里可以根据自己的需要调整编译的模块)。然后执行如下指令编译
执行指令安装
make all
sudo make install
执行过程中如果报错根据提示慢慢解决
启动文件在 /etc/local/sbin下
配置文件在 /usr/local/etc/kmailio下
配置
打开/usr/local/etc/kamailio/kamailio.cfg,添加下面几行(添加在最顶端即可):
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
#!define WITH_NAT
#!define WITH_DEBUG
修改 /usr/local/etc/kamailio/kamctlrc
掉SIP_DOMAIN前的注释,并且修改成自己的服务器地址192.168.1.111(根据自己服务器的实际情况来写),我的是SIP_DOMAIN=192.168.1.111。然后去掉DBENGINE=MYSQL前的注释语句,选定mysql数据库,其他的按照如下内容来修改:
# cat /usr/local/etc/Kamailio/kamctlrc
# $Id$
# The Kamailio configuration file for the control tools.
# Here you can set variables used in the kamctl and kamdbctl setup
# scripts. Per default all variables here are commented out, the control tools
# will use their internal default values.
## your SIP domain
SIP_DOMAIN=192.168.1.111
## chrooted directory
# $CHROOT_DIR="/path/to/chrooted/directory"
## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, or DBTEXT, 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
## database name (for ORACLE this is TNS name)
DBNAME=kamailio
# database path used by dbtext or db_berkeley
# DB_PATH="/usr/local/etc/kamailio/dbtext"
## database read/write user
DBRWUSER=kamailio
## password for database read/write user
DBRWPW="kamailiorw" ## database read only user
# DBROUSER=kamailioro
DBROUSER=kamailioro
## password for database read only user
DBROPW=kamailioro
## database super user (for ORACLE this is 'scheme-creator' user)
DBROOTUSER="root"
# user name column
USERCOL="username"
# SQL definitions
# If you change this definitions here, then you must change them
# in db/schema/entities.xml too.
# FIXME
# FOREVER="2020-05-28 21:32:15"
# DEFAULT_ALIASES_EXPIRES=$FOREVER
# DEFAULT_Q="1.0"
# DEFAULT_CALLID="Default-Call-ID"
# DEFAULT_CSEQ="13"
# DEFAULT_LOCATION_EXPIRES=$FOREVER
# Program to calculate a message-digest fingerprint
# MD5="md5sum"
# awk tool
# AWK="awk"
# If you use a system with a grep and egrep that is not 100% gnu grep compatible,
# e.g. solaris, install the gnu grep (ggrep) and specify this below.
#
# grep tool
# GREP="grep"
# egrep tool
# EGREP="egrep"
# sed tool
# SED="sed"
# tail tool
# LAST_LINE="tail -n 1"
# expr tool
# EXPR="expr"
# Describe what additional tables to install. Valid values for the variables
# below are yes/no/ask. With ask (default) it will interactively ask the user
# for an answer, while yes/no allow for automated, unassisted installs.
#
# If to install tables for the modules in the EXTRA_MODULES variable.
# INSTALL_EXTRA_TABLES=ask
# If to install presence related tables. # INSTALL_PRESENCE_TABLES=ask
# Define what module tables should be installed.
# If you use the postgres database and want to change the installed tables, then you
# must also adjust the STANDARD_TABLES or EXTRA_TABLES variable accordingly in the
# kamdbctl.base script.
# kamailio standard modules
# STANDARD_MODULES="standard acc lcr domain group permissions registrar usrloc msilo
# alias_db uri_db speeddial avpops auth_db pdt dialog dispatcher
# dialplan"
# Kamailio extra modules
# EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist htable purple"
## type of aliases used: DB - database aliases; UL - usrloc aliases
## - default: none
# ALIASES_TYPE="DB"
## control engine: FIFO or UNIXSOCK
## - default FIFO
# CTLENGINE="FIFO"
## path to FIFO file
# OSER_FIFO="FIFO"
## check ACL names; default on (1); off (0)
# VERIFY_ACL=1
## ACL names - if VERIFY_ACL is set, only the ACL names from below list
## are accepted
# ACL_GROUPS="local ld int voicemail free-pstn"
## verbose - debug purposes - default '0'
VERBOSE=1
## do (1) or don't (0) store plaintext passwords
## in the subscriber table - default '1'
# STORE_PLAINTEXT_PW=0
## OPENSER START Options
## PID file path - default is: /var/run/Kamailio.pid
# PID_FILE=/var/run/kamailio/kamailio.pid
PID_FILE=/var/run/kamailio/kamailio.pid
## Extra start options - default is: not set
# example: start kamailio with 64MB share memory: STARTOPTIONS="-m 64"
# STARTOPTIONS=
生成kamailio的mysql数据库
# /usr/local/sbin/kamdbctl create
启动kamilio服务
# /usr/local/sbin/kamctl start
可能会出现“ERROR:PID file /var/run/kamailio/kamaillio.pid does not exist---Kamailio start failed"
这种种错误出现的原因是/var/run/路径下没有kamailio目录,手动创建一个即可,但不要生成kamailio.pid文件。
然后再开启服务试一下能否成功,如果还是不行,请按顺序检查如下内容:
(1)kamdbctlrc这个配置文件中的DBHOST处是否是127.0.0.1或者localhost,如果不是请将其修改成127.0.0.1或者localhost试试。
(2)执行“kamailio -c”来检测配置文件是否有错误,如果有报错,请根据具体报错信息解决问题。如果出现“config file ok,exiting......”,说明配置文件没有问题了。
(3)执行“kamailio -dddd”,看是否有ERROR输出,若有,请依据错误提示进行修改。
注册sip账号
#kamctl add user1 123456
#kamctl add user2 123456
测试kamailio服务
Ubuntu 安装 kamailio的更多相关文章
- Mac OS、Ubuntu 安装及使用 Consul
Consul 概念(摘录): Consul 是 HashiCorp 公司推出的开源工具,用于实现分布式系统的服务发现与配置.与其他分布式服务注册与发现的方案,比如 Airbnb 的 SmartStac ...
- ubuntu安装mysql
好记性不如烂笔头,记录一下,ubuntu安装mysql的指令. 安装MySQL: sudo apt-get install mysql-server sudo apt-get install mysq ...
- ubuntu安装vim时提示 没有可用的软件包 vim,但是它被其它的软件包引用了 解决办法
ubuntu安装vim时提示 没有可用的软件包 vim-gtk3,但是它被其它的软件包引用了 解决办法 本人在ubuntu系统安装vim 输入 sudo apt-get install vim 提示 ...
- docker 1.8+之后ubuntu安装指定版本docker-engine
这边记录ubuntu安装过程,首先是官网文档 If you haven’t already done so, log into your Ubuntu instance. Open a termina ...
- debian/ubuntu安装桌面环境
apt-get install xorg apt-get install gnome 然后startx ubuntu 安装Gnome桌面 1.安装全部桌面环境,其实Ubuntu系列桌面实际上有几种桌面 ...
- 一个ubuntu phper的自我修养(ubuntu安装)
ubuntu安装篇 一.ubuntu下载 到ubuntu官网下载适合自己电脑配置的系统版本,此处不做展开. 二.制作USB启动盘 在windows下制作USB启动盘,工具是universal usb ...
- ubuntu 安装JAVA jdk的两种方法:
ubuntu 安装jdk 的两种方式: 1:通过ppa(源) 方式安装. 2:通过官网下载安装包安装. 这里推荐第1种,因为可以通过 apt-get upgrade 方式方便获得jdk的升级 使用pp ...
- [其他]Ubuntu安装genymotion后unable to load VirtualBox engine
问题: Ubuntu安装genymotion后unable to load VirtualBox engine 解决办法: 如果没有安装VirtualBox,要先安装VirtualBox. 安装Vir ...
- Ubuntu安装出现左上角光标一直闪解决方式
Ubuntu安装出现左上角光标一直闪解决方式: 01下载ubunu http://cn.ubuntu.com/download/ 02.软碟通 http://pan.baidu.com/s/1qY8O ...
随机推荐
- (笔记)JQuery扩展方法实现Form表单与Json互相转换
JQuery笔记 记两段代码,使用JQuery实现从表单获取json与后端交互,以及把后端返回的json映射到表单相应的字段上. 把表单转换出json对象 //把表单转换出json对象 $.fn.to ...
- XML专题:使用NSXMLParser解析xml文件
使用NSXMLParser解析xml文件 1. 设置委托对象,开始解析 NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data ...
- luarocks yum 安装引起的lapis lua 包查找问题(centos7版本)
备注: 大家在进行lapis 开发的时候有些人比较懒直接使用yum 按照luarocks,之后 使用luarocks 安装lapis 一般来说对于linux 64位的环境都会有些问题(包找 ...
- CentOS yum源设定使用方法的整理(转)
CentOS yum更新了很多版本更新,我本人认为CentOS yum很好使的文件系统,在此向大家推荐CentOS应该是做为服务器的linux的佼佼者.CentOS采用的二进制包是rpm,不过包的依赖 ...
- CentOS配置网易163 yum源
使用说明 首先备份/etc/yum.repos.d/CentOS-Base.repo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/Cen ...
- windows下使用linux命令搜文件
在linux系统的黑幕下,我们只能通过find命令来搜文件,而在windows的界面里,我们只能通过搜索框来搜.两者各有利弊,前者单调但高效,后者用户体验好却比较慢.能不能在windows使用linu ...
- MOSS 2013研究系列---列表的资源限制
MOSS2010 以后,对列表的条目数做了一些限制,大量的将数据存储在列表中,会降低列表的运行效能,因此,MOSS中对列表默认有了一个阀值,默认是5000条数据,当你存储的数据多余5000条的时候,用 ...
- Android插件化初识
含义:可以简单理解为将一个app分为多个小的app,其中有一个为宿主app. 解决的主要问题:代码加载.资源加载. 插件的方式:apk安装,apk不安装,dex包 插件化的优点: 1) 模块解耦,应用 ...
- HDU 1166 敌兵布阵 (线段树模版题)
敌兵布阵 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submis ...
- thinkphp中的配置与读取C方法详解
1.项目公共配置 Conf/config.php 内容如下 <?php /** *项目公共配置 *@package *@author **/ return array( 'LOAD_EXT_CO ...