Installazione di OCS Inventory NG su Debian Lenny

Premessa
Il software OCS Inventory, consente di individuare tutti i dispositivi collegati in rete rilevando la configurazione hardware ed il software installato. OCS Inventory è un’applicazione nata per aiutare i system e network administrator a tenere traccia delle configurazioni hardware dei server e dei computer nella rete aziendale, e del software installato su di essi.

OCS Inventory inoltre è in grado di rilevare qualsiasi altro device sulla rete quali switch, router, stampanti di rete ecc., per ognuno di essi fornisce indirizzo IP e MAC addresses permettondo di effettuarene successivamente una classificazione manuale.

OCS Inventory permette anche di implementare in maniera automatica l’installazione del software sui client. Dalla console di management, è possibile inviare ai client pacchetti di applicazioni da installare, che saranno scaricati via HTTP/HTTPS e lanciati dagli agent del computer.
OCS Inventory consente di gestire dettagliati report per monitorare l’utilizzo dei software installati in modo da ridurre i costi legati alle licenze e garantirne la conformità del parco software, per pianificare gli aggiornamenti e gli interventi di manutenzione.

Il servizio è completamente fruibile attraverso un’interfaccia web in modo da offrire la massima libertà di consultazione e di gestione.

Preparazione del sistema – Installazione di Apache con supporto PHP e MySQL
Dato che il sistema viene gestito tramite web e pagine scritte in PHP, occorre predisporre il nostro sistema in modo tale da soddisfare i requisiti per l’installzione di OCS Inventory, nonchè installare MySQL per archiviare i risultati ottenuti.


apt-get install apache2 libapache2-mod-perl2 libapache2-mod-php5 php5 php5-gd perl libxml-simple-perl libcompress-zlib-perl libdbi-perl libdbd-mysql-perl libapache-dbi-perl mysql-server php-pear php5-dev libnet-ip-perl php5-mysql build-essential libsoap-lite-perl make gcc g++


Nuova password per l'utente «root» di MySQL: root
Ripetere la password per l'utente «root» di MySQL: root

Librerie CPAN
Occorre procedere ad installare la libreria XML::Entities, necessaria per il corretto funzionamento di OCS Inventory.
Procediamo alla sua installazione tramite CPAN.


cpan
install XML::Entities
exit

Installazione di OCS Inventory
Scarichiamo da un mirror l’ultima versione disponibile del software, quindi scompattiamolo e avviamo l’installazione.


cd /tmp
wget http://downloads.sourceforge.net/project/ocsinventory/OCS%20Inventory%20NG/1.02/OCSNG_UNIX_SERVER-1.02.1.tar.gz?use_mirror=garr
tar zxvf OCSNG_UNIX_SERVER-1.02.1.tar.gz
cd OCSNG_UNIX_SERVER-1.02.1
./setup.sh

L’installazione è molto semplice nonchè facilitata dalle domande che ci vengono poste. In pratica basta accettare le risposte di default, ma in alcuni casi per scrupolo ho preferito rispondere manualmente.


+----------------------------------------------------------+
| |
| Welcome to OCS Inventory NG Management server setup ! |
| |
+----------------------------------------------------------+

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/OCSNG_UNIX_SERVER-1.02.1
Storing log in file /root/OCSNG_UNIX_SERVER-1.02.1/ocs_server_setup.log

+———————————————————-+
| Checking for database server properties… |
+———————————————————-+

Your MySQL client seems to be part of MySQL version 5.0.
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/apache2] ?
OK, using Apache daemon /usr/sbin/apache2 ;-)

+———————————————————-+
| 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 [${APACHE_RUN_USER}] ? www-data
OK, Apache is running under user account www-data ;-)

+———————————————————-+
| Checking for Apache group… |
+———————————————————-+

Which user group is running Apache web server [${APACHE_RUN_GROUP}] ? 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.d/.
Setup will put OCS Inventory NG Apache configuration in this directory.
Where is Apache Include configuration directory [//etc/apache2/conf.d/] ? /etc/apache2/conf.d
OK, Apache Include configuration directory /etc/apache2/conf.d found ;-)

+———————————————————-+
| Checking for PERL Interpreter… |
+———————————————————-+

Found PERL Intrepreter at ;-)
Where is PERL Intrepreter binary [/usr/bin/perl] ?
OK, using PERL Intrepreter /usr/bin/perl ;-)

Do you wish to setup Communication server on this computer ([y]/n)? y

+———————————————————-+
| 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 detailled logs. This logs can be enabled
by setting interger 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 ;-)

+———————————————————-+
| 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 optional Perl Modules… |
+———————————————————-+

Checking for SOAP::Lite PERL module…
Found that PERL module SOAP::Lite is available.
Checking for XML::Entities PERL module…
Found that PERL module XML::Entities is available.

+———————————————————-+
| OK, looks good ;-) |
| |
| Configuring Communication server Perl modules… |
+———————————————————-+

Checking if your kit is complete…
Looks good
Writing Makefile for Apache::Ocsinventory

+———————————————————-+
| OK, looks good ;-) |
| |
| Preparing Communication server Perl modules… |
+———————————————————-+

+———————————————————-+
| OK, prepare finshed ;-) |
| |
| Installing Communication server Perl modules… |
+———————————————————-+

+———————————————————-+
| OK, Communication server Perl modules install finished;-)|
| |
| Creating Communication server log directory… |
+———————————————————-+

Creating Communication server log directory /var/log/ocsinventory-server.

Fixing Communication server log directory files permissions.
Configuring logrotate for Communication server.
Removing old communication server logrotate file /etc/logrotate.d/ocsinventory-NG
Writing communication server logrotate to file /etc/logrotate.d/ocsinventory-server

+———————————————————-+
| OK, Communication server log directory created ;-) |
| |
| Now configuring Apache web server… |
+———————————————————-+

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) ? y
OK, using ‘z-ocsinventory-server.conf’ as Communication Server Apache configuration file
Removing old communication server configuration to file /etc/apache2/conf.d/ocsinventory.conf
Writing communication server configuration to file /etc/apache2/conf.d/z-ocsinventory-server.conf

+———————————————————-+
| OK, Communication server setup sucessfully finished ;-) |
| |
| Please, review /etc/apache2/conf.d/z-ocsinventory-server.conf
| to ensure all is good. Then restart Apache daemon. |
+———————————————————-+

Do you wish to setup Administration Server (Web Administration Console)
on this computer ([y]/n)? y

+———————————————————-+
| Checking for Administration Server directories… |
+———————————————————-+

CAUTION: Setup now install files in accordance with Filesystem Hierarchy
Standard. So, no file is installed under Apache root document directory
(Refer to Apache configuration files to locate it).
If you’re upgrading from OCS Inventory NG Server 1.01 and previous, YOU
MUST REMOVE (or move) directories ‘ocsreports’ and ‘download’ from Apache
root document directory.
If you choose to move directory, YOU MUST MOVE ‘download’ directory to
Administration Server writable/cache directory (by default
/var/lib/ocsinventory-reports), especialy if you use deployement feature.

Do you wish to continue ([y]/n)? y
Assuming directories ‘ocsreports’ and ‘download’ removed from
Apache root document directory.

Where to copy Administration Server static files for PHP Web Console
[/usr/share/ocsinventory-reports] ?
OK, using directory /usr/share/ocsinventory-reports to install static files ;-)
Where to create writable/cache directories for deployement packages and
IPDiscover [/var/lib/ocsinventory-reports] ?
OK, writable/cache directory is /var/lib/ocsinventory-reports ;-)

+———————————————————-+
| Checking for required Perl Modules… |
+———————————————————-+

Checking for DBI PERL module…
Found that PERL module DBI is available.
Checking for DBD::mysql PERL module…
Found that PERL module DBD::mysql 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.

+———————————————————-+
| 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.
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.d/ocsinventory-reports.conf

+———————————————————-+
| OK, Administration server installation finished ;-) |
| |
| Please, review /etc/apache2/conf.d/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/OCSNG_UNIX_SERVER-1.02.1/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 his content !

DON’T FORGET TO RESTART APACHE DAEMON !

Enjoy OCS Inventory NG ;-)

Configurazione di OCS Inventory
Ora che abbiamo terminato la procedura d’installazione, occorre apportare delle modifiche al file di configurazione che contiene i paramentri di connessio al database. Io ho utilizzato un’installazione molto semplice e banale tanto per dimostrazione, ovviamente nessuno ci vieta di puntare ad un database esterno alla macchina dove gira OCS Inventory.


nano /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php

Ora siamo pronti per far ripartire Apache in modo tale da rendere attive le modifiche e i moduli installati in precedenza, quindi completare l’installazione.


/etc/init.d/apache2 restart

http://server_ocs/ocsreports

Installazione dell’Agent per Windows
La raccolta dei dati relativi alle macchine è resa possibile da un agent installato su ogni computer.
Per semplificare l’installazione ho scelto di condividere in rete tramite Samba, la directory che contiene l’agent, quindi installarlo sui singoli computer tramite uno script molto semplice da mandare in esecuzione. Nel caso ci sitrovi sotto dominio la cosa sarebbe ancora più semplice, ma non è il mio caso.

Per prima cosa occorre scaricare l’agent per Windows, quindi scompattarlo nella cartella che poi andremo a condividere.


cd /usr/share/ocsinventory-reports
wget http://downloads.sourceforge.net/project/ocsinventory/OCS%20Inventory%20NG/1.02/OCSNG_WINDOWS_AGENT_1.02.zip?use_mirror=garr


unzip OCSNG_WINDOWS_AGENT_1.02.zip
mv OCSNG_WINDOWS_AGENT_1.02 win_agent
rm OCSNG_WINDOWS_AGENT_1.02.zip

Installazione e configurazione di Samba
Come detto prima, utilizzeremo Samba per la condivisio in rete dell’agent da installare.

La sua installazione e configurazione è davvero semplice.


apt-get install samba
Nome del Workgroup/Dominio: WORKGROUP
Modificare smb.conf per usare le impostazioni WINS da DHCP? No

Utilizziamo la configurazione qui di seguito, che è molto scarna visto il nostro scopo.
Rimuoviamo il file di configurazione fornito con Samba e ricreiamolo con la nostra.


rm /etc/samba/smb.conf
nano /etc/samba/smb.conf


[global]
workgroup = CED
server string = %h server
# wins support = no
# wins server = w.x.y.z
dns proxy = no
; name resolve order = lmhosts host wins bcast
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
security = share
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
pam password change = yes
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

#======================= Share Definitions =======================
[win_agent]
comment = OCS-Invetory Agent for Windows
read only = yes
path = /usr/share/ocsinventory-reports/win_agent
guest ok = yes

Ora possiamo riavviare Samba per rendere effettive le modifiche appena apportate.

/etc/init.d/samba restart

Installazione dell’agent
Lo script qui di seguito consente l’installazione via rete dell’agent già preconfigurato con i parametri del server OCS Inventory.
L’installazione parte in background ed impiega pochi attimi per completarsi, il tutto in maniera trasparente all’utente.
L’invio dei dati al server avviene praticamente subito dopo l’installazione dell’agent.


\\192.168.0.10\win_agent\OcsAgentSetup.exe /NOSPLASH /SERVER:192.168.0.10 /np /S

Accesso a OCS Inventory
Come già detto, il tutto è fruibile via web, quindi apriamo il nostro bowser e puntiamo all’url http://server_ocs/ocsinventory. Effettuiamo l’accesso al sistema con username e passowrd ‘admin’ per cominciare a visualizzare i dati inviati dagli agent appena installati.

  • Facebook
  • Google Bookmarks
  • Windows Live Favorites
  • LinkedIn
  • Delicious
  • Hotmail
  • Twitter
  • Windows Live Spaces
  • Yahoo Bookmarks
  • Yahoo Messenger
  • Share/Bookmark

Spam Protection by WP-SpamFree