1.修改服务器的主机名称

[root@localhost ~]# vim /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=localhost.localdomain
HOSTNAME=OpenSIPS.clvn.com.cn

 

2.查看NetworkManager服务的状态

[root@localhost ~]# service NetworkManager status

NetworkManager (pid  2945) 正在运行...

 

3.将NetworkManager服务关闭

[root@localhost ~]# service NetworkManager stop

停止 NetworkManager 守护进程:                             [确定]

 

4.设置NetworkManager服务开机时自动关闭

[root@localhost ~]# chkconfig --level 35 NetworkManager off

 

5.查看NetworkManager服务开机时是否处于自动关闭状态

[root@localhost ~]# chkconfig --list NetworkManager
NetworkManager  0:关闭 1:关闭 2:启用 3:关闭 4:启用 5:关闭 6:关闭

 

6.配置IP地址

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:6C:A2:40
TYPE=Ethernet
UUID=9b5a23e3-7c38-4b6e-b7ac-088f33c8727b
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=192.168.0.28
NETMASK=255.255.255.0
IPV6INIT=no
USERCTL=no

7.设置主机名称和IP地址的对应关系

[root@localhost ~]# vim /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.28 OpenSIPS.clvn.com.cn                               OpenSIPS

8.重新启动服务器

[root@localhost ~]# reboot

9.查看主机名称

[root@OpenSIPS ~]# hostname

OpenSIPS.clvn.com.cn

10.查看ip地址是否生效

[root@OpenSIPS ~]# ifconfig eth0

eth0      Link encap:Ethernet  HWaddr 00:0C:29:5B:82:3D 
          inet addr:192.168.0.28  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe5b:823d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:746 (746.0 b)

 

11.安装opensips所依赖的软件包

[root@OpenSIPS ~]# yum -y install gcc make

[root@OpenSIPS ~]# yum -y install flex bison ncurses ncurses-devel openssl-devel zlib-devel
[root@OpenSIPS ~]# yum -y install mysql mysql-server mysql-libs mysql-devel

 

12.查看opensips软件包

[root@OpenSIPS ~]# cd /usr/local

[root@OpenSIPS local]# ls
bin  games                      lib         libexec                                    sbin   src
etc  include                     lib64      opensips-1.11.1_src.tar.gz  share

 

13.解压该软件包

[root@OpenSIPS local]# tar -zxvf opensips-1.11.1_src.tar.gz

 

14.查看解压后生成的目录

[root@OpenSIPS local]# ls

bin  games    lib    libexec                     opensips-1.11.1-tls  share
etc  include  lib64  opensips-1.11.1_src.tar.gz  sbin                 src

 

15.查看当前所在的目录

[root@OpenSIPS opensips-1.11.1-tls]# pwd

/usr/local/opensips-1.11.1-tls

16.编译

[root@OpenSIPS opensips-1.11.1-tls]# make prefix=/ all include_modules="db_mysql"

 

17.安装

[root@OpenSIPS opensips-1.11.1-tls]# make prefix=/ install include_modules="db_mysql"

 

18.修改配置文件

[root@OpenSIPS ~]# vim /etc/opensips/opensipsctlrc

## database host

DBHOST=192.168.0.28

## 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"

19.创建数据库

wKiom1OPD_HRYDUuAAENOzS7nmM914.jpg

20.登录数据库

wKiom1OPD_PDADNkAAFqVVflITs368.jpg

 

21.查看数据库

wKioL1OPD8aiUawCAABvD6Djx9Q766.jpg

22.切换数据库

wKiom1OPD_OyWvQ0AACGN5jr83E268.jpg

 

23.查看数据库中的表

 

wKioL1OPD8fTSUSsAAEZ5UJ6m0g818.jpg

24.配置opensips

wKioL1OPET2jo9fFAAAc5UdqnP4985.jpg

wKiom1OPEWriQ_iDAAEvH61mFq8810.jpg

wKiom1OPEWuTaGlxAAEkySKEbNo700.jpg

wKioL1OPEUDAy0CLAAEqxKijzQg717.jpg

wKioL1OPEULzfUnuAAFmefzbxOY714.jpg

wKiom1OPEXGhNH11AAFSWbrpkws935.jpg

wKiom1OPEXKy_WPCAAGEe715Clk795.jpg

25.查看生成的配置文件

wKioL1OPEUbD3EdZAAAhT2oSZ3M984.jpg

wKiom1OPEXPS42vZAADuO09Iulk414.jpg

26.将原来的配置文件***

wKioL1OPEUbxyYqcAAAm_YiAtmk317.jpg

27.将生成的配置文件改成默认的配置文件

wKioL1OPEUfR9Hr9AABPnR57bTI791.jpg

28.查看是否更改成功

wKiom1OPEXSRxs8UAACyD6UF1II460.jpg

29.修改配置文件如下

wKiom1OPEXXD0N7dAAGVj1PeVTc231.jpg

29.启动opensips

wKioL1OPEUnCWmxXAABpkNw5ZyU601.jpg

30.查看opensips是否启动成功

wKiom1OPEXazjxbMAAGGXkeC6Dk198.jpg