Sunteți pe pagina 1din 4

Installing OpenSIPS

$cat /etc/redhat-release Shows the CentOS release version number


$uname -m Shows if you have the x86_64 version
$cat /proc/cpuinfo Shows the type of processor on your machine

Packages assumed to already be installed on the base system


zlib version 1.2.3
openssl version 0.9.8b
mysql version 5.0.45

Update and install various packages using YUM


yum install gcc
yum install bison
yum install flex
yum install zlib-devel
yum install openssl-devel

Install MySQL local server and MySQL headers


Install mysql-server
Suggested version: 5.0.45-7.el5
Command:
yum install mysql-server
Then install mysql headers
Command:
yum install mysql-devel

Get a copy of the OpenSIPS source files


$cd /usr/src/
Suggested version: opensips-1.5.3-notls_src.tar.gz
Download site: http://opensips.org/pub/opensips/latest/src/opensips-1.5.3-notls_src.tar.gz
$wget http://opensips.org/pub/opensips/latest/src/opensips-1.5.3-notls_src.tar.gz
Unzip:
$tar -xzf opensips-1.5.3-notls_src.tar.gz
Copy the source files to: /usr/src/opensips

Fix the makefile to include the db_mysql module


To enable MySQL server support, edit the file called "Makefile" and locate the section of the file
that sets a list of excluded modules. It looks like this:
nano /usr/src/opensips/Makefile
# if not set on the cmd. line or the env, exclude this modules:
exclude_modules?= jabber cpl-c db_mysql db_postgres osp db_unixodbc \
     db_oracle avp_radius auth_radius group_radius uri_radius \
     xmpp presence presence_xml presence_mwi pua pua_bla pua_mi \
     pua_usrloc pua_xmpp rls mi_xmlrpc perl snmpstats perlvdb \
     ldap carrierroute h350 xcap_client db_berkeley seas peering

Simply remove the entry for db_mysql, so it now looks like this:
# if not set on the cmd. line or the env, exclude this modules:
exclude_modules?= jabber cpl-c db_postgres osp db_unixodbc \
     db_oracle avp_radius auth_radius group_radius uri_radius \
     xmpp presence presence_xml presence_mwi pua pua_bla pua_mi \
     pua_usrloc pua_xmpp rls mi_xmlrpc perl snmpstats perlvdb \
     ldap carrierroute h350 xcap_client db_berkeley seas peering

Compile and install OpenSIPS


You should still be in the directory /usr/src/opensips to run these commands:

$make clean
$make
$make install

Test that OpenSIPS runs ok


[root@opensips]# opensipsctl start
INFO: Starting OpenSIPS :
INFO: started (pid: 29697)
Another test you can use to check if OpenSIPS is actually running, is
this:
$ps ax | grep opensips

You should see something like this:


[root@svoxser03 opensips]# ps ax | grep opensips
29839 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29841 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29842 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29843 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29844 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29845 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29846 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29847 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29848 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29849 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29850 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29851 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29852 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29853 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29854 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29855 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29858 pts/0 S+ 0:00 grep opensips

And finally...
Create automated startup scripts
root@pbx:~ $ cp /usr/src/opensips/packaging/fedora/opensips.init /etc/init.d/opensips
root@pbx:~ $ chmod 777 /etc/init.d/opensips
root@pbx:~ $ nano /etc/init.d/opensips

Edit

# chkconfig: - 85 15 Change it to --># chkconfig: 345 96 15

oser=/usr/local/sbin/opensips

On the line that starts the daemon, remove "| tail -1" and instead get the line to look like this:

daemon $oser $OPTIONS >/dev/null 2>/dev/null

Add

PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin

Test it from the command line, using commands such as:


/etc/init.d/opensips start
/etc/init.d/opensips status
/etc/init.d/opensips stop
Hint: if you are having inexplicable problems getting it to start, you may need to manually delete
the file /var/lock/subsys/opensips

root@pbx:~ $ chkconfig --add opensips

Reboot the server to check that opensips starts automatically.


Start writing your own opensips.cfg config file
The default config file is in /usr/local/etc/opensips.

Creating the OpenSIPS tables


$nano /etc/opensips/opensipsctlrc
(see DBENGINE)
configure the host
Proceed with creation of the OpenSIPS standard database:
$ opensipsdbctl create
If you use the default values to DB host and mysql access users, you should be able to access the
DB by:
$ mysql -h'localhost' -u'opensips' -p'opensipsrw' opensips

S-ar putea să vă placă și