How To Install OCS Inventory NG Server 2 On CentOS 5.5

This article explains how to install OCS Inventory NG Server 2 on Linux Server. Prepared by Rafael Marangoni, from BRLink Consultoria Linux Team.

 

Introduction

OCS Inventory is a great software to make inventories. The NG Server is formed by: communication server, deployment server, and administration console. Click here to know how it works.

The computers that will be inventoried must run an agent (installed on each computer), to connect to the OCS NG Server. We are using the CentOS 5.5 (64bits) distribution, but it will probably work on Fedora (and Red Hat, for sure).

 

1 Some Prerequisites

Installing MySQL Server

We need to install it (if it's not already installed):

yum install mysql-server php-mysql php-pecl-zip php-gd

Starting MySQL:

/etc/init.d/mysqld start
chkconfig --level 35 mysqld on

Setting a root password on mysql:

/usr/bin/mysqladmin -u root password 'secret'

 

Starting Apache:

We need to start Apache (OCS uses it):

/etc/init.d/httpd start
chkconfig --level 35 httpd on

 

Installing Packages

Next, we need to install EPEL repository:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

Afterwards, let's install the packages:

yum install -y perl-XML-Simple perl-Compress-Zlib perl-DBI perl-DBD-MySQL perl-Net-IP perl-XML-Entities perl-Apache-DBI perl-Apache2-SOAP perl-SOAP-Lite mod_perl

 

Configure PHP

Edit the /etc/php.ini file, and change the following lines:

vi /etc/php.ini
post_max_size = 200M
upload_max_filesize = 200M

Restart Apache:

/etc/init.d/httpd restart

 

2 Installing OCS Inventory NG Server 2

First, we need to download the tarball from OCS Inventory website. Click here.

mkdir /download
cd /download
wget http://launchpad.net/ocsinventory-server/stable-2.0/2.0rc1/+download/OCSNG_UNIX_SERVER-2.0rc1.tar.gz

Initiate the installer:

tar -zxvf OCSNG_UNIX_SERVER-2.0rc1.tar.gz
cd /download/OCSNG_UNIX_SERVER-2.0rc1
sh setup.sh

The install script is very simple, it's a wizard. Almost all the options, we'll select the default option.
These are the questions:

If you leave the question in blank, it will select the default option.

Do you wish to continue ([y]/n)?y

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] ?localhost

On which port is running database server [3306] ? 3306

Where is Apache daemon binary [/usr/sbin/httpd] ?

Where is Apache main configuration file [/etc/httpd/conf/httpd.conf] ?

Which user account is running Apache web server [apache] ?

Which user group is running Apache web server [apache] ?

Where is Apache Include configuration directory [/etc/httpd/conf.d/] ?

Where is PERL Intrepreter binary [/usr/bin/perl] ?

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

Where to put Communication server log directory [/var/log/ocsinventory-server] ?

OCS setup.sh can install perl module from packages for you
The script will use the native package from your operating system like apt or rpm
Do you wish to continue (y/[n])? y

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

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

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

Where to copy Administration Server static files for PHP Web Console
[/usr/share/ocsinventory-reports] ?

Where to create writable/cache directories for deployement packages,
IPDiscover and SNMP [/var/lib/ocsinventory-reports] ?

 

3 Configuring OCS Inventory NG Server 2

Creating a MySQL database:

First, we need to open mysql shell:

mysql -u root -p"secret"

Then create the database named ocsweb, and grant permissions to user ocs, with password ocs:

CREATE DATABASE ocsweb;
GRANT ALL ON ocsweb.* to 'ocs'@'localhost' identified by 'ocs';

If you want, you can change these parameters (database name, username or password). This is the default of ocs.

Now, point your browser to ocsreports interface, to manage the server with the administration tool:

http://server-ip/ocsreports/

The default user is "admin" and password is "admin".

Finally, we must delete the install script:

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

Now, all you have to do is configure the server with the machine options. Install the agents on the network computers pointing the server ip on them.
For more information, take a look at the wiki of OCS clicking here.

 

References

OCS Inventory: http://wiki.ocsinventory-ng.org/index.php/Documentation:Main

Share this page:

16 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Anonymous

   Dear Team,

 we follow you all given steps but we not able to access ocsreports interface.

We getting 404 Not Fount error.

My apache log details given below.

192.168.137.1 - - [24/Mar/2011:23:53:00 +0530] "GET /ocsreports/ HTTP/1.1" 404 2                                                                                        89 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110                                                                                        303 Firefox/3.6.15"
192.168.137.1 - - [24/Mar/2011:23:53:00 +0530] "GET /favicon.ico HTTP/1.1" 404 2                                                                                        89 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110                                                                                        303 Firefox/3.6.15"
192.168.137.1 - - [24/Mar/2011:23:53:00 +0530] "GET /favicon.ico HTTP/1.1" 404 2                                                                                        89 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110                                                                                        303 Firefox/3.6.15"
192.168.137.1 - - [24/Mar/2011:23:53:03 +0530] "GET /favicon.ico HTTP/1.1" 404 2                                                                                        89 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110                                                                                        303 Firefox/3.6.15"
192.168.137.1 - - [25/Mar/2011:00:07:06 +0530] "GET /ocsreports/ HTTP/1.1" 404 2                                                                                        89 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110                                                                                        303 Firefox/3.6.15"
192.168.137.1 - - [25/Mar/2011:00:07:09 +0530] "GET /ocsreports/ HTTP/1.1" 404 2                                                                                        89 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110                                                                                        303 Firefox/3.6.15"
192.168.137.1 - - [25/Mar/2011:00:11:05 +0530] "GET /ocsreports/ HTTP/1.1" 404 2                                                                                        89 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110                                                                                        303 Firefox/3.6.15"

^E192.168.137.1 - - [25/Mar/2011:00:14:06 +0530] "GET /ocsreports/ HTTP/1.1" 404 289 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15"

please help me.

By: Anonymous

restart Apache daemon

By: Nur

i already restart apache. no error come out. but only white screen appear. .... plz help me

By: Kapil Ahire

I am also facing same error, i have  installed php again eoor gone  But now apache is not starting up .please suggest on the same 

By: Anonymous

DearTeam,

Now we facing the beow error please help me 

Syntax error on line 38 of /etc/httpd/conf.d/ocsinventory-reports.conf:
Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration
 

 THANKS IN ADVANCE.

PLEASE HELP ME.

 

By: azafefo

Try this:

yum install php

Good luck!

By: Anonymous

ERROR: can't write in directory (on dbconfig.inc.php), please set the required rights in order to install ocsinventory (you should remove the write mode after the installation is successfull)

 how can i solve this

By: Jonny

 If anyone gets this error after setting the file permissions correctly, try disabling SELinux; that is what worked for me ;-)

setenforce 0

By:

para ese error, tienes que deshabilitar el SELINUX,  yo tuve el mismo problema y luego de realizar el cambio, me funciona perfectamente.

By: Younten Jamtsho

we also need to install php-mbstring
yum install php-mbstring -y

By: Anonymous

For those out there who are unbale to get it for 64-bit systems

$rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

 

By: Amit Joshi

Try this URL for RHEL 6: http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm

By: Joey

Hi,

 

I installed and configured this using the documentation / wiki that you post here but When i try to restart the httpd this error came :

 

[[email protected] OCSNG_UNIX_SERVER-2.0rc1]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
   Active: failed (Result: exit-code) since Wed 2013-07-03 08:27:14 PHT; 1min 27s ago
  Process: 7951 ExecStop=/usr/sbin/httpd $OPTIONS -k graceful-stop (code=exited, status=1/FAILURE)
  Process: 7949 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
   Status: "Total requests: 1; Current requests/sec: 0; Current traffic:   0 B/sec"

Jul 03 08:27:14 localhost.localdomain httpd[7949]: AH00526: Syntax error on line 303 of /etc/httpd/conf.d/z-ocsinventory-server.conf:
Jul 03 08:27:14 localhost.localdomain httpd[7949]: Unknown Authz provider: SOAP_USER
Jul 03 08:27:14 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jul 03 08:27:14 localhost.localdomain httpd[7951]: [Wed Jul 03 08:27:14.874718 2013] [so:warn] [pid 7951] AH01574: module dav_svn_module is ...kipping
Jul 03 08:27:14 localhost.localdomain httpd[7951]: [Wed Jul 03 08:27:14.874784 2013] [so:warn] [pid 7951] AH01574: module authz_svn_module i...kipping
Jul 03 08:27:14 localhost.localdomain httpd[7951]: AH00526: Syntax error on line 303 of /etc/httpd/conf.d/z-ocsinventory-server.conf:
Jul 03 08:27:14 localhost.localdomain httpd[7951]: Unknown Authz provider: SOAP_USER
Jul 03 08:27:14 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
Jul 03 08:27:14 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
Jul 03 08:27:14 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.

 

Can you please help me solve this? Thanks in advance

By: Rene Barbier

Syntax for require has been changed for Apache 2.4. Change the line that reads require "SOAP_USER" into require user "SOAP_USER" HTH

By: A Niny Mouse

This tutorials almost completely works however it neglects to let you know you need to install PHP and Apache, also the epel 5 repo doesn't allow you to install a few of the other services this guide wants you to install.

 Solution: INSTALL EPEL 6 NOT 5 one link that works for now is this

www.mirrorservice.org/sites/download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

 DO NOT FORGET to "yum install -y php httpd"

 also as noted below by Younten Jamtsho php-mbstring is also required

"yum install -y php-mbstring" will fix this issue

Any other issues can usually be solved by disabling SELINUX and IPTABLES

and now this tutorial is up to date and I confirm I have OCS running on CentOS 6.5 64bit

By: ndiaye

can't write in directory (on dbconfig.inc.php), please set the required rights in order to install ocsinventory (you should remove the write mode after the installation is successfull)

et j'utilise ubuntu 14.. donc j'ai pas de selinux sur mon system

alors quoi faire?