Ricerca nel sito web

Come installare il software di gestione delle risorse di inventario OCS su Ubuntu 20.04 LTS


Su questa pagina

  1. Prerequisiti
  2. Per iniziare
  3. Installa il server LAMP
  4. Installa Perl e i moduli richiesti
  5. Configura database MariaDB
  6. Scarica e installa l'inventario OCS
  7. Abilita inventario OCS
  8. Accedi all'inventario OCS
  9. Conclusione

OCS Inventory noto anche come \Open Computers and Software Inventory Next Generation\ è una piattaforma di gestione patrimoniale gratuita. Viene utilizzato per gestire le risorse IT in modo più semplice e organizzato. OCS consente di raccogliere l'inventario hardware e software da tutti i dispositivi attivi sulla rete, inclusi router, switch, computer, stampanti e molti altri. Supporta anche molti sistemi operativi tra cui Sun Solaris, IBM AIX, HP-UX, Windows, Linux, MacOS e molti altri.

OCS Inventory è lo strumento migliore per te se stai cercando un sistema di inventario hardware IT per la tua azienda.

In questo tutorial, spiegheremo come installare il server OCS Inventory su Ubuntu 20.04.

Prerequisiti

  • Un server che esegue Ubuntu 20.04.
  • Sul server è configurata una password di root.

Iniziare

Innanzitutto, si consiglia di aggiornare il server all'ultima versione. Puoi aggiornarlo con il seguente comando:

apt-get update -y

Una volta che il tuo server è aggiornato, dovrai installare alcune dipendenze nel tuo server. Puoi installarli tutti con il seguente comando:

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

Una volta installati tutti i pacchetti, puoi procedere al passaggio successivo.

Installa LAMP Server

Innanzitutto, dovrai installare il server Web Apache, il server MariaDB, PHP e altre estensioni PHP richieste nel tuo server. Puoi installarli tutti eseguendo il seguente comando:

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

Una volta installati tutti i pacchetti, modifica il file php.ini e modifica alcune impostazioni consigliate:

nano /etc/php/7.4/apache2/php.ini

Modifica le seguenti impostazioni:

memory_limit = 256M
post_max_size = 100M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago

Salva e chiudi il file quando hai finito.

Installa Perl e i moduli richiesti

L'inventario OCS richiedeva anche l'installazione di Perl e di alcuni moduli Perl nel tuo server. Puoi installarli tutti con il seguente comando:

apt-get 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

Dopo aver installato tutti i moduli, abilitali con il seguente comando:

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

Una volta terminato, puoi procedere al passaggio successivo.

Configura database MariaDB

Successivamente, dovrai creare un database e un utente per l'inventario OCS. Innanzitutto, accedi alla shell MariaDB con il seguente comando:

mysql

Una volta effettuato l'accesso, creare un database e un utente con il seguente comando:

MariaDB [(none)]> CREATE DATABASE ocsdb;
MariaDB [(none)]> CREATE USER 'ocsuser'@'localhost' IDENTIFIED BY 'password';

Successivamente, concedi tutti i privilegi a ocsdb con il seguente comando:

MariaDB [(none)]> GRANT ALL ON ocsdb.* TO 'ocsuser'@'localhost' WITH GRANT OPTION;

Successivamente, svuota i privilegi ed esci dalla shell MariaDB con il seguente comando:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Scarica e installa l'inventario OCS

Innanzitutto, dovrai scaricare l'ultima versione di OCS dal repository Git. Puoi scaricarlo con il seguente comando:

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

Una volta scaricato, cambia la directory in OCSInventory-Server e scarica il progetto ocsreport con il seguente comando:

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

Successivamente, modifica la directory in ocsreports e installa Composer con il seguente comando:

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

Una volta installato Composer, dovresti ottenere il seguente output:

All settings correct for using Composer
Downloading...

Composer (version 1.10.10) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

Successivamente, torna alla directory OCSInventory-Server e modifica il file setup.sh:

cd ..
nano setup.sh

Definisci le impostazioni del database come mostrato di seguito:

# 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="ocsuser"
DB_SERVER_PWD="password"

Salva e chiudi il file quando hai finito.

Successivamente, avvia l'installazione dell'inventario OCS eseguendo il seguente comando:

./setup.sh

Durante l'installazione, ti verranno poste diverse domande. Rispondi a tutte le domande come mostrato di seguito:

+----------------------------------------------------------+
|                                                          |
|  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 /root/OCSInventory-Server
Storing log in file /root/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)?y

+----------------------------------------------------------------------+
|        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 ;-)

Abilita inventario OCS

Successivamente, dovrai anche abilitare il file di configurazione dell'host virtuale di OCS Inventory. Puoi abilitarli con il seguente comando:

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

Successivamente, modifica la proprietà della directory ocsinventory-reports in www-data con il seguente comando:

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

Successivamente, riavvia il servizio Apache per applicare le modifiche:

systemctl restart apache2

Accedi all'inventario OCS

Ora, apri il tuo browser web e digita l'URL http://your-server-ip/ocsreports/install.php. Dovresti vedere la schermata di installazione di OCS Inventory:

Fornisci il database OCS, il nome utente del database, la password e fai clic sul pulsante Invia. Una volta che l'installazione è stata completata con successo, dovresti vedere la seguente schermata:

Fare clic su fare clic qui per accedere alla GUI di OCS-NG. Dovresti vedere la schermata di accesso all'inventario OCS come mostrato di seguito:

Fornire nome utente e password predefiniti come admin/admin e fare clic sul pulsante Invia. Dovresti vedere la dashboard di OCS Inventory nella seguente schermata:

Fare attenzione a modificare la password di accesso predefinita dell'utente admin in una password sicura. Infine, rimuovi il file install.php per eliminare il messaggio di avviso sulla dashboard.

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

Conclusione

Congratulazioni! hai installato correttamente OCS Inventory su Ubuntu 20.04. Ora puoi gestire facilmente le tue risorse IT dal browser web. Non esitate a chiedermi se avete domande.