29 C
Texas

How to Install OCS Inventory Server on Ubuntu 20.04

In this tutorial, you’ll learn that how to Install OCS Inventory Server On Ubuntu 20.04. Before proceeding towards the installation process, let’s have a short introduction.

Introduction:

OCS Inventory is known as Open Computers & Software Inventory Next Generation. OCS provides you the facility of collecting and managing the hardware & software inventory from all of your devices. With the help of OCS you can collect hardware & software inventory from active devices on the network. These devices can be routers, switches, computers, printers etc. It is the best asset managment platform for IT devices that provides you the simpler and organized solution. However, it also supports the many operating system including Sun Solaris, IBM AIX, HP-UX, Windows, Linux, MacOS and many more.

So, here we’ll see the easy and optimal installation of OCS Inventory Server on Ubuntu 20.04

Step 1: Update Your System

First of all update your system to have the latest updates installed.

- Advertisement -
sudo apt update -y

Install some extra packages with the help of below command.

sudo apt install make cmake gcc make git curl unzip -y

Once installed move towards the next step.

Step 2: Install LAMP Server On Ubuntu 20.04

Install the Webserver, Database server and the PHP with required extensions by hitting the below command in your terminal.

sudo apt-get install apache2 mariadb-server libapache2-mod-perl2 libapache-dbi-perl libapache-db-perl php7.4 libapache2-mod-php7.4 php7.4-common php7.4-sqlite3 php7.4-mysql php7.4-gmp php7.4-curl php7.4-mbstring php7.4-gd php7.4-cli php7.4-xml php7.4-zip php7.4-soap php7.4-json php-pclzip composer

After installing all these packages, edit the php.ini file and change the timezone, memory limit and file upload size as given below:

memory_limit = 256M
post_max_size = 100M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = Asia/Karachi

Tjen save & exit the file.

Step 3: Install Perl & its Modules

OCS require Perl & some Perl modules, so install the required packages with the help of below command.

sudo apt install perl libxml-simple-perl libcompress-zlib-perl libdbi-perl libdbd-mysql-perl libnet-ip-perl libsoap-lite-perl libio-compress-perl libapache-dbi-perl libapache2-mod-perl2 libapache2-mod-perl2-dev -y

Once the installation finished, enable the installed modules by hitting the below command in your terminal.

sudo perl -MCPAN -e 'install Apache2::SOAP'
sudo perl -MCPAN -e 'install XML::Entities'
sudo perl -MCPAN -e 'install Net::IP'
sudo perl -MCPAN -e 'install Apache::DBI'
sudo perl -MCPAN -e 'install Mojolicious'
sudo perl -MCPAN -e 'install Switch'
sudo perl -MCPAN -e 'install Plack::Handler'

Step 4: Configure MariaDB Server

We’ll use MariaDB for Database server, you can select your desired one. So, login to the MariaDB and do the following changes.

sudo mysql
MariaDB [(none)]> CREATE DATABASE ocsdb;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> CREATE USER 'userocs'@'localhost' IDENTIFIED BY 'Your_Password';
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> GRANT ALL ON ocsdb.* TO 'userocs'@'localhost' WITH GRANT OPTION;
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> EXIT;
Bye

Step 5: Download & Install OCS Inventory

Download the latest version of OCS Inventory from the Git.

git clone https://github.com/OCSInventory-NG/OCSInventory-Server.git

Then switch to the OCSInventory-Server directory and clone the ocsreport project by typing

cd OCSInventory-Server
git clone https://github.com/OCSInventory-NG/OCSInventory-ocsreports.git ocsreports

And switch to the ocsreports directory then install the composer.

cd ocsreports
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

On successful installation, you’ll see the following output.

All settings correct for using Composer
Downloading…
Composer (version 2.0.4) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

Now, switch back to the OCSInventory-Server directory and modify the setup.sh file.

cd ..
sudo nano setup.sh

Provide Your Database details as shown below:

Which host run database server
DB_SERVER_HOST="localhost"
On which port run database server
DB_SERVER_PORT="3306"
Database server credentials
DB_SERVER_USER="userocs"
DB_SERVER_PWD="ocspassword"

Then save and exit the file.

Finally hit the below command to begin the installation of OCS Inventory.

sudo ./setup.sh

Provide the answer of asked question during the installation as listed below:

sabi@Ubuntu20:~/OCSInventory-Server$ sudo ./setup.sh
+----------------------------------------------------------+
| |
| Welcome to OCS Inventory NG Management server setup ! |
| |
+----------------------------------------------------------+
Trying to determine which OS or Linux distribution you use
+----------------------------------------------------------+
| Checking for Apache web server binaries ! |
+----------------------------------------------------------+
CAUTION: If upgrading Communication server from OCS Inventory NG 1.0 RC2 and
previous, please remove any Apache configuration for Communication Server!
Do you wish to continue ([y]/n)?y
Assuming Communication server 1.0 RC2 or previous is not installed
on this computer.
Starting OCS Inventory NG Management server setup from folder /home/sabi/OCSInventory-Server
Storing log in file /home/sabi/OCSInventory-Server/ocs_server_setup.log
+----------------------------------------------------------+
| Checking for database server properties… |
+----------------------------------------------------------+
Your MySQL client seems to be part of MySQL version 10.3.
Your computer seems to be running MySQL 4.1 or higher, good ;-)
Which host is running database server [localhost] ?
OK, database server is running on host localhost ;-)
On which port is running database server [3306] ?
OK, database server is running on port 3306 ;-)
+----------------------------------------------------------+
| Checking for Apache web server daemon… |
+----------------------------------------------------------+
Where is Apache daemon binary [/usr/sbin/apache2ctl] ?
OK, using Apache daemon /usr/sbin/apache2ctl ;-)
+----------------------------------------------------------+
| Checking for Apache main configuration file… |
+----------------------------------------------------------+
Where is Apache main configuration file [/etc/apache2/apache2.conf] ?
OK, using Apache main configuration file /etc/apache2/apache2.conf ;-)
+----------------------------------------------------------+
| Checking for Apache user account… |
+----------------------------------------------------------+
Which user account is running Apache web server [www-data] ?
OK, Apache is running under user account www-data ;-)
+----------------------------------------------------------+
| Checking for Apache group… |
+----------------------------------------------------------+
Which user group is running Apache web server [www-data] ?
OK, Apache is running under users group www-data ;-)
+----------------------------------------------------------+
| Checking for Apache Include configuration directory… |
+----------------------------------------------------------+
Setup found Apache Include configuration directory in
/etc/apache2/conf-available.
Setup will put OCS Inventory NG Apache configuration in this directory.
Where is Apache Include configuration directory [/etc/apache2/conf-available] ?
OK, Apache Include configuration directory /etc/apache2/conf-available found ;-)
+----------------------------------------------------------+
| Checking for PERL Interpreter… |
+----------------------------------------------------------+
Found PERL interpreter at ;-)
Where is PERL interpreter binary [/usr/bin/perl] ?
OK, using PERL interpreter /usr/bin/perl ;-)
Do you wish to setup Communication server on this computer ([y]/n)?
+----------------------------------------------------------+
| Checking for Make utility… |
+----------------------------------------------------------+
OK, Make utility found at ;-)
+----------------------------------------------------------+
| Checking for Apache mod_perl version… |
+----------------------------------------------------------+
Checking for Apache mod_perl version 1.99_22 or higher
Found that mod_perl version 1.99_22 or higher is available.
OK, Apache is using mod_perl version 1.99_22 or higher ;-)
+----------------------------------------------------------+
| Checking for Communication server log directory… |
+----------------------------------------------------------+
Communication server can create detailed logs. This logs can be enabled
by setting integer value of LOGLEVEL to 1 in Administration console
menu Configuration.
Where to put Communication server log directory [/var/log/ocsinventory-server] ?
OK, Communication server will put logs into directory /var/log/ocsinventory-server ;-)

Step 6: Enable & Access OCS Inventory Server On Ubuntu 20.04

Hit the below commands in your terminal to enalbe OCS Inventory.

sudo ln -s /etc/apache2/conf-available/ocsinventory-reports.conf /etc/apache2/conf-enabled/ocsinventory-reports.conf
sudo ln -s /etc/apache2/conf-available/z-ocsinventory-server.conf /etc/apache2/conf-enabled/z-ocsinventory-server.conf
sudo ln -s /etc/apache2/conf-available/zz-ocsinventory-restapi.conf /etc/apache2/conf-enabled/zz-ocsinventory-restapi.conf

And change the permissions.

sudo chown -R www-data:www-data /var/lib/ocsinventory-reports

Then restart the Apache Server.

sudo systemctl restart apache2

Now, open your browser and type IP/ocsreports/install.php.

How to Install OCS Inventory Server on Ubuntu 20.04

Provide the mentioned details and click “Send” button. On successful installtion you’ll see the similar output.

How to Install OCS Inventory Server on Ubuntu 20.04

Now, click on “Click here to enter OCS-NG GUI.” You’ll be redirected to the OCS Inventory login screen. Provide credentials as admin admin to go to the dashbord.

How to Install OCS Inventory Server on Ubuntu 20.04

Note: For security reasons, change the default password.

And then remove the install.php file if you don’t want to get alert messages on dashboard.

rm -f /usr/share/ocsinventory-reports/ocsreports/install.php

So, this is how you can install OCS Inventory Server on Ubuntu 20.04.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

4 COMMENTS

  1. I had the same problem. It comes from the the installation renaming ocsinventory-server.conf to z-ocsinventory-server.conf so it can load the perl module before lauching the communication server.

    Just launch back the setup.sh and input no to this question (Almost at the end of the installation)

    To ensure Apache loads mod_perl before OCS Inventory NG Communication Server,
    Setup can name Communication Server Apache configuration file
    ‘z-ocsinventory-server.conf’ instead of ‘ocsinventory-server.conf’.
    Do you allow Setup renaming Communication Server Apache configuration file
    to ‘z-ocsinventory-server.conf’ ([y]/n) ?n

    Hope it helped you, at least it worked for me.

  2. There is a line missing in your guide. After installing Composer, you should run it using “sudo composer install”. Otherwise, you get the Error 500.

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article