In this tutorial, we will be showing you how to install Observium on a Debian 9 server.
Check out Our Best VPS Hosting and VPS Management for scaling your cloud-based applications and processes.
What is Observium
Observium is a network monitoring software which was made in PHP. It is a cross-platform application and supports every common operating system. This guide, however, has been made specifically for Debian 9 OS. During the time of writing this tutorial, the latest stable version of Observium was 17.9 and it needed:
- PHP 5.6 or higher (preferably PHP 7.0), with mbstring, pear, mcrypt, JSON, mysqli, and GD PHP extensions enabled. PHP 7.1 is not supported on the current community edition release.
- MySQL 5, MariaDB 5, or later
Apache web server 2.2 or higher compiled with mod_rewrite module and AllowOverride set to ‘All’ (please note, the default setting for AllowOverride in Apache 2.3.9 and higher is ‘None’).
Step 1: Updating the system packages
It is important to ensure that your Debian 9 OS packages are up-to-date.
apt-get update apt-get upgrade
Step 2: Installing the needed Packages
The command below will allow you to install every package required for Observium.
apt-get install php7.0-cli php7.0-mysql php7.0-mysqli php7.0-gd php7.0-mcrypt php7.0-json php-pear imagemagick snmp fping python-mysqldb subversion whois mtr-tiny ipmitool graphviz rrdtool
Step 3: Enabling Apache Rewrite Module
Enable Apache rewrite module if it is not already enabled.
a2enmod rewrite
Step 4: Restarting Apache
For the changes to take effect, you will need to restart the Apache service
service apache2 restart
Step 5: Installing Observium on Debian 9
Download the latest community version of Observium in the /opt/directory on the server. This is available at https://www.observium.org.
cd /opt/ wget http://www.observium.org/observium-community-latest.tar.gz tar zxvf observium-community-latest.tar.gz mv observium /var/www/html/observium mkdir -p /var/www/html/observium/rrd
Step 6: Setting the Proper Ownership of Observium Files
Every file has to be readable by the web server, for this to occur we must set a proper ownership.
chown www-data:www-data -R /var/www/html/observium
Step 7: Create Database and User
Create a new MySQL database and user.
mysql -u root -p mysql> SET GLOBAL sql_mode=''; mysql> CREATE DATABASE observiumdb; mysql> CREATE USER 'observiumuser'@'localhost' IDENTIFIED BY 'y0uR-pa5sW0rd'; mysql> GRANT ALL PRIVILEGES ON observiumdb.* TO 'observiumuser'@'localhost'; mysql> FLUSH PRIVILEGES; mysql> quit
Remember to replace ‘y0uR-pa5sW0rd’ with a stronger password of your own.
Step 8: Creating a New Virtual Host
Create a new virtual host directive in Apache. In our example, we will create a new Apache configuration file called ‘observium.conf’ in the VPS.
touch /etc/apache2/sites-available/observium.conf
ln -s /etc/apache2/sites-available/observium.conf /etc/apache2/sites-enabled/observium.conf
vi /etc/apache2/sites-available/observium.conf
Next, append the following lines into it:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/observium/html ServerName your-domain.com ServerAlias www.your-domain.com <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/html/observium/html> DirectoryIndex index.php Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Directory> ErrorLog /var/log/apache2/your-domain.com-error_log CustomLog /var/log/apache2/your-domain.com-access_log common </VirtualHost>
Finally, delete the ‘000-default.conf’ file.
rm /etc/apache2/sites-enabled/000-default.conf
Step 9: Restarting the Apache Web server
you need to restart The Apache web server for one more time so that the changes take effect.
service apache2 restart
Step 10: Create a config.php file
vi /var/www/html/observium/config.php
Append the following lines to the above.
<?php $config[‘db_extension’] = ‘mysqli’; $config[‘db_host’] = ‘localhost’; $config[‘db_user’] = ‘observiumuser’; $config[‘db_pass’] = ‘y0uR-pa5sW0rd’; $config[‘db_name’] = ‘observiumdb’; $config[‘snmp’][‘community’] = array(“public”); $config[‘auth_mechanism’] = “mysql”;
Then, execute the commands below to insert the default schema.
cd /var/www/html/observium/ php ./discovery.php -u
Step 11: Create a user account
Create a user account for admin using a level of 10.
./adduser.php admin <password> 10
Step 12: Proceed with the Observium installation in a Web Browser
Open the web browser of your choice, go to ‘http://your-domain.com’, then login with your newly created admin account.
./adduser.php admin <password> 10
Conclusion
I hope you have sucessfully installed Observium on your server.
Also, here we have a few hand-picked guides that you must read next: