Installing openDCIM on Ubuntu

openDCIM is a free PHP and MySQL web application for managing data center infrastructure.

For the test, I’ll install openDCIM on Ubuntu Server 18.04, first switch to the root user:

sudo -i

Install the necessary components:

apt install php php-mysql php-snmp php-curl php-gettext snmp-mibs-downloader graphviz mysql-server mysql-client apache2

Copy the link to the latest version of openDCIM here https://opendcim.org/downloads.html and download openDCIM:

cd /var/www
wget https://opendcim.org/packages/openDCIM-20.01.tar.gz
tar zxpvf openDCIM-20.01.tar.gz
mv openDCIM-20.01 dcim
rm openDCIM-20.01.tar.gz

Let’s create the missing directories and set the permissions:

mkdir /var/www/dcim/assets
mkdir /var/www/dcim/assets/drawings
mkdir /var/www/dcim/assets/pictures
mkdir /var/www/dcim/assets/reports
chmod -R 555 /var/www/dcim
chmod -R 755 /var/www/dcim/assets/drawings /var/www/dcim/assets/pictures /var/www/dcim/assets/reports /var/www/dcim/vendor/mpdf/mpdf/ttfontdata
chown -R www-data:www-data /var/www/dcim/assets/drawings /var/www/dcim/assets/pictures /var/www/dcim/assets/reports /var/www/dcim/vendor/mpdf/mpdf/ttfontdata

Let’s create a database and a user:

mysql -u root -p
create database dcim;
grant all on dcim.* to 'dcim'@'localhost' identified by 'dcim';
quit

Let’s create a configuration file from the example:

cd /var/www/dcim
cp db.inc.php-dist db.inc.php

Let’s create our own Apache2 configuration file or edit the standard existing default-ssl.conf:

nano /etc/apache2/sites-available/default-ssl.conf

We indicate the data in it:

...

DocumentRoot /var/www/dcim

<Directory "/var/www/dcim">
    Options All
    AllowOverride All
    Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/dcim-error.log
CustomLog ${APACHE_LOG_DIR}/dcim-access.log

...

Let’s create a .htaccess file to restrict access to openDCIM by login and password:

nano /var/www/dcim/.htaccess

AuthType Basic
AuthName "openDCIM"
AuthUserFile /var/www/opendcim.password
Require valid-user

Let’s create a user, activate the necessary modules, the default-ssl template and restart apache2:

htpasswd -cb /var/www/opendcim.password dcim dcim
a2enmod ssl
a2enmod rewrite
a2ensite default-ssl
service apache2 restart

Set the desired language for the web interface, for example Russian (after that you can select it):

locale-gen ru_RU

Let’s check if there are any errors by opening https: //HOSTNAME/install.php, if not, then delete the install.php file:

rm install.php

Done.

Join the Conversation

1 Comment

Leave a Reply

  1. Starting with MySQL 8 you no longer can (implicitly) create a user using the GRANT command. Use CREATE USER instead, followed by the GRANT statement: