In today’s world, organizations are moving at the level of increasingly demanding users. To ensure that companies have the right view of things every day, they need to control the assets they have, part of which is computer equipment. We are talking about the inventory of computer equipment.
Inventories are tangible goods held for sale in the ordinary course of business or to be consumed in the production of goods or services for subsequent marketing.
It’s usually a tedious process carried out manually, but thanks to the efforts of some developers, it’s possible to do it automatically and efficiently with OCSInventory.
OCSInventory allows you to collect hardware and software inventory from all active devices on the network, such as computers, switches, routers, network printers and unattended devices. It Supports for multiple operating systems, including Microsoft Windows, Linux, * BSD, Sun Solaris, IBM AIX, HP-UX, MacOS X. It has the ability to support Plugins and integrates seamlessly with GLPI.
Let’s install it!!
First of all we must be root users. We open a terminal and write:
sudo -i
After entering the password we will be root users. Then we installed LAMP Stack.
apt install apache2 php7.2 libapache2-mod-php7.2 php7.2-cli php7.2-common php7.2-cgi mariadb-server mariadb-client php7.2-mysql mariadb-common
Once the installation of the packages is finished we will have a basic web server. Now we proceed to install basic compilation packages.
apt install linux-headers-$(uname -r) build-essential
Next we must install some perl modules needed.
apt install libxml-simple-perl libcompress-raw-zlib-perl libdbi-perl libdbd-mysql-perl libapache-dbi-perl libnet-ip-perl libsoap-lite-perl
Now we write:
cpan -i XML::Entities
We install other necessary php modules.
apt install php7.2-gd php-pclzip
We now proceed to download the OSCInventory.
wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.4.1/OCSNG_UNIX_SERVER_2.4.1.tar.gz
Now we unzip the archive.
tar -xvzf OCSNG_UNIX_SERVER_2.4.1.tar.gz
Now we rename the folder, and move it to our apache root directory:
mv OCSNG_UNIX_SERVER_2.4.1 /var/www/html/OCS
Before starting the installation, we installed other necessary php modules.
apt install php7.2-soap php7.2-curl php7.2-xml php7.2-xmlrpc
Now we enter the directory and run the setup.sh script
cd /var/www/html/OCS
and:
sh setup.sh
Running it will ask us many questions about configuration file locations, executable files and check the installed PERL modules. In the end, if everything went well, we should get the message that the installation was successful.
Before running its web interface, we must copy the apache configuration that the installer creates as a new apache site.
a2enconf ocsinventory-reports
a2enconf z-ocsinventory-server
Finally, we make sure we have permissions on the /var/lib/ocsinventory-reports/ folder and we restart apache.
<strong>chown -R www-data:www-data /var/lib/ocsinventory-reports/ chmod 755 -R /var/www/html/OCS/* systemctl restart apache2 </strong>
Accessing the web interface
Now we can access the web interface from our browser:
http://localhost/OCS/ocsreports
Note: Remember that the path might be different, so it is important to be careful about assigning folder names.
As we can notice, we skip the warning that we can’t build larger 2mb packages, so we must modify that value in the PHP configuration file.
nano /etc/php/7.2/apache2/php.ini
We will modify the parameters: upload_max_filesize and post_max_size
And we restart Apache:
systemctl restart apache2
When accessing again, we notice that the warning continues but 250mb is a suitable value that should not cause problems.
When you click on send, it will take a while to complete the installation and then inform us that we can access with user admin and password admin
By clicking on the link below, we can then log in.
Then when you log in, and check that everything is OK, we must remove the installer. As a recommendation you should change the password for mariadb.
Now we would have to install the agent in each of the computers that we want to inventory.
As a conclusion we can say that OCSInventory is an interesting application in the world of organizations that allows us to have an updated and reliable inventory of all our computer equipment.
Please share this article on your social networks.
Buenas, no se por qué, pero siempre recibo este error al instalar ocs:
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…
*** ERROR: PERL module DBD::mysql is not installed !
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.
*** ERROR: There is one or more required PERL modules missing on your computer !
Please, install missing PERL modules first.
Install them by executing:
cpan -i Apache::DBI
cpan -i DBD::mysql
cpan -i XML::Simple
cpan -i Net::IP
cpan -i SOAP::Lite
cpan -i Archive::Zip
cpan -i Mojolicious
hi, Angeloma,
G’day to you. I just explore the ocsinventory and found your article.
I have issue to install Admin Server after everything, last part failed.
please find the error below and advise. Appreciate you can get back to me ASAP.
============================================================
Installing Administration server
============================================================
Checking for Administration Server directories…
Using directory /usr/share/ocsinventory-reports for static files
Using /var/lib/ocsinventory-reports as writable/cache directory
Checking for DBI PERL module
PERL module DBI is available
Checking for DBD::mysql PERL module
PERL module DBD::mysql is available
Checking for XML::Simple PERL module
PERL module XML::Simple is available
Checking for Net::IP PERL module
PERL module Net::IP is available
Creating PHP directory /usr/share/ocsinventory-reports/ocsreports
Copying PHP files to /usr/share/ocsinventory-reports/ocsreports
cp: cannot stat ‘ocsreports/*’: No such file or directory
Hi, check the location files and try again!
hi, no luck.
FYI, I have reinstall the Ubuntu 18 and setup by following your guide, is missing php mbstring.
Another error i have facing is the database setup having error.
ERROR: Can’t connect to MySQL. Please enter a valid login/password. (host=localhost login=ocs password=ocs)
ERROR: MySql connection problem 1698
Access denied for user ‘ocs’@’localhost’
Previously i have follow all the instruction to create users and also provide privilege, still failed.
Please advise, thanks and appreciate.
Hi, Angeloma,
G’day to you. I managed to installed ocs inventory. As for your article, if possible, do update on the database. Refer to the db, do mention on the create user and grant privileges.
I need to search google on the mariadb article. Then i be able to login ocs mysql.
Hope you be able to update on this details.
Thanks and GOD BLESS.