How to install OCS inventory server on Debian 10 / Debian 9

How to install OCS Inventory Server on a Debian 10 / Debian 9 Linux server? OCS Inventory is an open source software for managing your IT assets in a simpler and more organized way. It has a client-server model in which OCS Inventory NG requires its agents to understand the software and hardware components of each computer or server.

It can also use IP discovery to discover network elements that cannot receive proxies. SNMP is then used to complete the data retrieved from the IP Discover scan. This is very useful for printers, scanners, routers, etc.

Following are the software requirements for installing OCS Inventory Server on Debian Linux.

  • MySQL server
  • Pell
  • Apache web server
  • Apache Mod_perl
  • PHP with ZIP support enabled.
  • Apache Mod_php
  • Perl module XML :: Simple
  • Perl module Compress :: Zlib
  • Perl module DBI
  • Perl module DBD :: Mysql
  • Perl module Apache :: DBI
  • Perl module Net :: IP
  • Perl module Archive :: Zip
  • Perl module Apache2: SOAP
  • Perl module SOAP :: Lite
  • Perl module XML :: Entities

Step 1: Install MySQL Server, make and gcc

Instead of installing MySQL server, install MariaDB. For information on installing MariaDB on Debian, see the guide below:

Install MariaDB server on Debian

To install make and gcc, run:

sudo apt update
sudo apt -y install git make cmake gcc make build-essential

Step 2: Install Apache Web Server

To install Apache and required modules on Debian, run the following command:

sudo apt -y install libapache2-mod-perl2 libapache-dbi-perl libapache-db-perl libapache2-mod-php 

Step 3: Install PHP and php-zip modules

We also need to install the php and php-zip modules.

sudo apt -y install php php-zip php-pclzip php-gd php-mysql php-soap php-curl php-json php-xml php-mbstring

Step 4: Install Perl and all required modules

You can install Perl and all its modules by running:

sudo apt -y 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 libdbd-mysql-perl libnet-ip-perl libxml-simple-perl libarchive-zip-perl 
sudo cpan install XML::Entities Apache2::SOAP Net::IP Apache::DBI Mojolicious Switch Plack::Handler Archive::Zip

Step 5: Create the OCS inventory database

Log in to the MariaDB database as the root user and create a database for OCS:

$ mysql -u root -p
CREATE DATABASE ocs;
GRANT ALL PRIVILEGES ON ocs.* TO [email protected] IDENTIFIED BY "StrongDBPassword";
FLUSH PRIVILEGES;
QUIT;

Step 6: Install OCS Inventory Server

Clone the project from Github:

$ git clone https://github.com/OCSInventory-NG/OCSInventory-Server.git
Cloning into 'OCSInventory-Server'…
remote: Enumerating objects: 7473, done.
remote: Total 7473 (delta 0), reused 0 (delta 0), pack-reused 7473
Receiving objects: 100% (7473/7473), 52.59 MiB | 1.23 MiB/s, done.
Resolving deltas: 100% (5309/5309), done.

Change to the clone directory.

$ cd OCSInventory-Server/
$ git clone https://github.com/OCSInventory-NG/OCSInventory-ocsreports.git ocsreports
Cloning into 'ocsreports'…
remote: Enumerating objects: 29, done.
remote: Counting objects: 100% (29/29), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 28646 (delta 9), reused 22 (delta 9), pack-reused 28617
Receiving objects: 100% (28646/28646), 81.96 MiB | 1.06 MiB/s, done.
Resolving deltas: 100% (18118/18118), done.

Edit setup.sh Script to change MySQL credentials:

DB_SERVER_HOST="localhost"
DB_SERVER_PORT="3306"
DB_SERVER_USER="ocs"
DB_SERVER_PWD="StrongDBPassword"

If you are using a remote database server, change DB_SERVER_HOST About it. You can modify other changes to your liking and start the installation process while running the script.

$ 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
....

Which host is running database server [localhost] ? 
On which port is running database server [3306] ?

Agree to all options to complete the setup. Make sure all Perl checks are successful.

.....................
+----------------------------------------------------------+
 | Checking for required Perl Modules…                    |
 +----------------------------------------------------------+
 Checking for DBI PERL module…
 Found that PERL module DBI is available.
 Checking for Apache::DBI PERL module…
 Found that PERL module Apache::DBI is available.
 Checking for DBD::mysql PERL module…
 Found that PERL module DBD::mysql is available.
 Checking for Compress::Zlib PERL module…
 Found that PERL module Compress::Zlib is available.
 Checking for XML::Simple PERL module…
 Found that PERL module XML::Simple is available.
 Checking for Net::IP PERL module…
 Found that PERL module Net::IP is available.
 Checking for SOAP::Lite Perl module…
 Found that PERL module SOAP::Lite is available.
 Checking for Archive::Zip Perl module…
 Found that PERL module Archive::Zip is available.
 +----------------------------------------------------------+
 |         Checking for optional Perl Modules…            |
 +----------------------------------------------------------+
 Checking for Apache2::SOAP PERL module…
 Found that PERL module SOAP::Apache2 is available.
 Checking for XML::Entities PERL module…
 Found that PERL module XML::Entities is available.
 Do you wish to setup Rest API server on this computer ([y]/n)? y
 +----------------------------------------------------------+
 | Checking for REST API Dependencies …                       |
 +----------------------------------------------------------+
 Found that PERL module Mojolicious::Lite is available.
 Found that PERL module Switch is available.
 Found that PERL module Plack::Handler is available.
 +----------------------------------------------------------+
 | Configuring REST API Server files …                        |
 +----------------------------------------------------------+

If the installation was successful, you should get a message:

+----------------------------------------------------------+
 |      Installing files for Administration server…       |
 +----------------------------------------------------------+
 Creating PHP directory /usr/share/ocsinventory-reports/ocsreports.
 Copying PHP files to /usr/share/ocsinventory-reports/ocsreports.
 Fixing permissions on directory /usr/share/ocsinventory-reports/ocsreports.
 Creating database configuration file /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php.
 Creating IPDiscover directory /var/lib/ocsinventory-reports/ipd.
 Fixing permissions on directory /var/lib/ocsinventory-reports/ipd.
 Creating packages directory /var/lib/ocsinventory-reports/download.
 Fixing permissions on directory /var/lib/ocsinventory-reports/download.
 Creating snmp mibs directory /var/lib/ocsinventory-reports/snmp.
 Fixing permissions on directory /var/lib/ocsinventory-reports/snmp.
 Creating Administration server log files directory /var/lib/ocsinventory-reports/logs.
 Fixing permissions on directory /var/lib/ocsinventory-reports/logs.
 Creating Administration server scripts log files directory /var/lib/ocsinventory-reports/scripts.
 Fixing permissions on directory /var/lib/ocsinventory-reports/scripts.
 Configuring IPDISCOVER-UTIL Perl script.
 Installing IPDISCOVER-UTIL Perl script.
 Fixing permissions on IPDISCOVER-UTIL Perl script.
 Writing Administration server configuration to file /etc/apache2/conf-available/ocsinventory-reports.conf
 +----------------------------------------------------------------------+
 |        OK, Administration server installation finished ;-)           |
 |                                                                      |
 | Please, review /etc/apache2/conf-available/ocsinventory-reports.conf
 |          to ensure all is good and restart Apache daemon.            |
 |                                                                      |
 | Then, point your browser to http://server//ocsreports
 |        to configure database server and create/update schema.        |
 +----------------------------------------------------------------------+
 Setup has created a log file /root/OCSInventory-Server/ocs_server_setup.log. Please, save this file.
 If you encounter error while running OCS Inventory NG Management server,
 we can ask you to show us its content !
 DON'T FORGET TO RESTART APACHE DAEMON !
 Enjoy OCS Inventory NG ;-)

Step 7: Configure the OCS inventory server

After installing OCS, it will generate an Apache configuration file for you. You need to enable this feature by creating an alias:

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

If you need a REST API, also add:

sudo ln -s /etc/apache2/conf-available/zz-ocsinventory-restapi.conf /

Restart the Apache server

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

Edit /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php And add the name and password of the user created for MySQL. If you have modified setup.sh With the correct credentials, they will appear.

Open the following URL in your browser, check the information, and click Send:

Provide the previously created database credentials and click send.

How to install OCS inventory server on Debian 10 / Debian 9

Click ”Click here to enter OCS-NG GUI ” Link to get the dashboard.

How to install OCS inventory server on Debian 10 / Debian 9

confirm”Perform update ” information.

For security reasons, move the following to a location that is not accessible by the network

sudo mv /usr/share/ocsinventory-reports/ocsreports/install.php 
/usr/share/ocsinventory-reports/ocsreports/install.php.bak

Enable clients to update management TAG edits /etc/apache2/conf.d/z-ocsinventory-server.conf And change the following instructions 0 to 1

PerlSetEnv OCS_OPT_ACCEPT_TAG_UPDATE_FROM_CLIENT 1

Step 8: Access the web interface

After successful installation, access the web dashboard.

http://$server_ip_address/ocsreports

How to install OCS inventory server on Debian 10 / Debian 9

The default login credentials are:

Username: admin
Password: admin

Change administrator password by navigating Settings> My Account> Password.

How to install OCS inventory server on Debian 10 / Debian 9

Provide a new password and click the OK button. Here you can browse the OCS list and start entering data into it.

Similar articles:

Install ERPNext ERP system on Debian 10 (Buster)

Top rated AWS Cloud certification preparation

Best LPIC-1 and LPIC-2 Certified Study Books

Best CCNA Security (210-260) Certification Study Books

Sidebar