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 ...
随机推荐
- MyEclipse异常关闭导致Tomcat不能启动的问题
由于MyEclipse的异常关闭从而导致Tomcat并没有关闭,所以再次启动Tomcat当然是无法启动的啦,解决方法:在任务管理器中关闭一个叫javaw.exe的进程,如果你这时已经启动了MyEcli ...
- flask第十三篇——url注意事项
先和大家说一下常用的请求方法 get:只是从服务器获取数据,不会对服务器的状态或数据产生任何影响: get方法的参数是放在URL中传递的. post:会对服务器的状态或数据产生影响:通过body形式进 ...
- 无法连接到SQL数据库
问题: 连接到服务器------------------------------无法连接到 .. 其他信息:在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误.未找到或无法访问服 ...
- 安装系统出现Winload.exe错误0xc000000e解决方法
有的用户在安装Win7/Win8/Win10操作系统后,重启时出现Windows 启动管理器错误,无法加载所选项,因为应用程序丢失或损坏的的故障,错误代码:0xc000000e,这是由于引导文件没有正 ...
- 10.Python运行Scrapy时出现错误: ModuleNotFoundError: No module named 'win32api'
1.在命令行输入:scrapy crawl demo(demo为爬虫标识,是唯一的) 2.报错信息如下所示: 3.解决方法:https://github.com/mhammond/pywin32/re ...
- angular先加载页面再执行事件,使用echarts渲染页面
剧情重现: 在一个页面中有多个小模块,这几个模块是可以拖动调顺序的,并且其中有两个模块使用了echarts渲染, 调整顺序angular插件有成熟的解决方案angular-sortable,https ...
- C#开机启动与退出程序
最新用到的项目中需要使用开机自启和退出程序,于是需要 http://www.cnblogs.com/Gaoswatou/p/6605760.html C# WinForm程序退出的方法 1.this. ...
- Android 从上层到底层-----kernel层
CPU:RK3288 系统:Android 5.1 功能:上层 app 控制 led 亮灭 开发板:Firefly RK3288 1.在dts文件中增加 led 设备 path:kernel/arch ...
- Unit07: MyBatis框架简介 、 MyBatis基本应用
Unit07: MyBatis框架简介 . MyBatis基本应用 1. myBatis (1)myBatis是什么? 是一个开源的持久层框架. 注:myBatis底层仍然是jdbc. (2)编程步骤 ...
- Win10 恢复后退键
转自:http://www.cnblogs.com/liubaicai/p/4368261.html 自带的几种风格的页面,竟然是用的左上角虚拟后退键,这种倒行逆施的行为微软你真是够了! 一定要把后退 ...