# ln -sf /usr/lib64/mysql/libmysqlclient.so /usr/lib/mysql/libmysqlclient.so # ln -sf /usr/lib64/mysql/libmysqlclient.a /usr/lib/mysql/libmysqlclient.a # ln -sf /usr/bin/ld/libmysqlclient.so /usr/lib/mysql/libmysqlclient.so
二,下载源码包,并编译安装(采用1.8长期支持版本稳定版)
1,下载
git clone https://github.com/OpenSIPS/opensips.git -b 1.8 opensips_1_8
或者:
svn co https://svn.code.sf.net/p/opensips/svn/branches/1.8 opensips_1_8
2,下载后进入 cd opensips_1_8/
配置(配置时一定把自己需要的模块配置进来):
make menuconfig
或者如果自己直接编译时加入自己需要的模块:
make all include_modules=”db_mysql” && make prefix=/usr/local install include_modules=”db_mysql”
可能遇到问题:
curses.h:31:19: error: curses.h: No such file or directory
make[1]: *** [cfg.o] Error 1
make: *** [opensipsmc] Error 2
问题原因: ncurses-devel ncurses 没有安装
yum install ncurses-devel ncurses如上安装后即可
成功后一般四个目录:etc lib sbin share
然后模块目录在:lib/opensips/modules/
3,修改配置:进入 (这目录在我们先前配置的profix目录下)
cd /opt/opensips/etc/opensipsvi opensipsctlrc
# $Id$ # # The OpenSIPS configuration file for the control tools. # # Here you can set variables used in the opensipsctl and opensipsdbctl setup # scripts. Per default all variables here are commented out, the control tools # will use their internal default values.## your SIP domain #SIP_DOMAIN=opensips.org## 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 opensipsdbctl, you must at least specify # this parameter. DBENGINE=MYSQL## database host DBHOST=localhost## database name (for ORACLE this is TNS name) DBNAME=opensips# database path used by dbtext or db_berkeley # DB_PATH="/usr/local/etc/opensips/dbtext"## database read/write user DBRWUSER=opensips## password for database read/write user DBRWPW="opensipsrw" ## 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然后::wq 保存退出 4 ,初始化数据库: 然后:
cd /opt/opensips/sbin<
运行如下命令:创建数据库:./opensipsdbctl create (注意记得先运行mysql数据库),中途两个选项全部选N
[root@lecloud sbin]# ./opensipsdbctl create MySQL password for root: INFO: test server charset INFO: creating database opensips ... INFO: Core OpenSIPS tables succesfully created. Install presence related tables? (y/n): n Install tables for imc cpl siptrace domainpolicy carrierroute userblacklist? (y/n): n [root@lecloud sbin]#
mysql> use opensips Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> show tables; +--------------------+ | Tables_in_opensips | +--------------------+ | acc | | address | | aliases | | dbaliases | | dialog | | dialplan | | dispatcher | | domain | | dr_carriers | | dr_gateways | | dr_groups | | dr_rules | | grp | | load_balancer | | location | | missed_calls | | nh_sockets | | pdt | | re_grp | | silo | | speed_dial | | subscriber | | uri | | usr_preferences | | version | +--------------------+ 25 rows in set (0.00 sec) mysql>
modparam("usrloc","db_url","mysql://opensips:opensipsrw@localhost/opensips");
7,完成后可以重启opensips服务 即可
学习视频分享:http://pan.baidu.com/s/1ntoGOkD