1、apt-get update
apt-get install git
apt-get install vim
apt-get install flex bison libncurses5-dev
apt-get install libncurses-dev
apt-get install libncurses5-dev
apt-get install bison
apt-get install yacc
apt-get install m4
2、 cd /usr/local/src
git clone https://github.com/OpenSIPS/opensips.git -b 2.2 opensips_2_2
git clone -b 1.8.2 https://github.com/OpenSIPS/opensips.git opensips_1_8
3、cd opensips_2_2 opensips_1_8
apt-get install flexbison ibncurses-dev
apt-get install libmysqlclient-dev
安装mysql数据库如下:
apt-get install mysql-server mysql-client
3、make menuconfig
选中 db_mysql
安装路径: /usr/local/opensips_proxy/
ps aux|grep mysql
4、cd /usr/local/opensips_proxy/etc/opensips
vim opensipsctlrc
放开 对 db_mysql 注释
5、cd /usr/local/opensips_proxy/sbin
./opensipsdbctl create
都选 n
6、cd /usr/local/opensips_proxy/sbin
./osipsconfig
7、cd /usr/local/opensips_proxy/etc/opensips
vim opensips_residential_2016-8-14_16:6:26.cfg
改 listn 为 ip
8、cd /usr/local/src/opensips_2_2
cd packaging/
cat /etc/debian_version 查看 debian 版本
cd debian
cp opensips.init /etc/init.d/opensips
chmod +x /etc/init.d/opensips
vim /etc/init.d/opensips
更改 DAEMON=/usr/local/opensips_proxy/sbin/opensips
更改: OPTIONS="-P $PIDFILE -m $S_MEMORY -M $P_MEMORY -u $USER -g $GROUP -f /usr/local/opensips_proxy/etc/opensips/opensips_residential_2016-8-14_16:6:26.cfg"
cp opensips.default /etc/default/
cd /etc/default/
mv opensips.default opensips
vim opensips
更改: RUN_OPENSIPS=yes USER=root GROUP=root
vim /usr/local/opensips_proxy/etc/opensips/opensips_residential_2016-8-14_16:6:26.cfg
更改: log_facility=LOG_LOCAL1
vim /etc/rsyslog.conf
直接按 o 键
更改: 最后 加上 local1.* -/var/log/opensips.log
/etc/init.d/rsyslog restart
启动opensips:
/etc/init.d/opensips start
9、查看日志:
less /var/log/opensips.log
会提示:ERROR:db_mysql:db_mysql_connect: driver error(1045): Access denied for user 'opensips'@'localhost' (using password: YES)
点击 q 键 / ZZ - 退出 less 命令
vim /usr/local/opensips_proxy//etc/opensips/opensips_residential_2016-8-14_23:50:25.cfg
添加:
ps aux|grep opensips
如果出现“opensips ERROR:db_mysql:db_mysql_connect: driver error(1045): Access denied for user 'opensips”怎么办?
#mysql -uroot -p
mysql> grant all privileges on opensips.* to opensips@localhost identified by 'opensipsrw';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
重新启动OpenSIPS
网友评论