Installing OCS Inventory NG on Ubuntu Server

OCS Inventory NG is an open source inventory tool which allows you to manage and monitor devices and software in your network. In order to install OCS Inventory NG on Ubuntu, follow the steps below.

Pre-requisites

Before we begin with the installation procedure, make sure that:

Installation

We’ll now go through the steps needed to install OCS Inventory NG.

Step 1: Update the system

Start by updating your Ubuntu server to ensure that you have the latest packages installed making use of the following command:

sudo apt update && sudo apt upgrade

Step 2: Apache/PHP and MySQL Installation

For OCS Inventory NG to operate appropriately, we need to install the web server (e.g. Apache), PHP, and MySQL. Run the following command to install each of them:

sudo apt install apache2 php mysql-server php-mysql

Step 3: Install additional dependencies and OCS Inventory NG itself

Now that our framework is set, we need to proceed by installing additional dependencies which will operate alongside our OCS Inventory NG. Run the following command to install them:

sudo apt install libapache2-mod-perl2 libapache-db-perl libapache2-mod-php libxml-simple-perl libnet-ip-perl libsoap-lite-perl libarchive-zip-perl libdbi-perl libdbd-mysql-perl make build-essential libxml2-dev libssl-dev

After installing the above dependencies, we can now proceed to installing OCS Inventory NG.

Run the following commands to install OCS Inventory NG:

cd /tmp
sudo wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.8/OCSNG_UNIX_SERVER_2.8.tar.gz
sudo tar xvf OCSNG_UNIX_SERVER_2.8.tar.gz
cd OCSNG_UNIX_SERVER_2.8/
sudo ./setup.sh

Step 4: Setup Database and User

After successfully installing OCS Inventory NG, the next step is to create a user and database for it.

First, log into the MySQL server:

sudo mysql -u root -p

Create a user and database for OCS Inventory NG. Replace [password] with a secure password of your choice.

CREATE DATABASE ocsweb;
GRANT ALL ON ocsweb.* to 'ocsuser'@'localhost' IDENTIFIED BY '[password]';

Step 5: Configure OCS Inventory NG

Now that everything is installed, we need to configure our OCS Inventory NG. Go to the location /etc/apache2/conf-available/z-ocsinventory-server.conf and open the file using a text editor such as Nano:

sudo nano /etc/apache2/conf-available/z-ocsinventory-server.conf

Update the file to include the following content:

<Directory /usr/share/ocsinventory-reports/ocsreports>
  Options FollowSymLinks
  AllowOverride None
  Require all granted
  AddHandler perl-script .pl
  PerlResponseHandler ModPerl::Registry
  PerlOptions +ParseHeaders
  PerlSendHeader On
  SetHandler perl-script
  PerlSetVar OCS_OPT_LOGFILE /var/log/ocsinventory-server/ocsinventory-server.log
  PerlSetVar OCS_OPT_SSL 0
</Directory>

Step 6: Enable Apache configuration and restart Apache

We need to enable the OCS Inventory NG Apache configuration we’ve created in the previous step, then restart the Apache service to apply the changes.

Run the following command to enable the OCS Inventory NG Apache configuration:

sudo a2enconf z-ocsinventory-server

Now restart the Apache service to apply the changes:

sudo systemctl restart apache2

Step 7: Accessing OCS Inventory NG

Finally, OCS Inventory NG is installed and configured, and we can access it from the web browser. To access it, go to http://[server-ip]/ocsreports. Log in to the web page using the default credentials:

You will immediately be required to change the credentials. After changing the credentials, you’ll be able to use OCS Inventory NG to manage and monitor your devices.

Conclusion

In this guide, we installed OCS Inventory NG from the source code on Ubuntu Server Latest, configured Apache to use it, and made a user and database to use with it. After completing the procedure, we can now access OCS Inventory NG through a browser.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!