-
Notifications
You must be signed in to change notification settings - Fork 79
/
INSTALL
127 lines (76 loc) · 4.71 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
OpenSIPS Control Panel (OCP) Installation Guide
-----------------------------------------------
OpenSIPS Control Panel has been tested and developed mostly on Debian and Redhat Linux , but, being a web portal qualifies it to work also with other Linux distros and operating systems as well. Most of the paths and commands in this INSTALL guide are be debian/redhat specific.
What do you need for running OCP?
A web server (this tutorial focuses only on Apache Web Server)
PHP and some of it's extensions
A DB server (mysql/postgres/sqlite/oracle etc)
This tutorial assumes that your web directory is /var/www/html/ and the OCP files are located in /var/www/html/opensips-cp/ folder. Your web directory may depend on your Operating System or on the used web server.
1. Apache
----------
1.1 Install Apache
-------------------
Depending on your Linux distro, do:
Debian-like: apt-get install apache2 libapache2-mod-php php-curl
Redhat-like: yum install httpd
1.2 Configure Apache
--------------------
Add the configuration below into one of Apache's existent VHOSTs or create a new one.
<Directory /var/www/html/opensips-cp/web>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/html/opensips-cp>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all denied
</Directory>
Alias /cp /var/www/html/opensips-cp/web
<DirectoryMatch "/var/www/html/opensips-cp/web/tools/.*/.*/(template|custom_actions|lib)/">
Require all denied
</DirectoryMatch>
You can read more about Apache's VHOSTS here -> http://httpd.apache.org/docs/current/vhosts/examples.html.
1.3 File permissions
---------------------
Apache is going to need write permissions on some files / folders in the opensips-cp directory, so you can do:
for debian: chown -R www-data:www-data /var/www/html/opensips-cp/
for redhat: chown -R apache:apache /var/www/html/opensips-cp/
2. PHP
------
You must have PHP installed and enabled in the web server. In order to do that you will have to install php and some of it's extensions.
for debian: apt-get install php php-gd php-mysql php-pear php-cli php-apcu
for redhat: yum install php php-gd php-mysql php-xmlrpc php-pear php-pecl-apc
Do not forge to restart Apache after all the php changes!!!
3. Database server
------------------
The OpenSIPS Control Panel requires access to database for two purposes:
OCP related data, like login users and permissions, additional data related to some tools (like statistics to be monitored, etc)
OpenSIPS data, access to the OpenSIPS data to allow OCP to provision different OpenSIPS modules
While for the first case you need to create some extra table (usually you can create them directly into the opensips database), for the OpenSIPS database you need to configure only the aceess info (see the configuration chapter).
The OpenSIPS Control Panel can connect to a remote database server, so the DB server can be used from the SIP Server machine or another machine in the network.
3.1 Creating the OCP tables
---------------------------
Before trying to login into OCP, you must create the tables specific to OCP.
From the opensips-cp/ folder run:
mysql -Dopensips -p < config/db_schema.mysql
or
psql -h host_name -U postgres_username -d opensips < config/db_schema.pgsql
This will create the OCP specific tables into the "opensips" database and add a first access user, the "admin" user with the "opensips" password.
4. Cron jobs
------------
In order to allow OCP to sample the statistics from the OpenSIPS boxes, you need to install some cron jobs. First edit the config/tools/system/smonitor/opensips_stats_cron file and change/correct the path to your OpenSIPS Control Panel installation:
Now simply install the cron jobs by doing:
cp config/tools/system/smonitor/opensips_stats_cron /etc/cron.d/
NOTE: you may need to restart the cron service at this point.
WARNING: for security concerns, make sure you replace in the config/tools/system/smonitor/opensips_stats_cron file the username that is running the cron job with a user that has limited capabilities (i.e. replace root with www-data for debian and apache for redhat).
5. OpenSIPs
-----------
In order to allow OCP connect to opensips we need to have the modules mi_http and httpd loaded on the script configuration
On your opensips.cfg file, before the routing logic add
#### HTTPD module
loadmodule "httpd.so"
modparam("httpd", "ip", "127.0.0.1")
#### MI HTTP module
loadmodule "mi_http.so"
A reload on your script is required, take attention to the ip param of httpd module , if you are using the OCP panel from a diferent server you will need to change the ip address from localhost to the correct ip address