How to Install OpenSIPS Control Panel on Ubuntu 16.04

Published on: Fri, Jun 30, 2017 at 12:21 pm EST
Linux Guides Server Apps Ubuntu

OpenSIPS Control Panel is a PHP based web application for provisioning an OpenSIPS SIP server. It can be used to provision, operate, and monitor multiple instances of OpenSIPS servers across the globe. It is specially designed for the VoIP providers to develop their own interface with the end users.

Here, I will explain how to install OpenSIPS Control Panel on Ubuntu 16.04 server.

Prerequisites

  • A newly deployed Vultr Ubuntu 16.04 server instance.
  • A non-root user with sudo privileges setup on your server.

Step 1: Update the System

Before installing any packages, you will need to update your system to the latest stable version by running the following commands:

sudo apt-get update -y
sudo apt-get upgrade -y
sudo reboot

Step 2: Install LAMP Server

Install Apache, MySQL, PHP and other required dependencies on your server. You can install all of them with the following command:

sudo apt-get install apache2 mysql-server php7.0 php7.0-cli php7.0-mysql php7.0-xmlrpc php-pear php-log php-mdb2-driver-mysql -y

Once the installation is complete, start Apache and MySQL services and enable them to start at boot:

sudo systemctl start apache2
sudo systemctl start mysql
sudo systemctl enable apache2
sudo systemctl enable mysql

Step 3: Download Opensips-CP

Download the latest stable version of the Opensips-CP.

wget https://github.com/OpenSIPS/opensips-cp/archive/6.2.zip

Once the download has completed, extract the downloaded file with the following command:

unzip 6.2.zip

Next, move the extracted directory to the Apache web root directory:

sudo mv opensips-cp-6.2 /var/www/html/opensips

Next, give proper permissions to the opensips directory:

sudo chown -R www-data:www-data /var/www/html/opensips

Step 4: Configure Apache

You will need to configure Apache for Opensips-CP. You can do this by adding following lines at the end of the apache2.conf file:

sudo nano /etc/apache2/apache2.conf

Add the following lines at the end of the file:

<Directory /var/www/html/opensips/web>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>
<Directory /var/www/html/opensips>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order deny,allow
    deny from all
</Directory>
Alias /cp /var/www/html/opensips/web

Save and close the file when you are finished.

Next, edit the php.ini file:

sudo nano /etc/php/7.0/cli/php.ini

Change the following line:

short_open_tag = On;

Save the file and restart the Apache service:

sudo systemctl restart apache2

Step 5: Configure Database

Create a database for Opensips-CP by logging into a MySQL shell.

mysql -u root -p

Enter your password, then create a new database:

mysql> create database opensips character set utf8;
mysql> exit;

Install the ocp_admin_privileges table schema from the opensips folder:

sudo mysql -u root -p opensips < /var/www/html/opensips/config/tools/admin/add_admin/ocp_admin_privileges.mysql

Next, insert a "first login user" into the table with the following command:

sudo echo "INSERT INTO ocp_admin_privileges (username,password,ha1,available_tools,permissions) values ('admin','admin',md5('admin:admin'),'all','all');" | sudo mysql -u root -p opensips

You will need to edit the db.inc.php file and update your database credentials:

sudo nano /var/www/html/opensips/config/db.inc.php

Change the lines as shown below:

$config->db_driver = "mysql";
$config->db_host = "localhost";
$config->db_port = "";
$config->db_user = "root";
$config->db_pass = "your-root-password";
$config->db_name = "opensips";

Save the file when you are finished.

By default, Opensips-CP will save the password in plain text. If you don't want the password in plain text format, then edit local.inc.php file and update the value of $config->passwd_mode from 0 to 1.

sudo nano /var/www/html/opensips/config/tools/users/user_management/local.inc.php

Change the following lines:

 $config->passwd_mode=1;

Save and close the file, then restart Apache and MySQL service:

sudo systemctl restart apache2
sudo systemctl restart mysql

Step 6: Access Opensips-CP Web Interface

It's time to access the Opensips-CP web interface.

Open your web browser and type the URL http://your-server-ip/opensips. Login by using the default user name as admin and password as admin. Upon successful login, you will be redirected to the Opensips Control Panel.

Congratulations! You have successfully installed Opensips Control Panel on Ubuntu 16.04 server.

Want to contribute ?

You could earn up to $300 by adding new articles