Install ocsinventory-ng and glpi on FreeBSD

Recent search for finding solution for inventory computer in the school lead me to interesting url :

http://www.ocsinventory-ng.org/

From their architecture page :

“OCS Inventory NG uses an agent, which runs the inventory on client computers, and a management server, which centralizes inventory results, allow viewing inventory results and creating deployment packages.”

arsitektur_ocs

Very interesting software. After think a little bit I decide to try to install it on one of FreeBSD jail.

(In case you have old FreeBSD iso, you can try different version that works).

Here’s the steps :

1. Install database server

cd /usr/ports/databases/mysql50-server/ && make install

2. Install ocsinventory-ng

cd /usr/ports/net-mgmt/ocsinventory-ng/ && make install

3. Install logrotate

cd /usr/ports/sysutils/logrotate && make install

mkdir /etc/logrotate.d

mkdir /etc/logrotate.d/ocsinventory-NG

cd /usr/ports/net-mgmt/ocsinventory-ng/work/OCSNG_LINUX_SERVER_1.01

./setup.sh

That step will initiate checking screen.

+———————————————————-+
|                                                          |
| 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 /usr/ports/net-mgmt/ocsinventory-ng/work/OCSNG_LINUX_SERVER_1.01
Storing log in file /usr/ports/net-mgmt/ocsinventory-ng/work/OCSNG_LINUX_SERVER_1.01/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/local/sbin/httpd] ?
OK, using Apache daemon /usr/local/sbin/httpd 😉

+———————————————————-+
| Checking for Apache main configuration file…           |
+———————————————————-+
Where is Apache main configuration file [/usr/local/etc/apache/httpd.conf] ?
OK, using Apache main configuration file /usr/local/etc/apache/httpd.conf 😉

+———————————————————-+
| Checking for Apache user account…                      |
+———————————————————-+

Which user account is running Apache web server [www] ?
OK, Apache is running under user account www 😉

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

Which user group is running Apache web server [www] ?
OK, Apache is running under users group www 😉

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

Found PERL Intrepreter at </usr/bin/perl> 😉
Where is PERL Intrepreter binary [/usr/bin/perl] ?
OK, using PERL Intreprethttp://prdownloads.sourceforge.net/ocsinventory/OCSNG_WIN32_AGENT_1.01_repack.zip?downloader /usr/bin/perl 😉

+———————————————————-+
| Checking for Make utility…                             |
+———————————————————-+

OK, Make utility found at </usr/bin/make> 😉

+———————————————————-+
| Checking for Apache Include configuration directory…   |
+———————————————————-+

Setup has found Apache Include configuration directory in
.
If you are not using Include directive, please enter ‘no’.
Where is Apache Include configuration directory [] ?
Not using Apache Include configuration directory.
Configuration will be written to Apache main configuration file
/usr/local/etc/apache/httpd.conf.

+———————————————————-+
| Checking for Apache mod_perl version…                  |
+———————————————————-+

Checking for Apache mod_perl version 1.99_22 or higher
Checking for Apache mod_perl version 1.99_21 or previous
Found that mod_perl version 1.99_21 or previous is available.
OK, Apache is using mod_perl version 1.99_21 or previous 😉

+———————————————————-+
| 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-NG] ?

+———————————————————-+
| 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.

+———————————————————-+
| 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-NG.

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

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

Setup is not able to replace existing configuration in file
/usr/local/etc/apache/httpd.conf.
But for a fresh install, setup is able to add this configuration.
Do you wish setup add Communication server configuration to file
/usr/local/etc/apache/httpd.conf (y/[n]) ?y
Adding Communication server configuration to end of file /usr/local/etc/apache/httpd.conf…

+———————————————————-+
| OK, Communication server setup sucessfully finished ;-)  |
|                                                          |
| Please, review /usr/local/etc/apache/httpd.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 Apache root document directory…           |
+———————————————————-+

Where is Apache root document directory [] ?/usr/local/www

+———————————————————-+
| 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 directory /usr/local/www/download.

Creating directory /usr/local/www/ocsreports.

Copying files to /usr/local/www/ocsreports.

Fixing directories and files permissions.

Configuring IPDISCOVER-UTIL Perl script.

Installing IPDISCOVER-UTIL Perl script.

Fixing permissions on IPDISCOVER-UTIL Perl script.

+———————————————————-+
| OK, Administration server installation finished ;-)      |
|                                                          |
| Point your browser to http://server/ocsreports to        |
| configure database server and create/update schema.      |
+———————————————————-+

Setup has created a log file /usr/ports/net-mgmt/ocsinventory-ng/work/OCSNG_LINUX_SERVER_1.01/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 😉

At this step ocsinventory-ng successfully installed.

4. Create database for ocsinventory

# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.77 FreeBSD port: mysql-server-5.0.77

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> create database ocsweb
-> ;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on ocsweb.* to ocs@localhost identified by ‘ocs’ with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql>
5. Setting from web base

Open http://172.88.1.73/ocsreports/

Message displayed ::


WARNING: OpenSSL for PHP is not properly installed.
Some automatic deployment features won’t be available
Try uncommenting “;extension=php_openssl.dll” (windows) by removing the semicolon in file php.ini, or try installing the php4-openssl package (Linux).

WARNING: You will not be able to build any auto deployment package with size greater than 2M.
You must raise both post_max_size and upload_max_filesize in your php.ini to correct this. ”

Correction:

cd /usr/ports/security/php5-openssl && make install

restart apache and see the message ::

6. Follow the message

OCS Inventory Installation

WARNING: You will not be able to build any auto deployment package with size greater than 32M.
You must raise both post_max_size and upload_max_filesize in your php.ini to correct this.

MySql config file successfully written

Please wait, database update may take up to 30 minutes………………………………………………………………………….

Existing database updated

Database engine checking……………………

Database engine successfully updated (1 table(s) altered)

WARNING: files/ocsagent.exe missing, if you do not reinstall the DEPLOY feature won’t be available

Table ‘files’ was empty

No subnet.csv file to import

Network netid computing. Please wait…

Network netid was computed=> 0 successful, 0 were already computed, 0 were not computable

Netmap netid computing. Please wait…

Netmap netid was computed=> 0 successful, 0 were already computed, 0 were not computable

Cleaning orphans…………………

0 orphan lines deleted

Cleaning netmap…

0 netmap lines deleted

Please enter the label of the windows client tag input box:
(Leave empty if you don’t want a popup to be shown on each agent launch).

Label NOT added (not tag will be asked on client launch)

Installation finished you can log in index.php with login=admin and pass=admin

Click here to enter OCS-NG GUI
7.  Install glpi

cd /usr/ports/www/glpi/ && make install

Create database and grant access to glpi

# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 102
Server version: 5.0.77 FreeBSD port: mysql-server-5.0.77

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> create database glpi;
Query OK, 1 row affected (0.05 sec)

mysql> grant all privileges on glpi.* to glpi@localhost identified by ‘glpi’ with grant option;
Query OK, 0 rows affected (0.08 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql>

Edit httpd.conf and add these lines :

<Directory /usr/local/www/glpi>
AllowOverride Options FileInfo
</Directory>

Restart apache and open the glpi address :

http://172.88.1.73/glpi

Follow the procedure :

Make sure all (requirements) in perfect  state:

Checking of the compatibility of your environment with the execution of GLPI
Test done    Results
Testing PHP Parser    PHP version is at least 4.x – Perfect !
Mysql extension test.    Ok – the function mysql_query() exist – Perfect !
Sessions Test    Sessions support is available – Perfect !
Test if Session_use_trans_sid is used    Ok – the sessions works (no problem with trans_id) – Perfect !
magic_quotes_sybase extension test    The magic_quotes_sybase option isn’t active on your server – Perfect !
Testing utf8_encode and utf8_decode functionality    The functionality is found – Perfect!
Allocated memory test    Allocated memory > 32M – Perfect !
Checking write permissions for dump files    A file and a directory have be created and deleted – Perfect !
Checking write permissions for document files    A file and a directory have be created and deleted – Perfect !
Checking write permissions for setting files    A file and a directory have be created and deleted – Perfect !
Checking write permissions for session files    A file and a directory have be created and deleted – Perfect !
Checking write permissions for cron files    A file and a directory have be created and deleted – Perfect !
Checking write permissions for cache files    A file and a directory have be created and deleted – Perfect !
Test of writing files of log    A file and a directory have be created and deleted – Perfect !

Follow the screen till you’ll see this :

The installation is finished

Default logins / passwords are:

* glpi/glpi for the administrator account
* tech/tech for the technician account
* normal for the normal account
* post-only/post-only for the postonly account

You can delete or modify these accounts as well as the first entries in the database.

Tomorrow, I’ll continue to explore this software.

Tags: