This article explains how to install OCS Inventory NG Server 2 on Linux Server. Prepared by Rafael Marangoni, from BRLink Consultoria Linux Team.
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
chkconfig –level 35 mysqld on
Setting a root password on mysql:
/usr/bin/mysqladmin -u root password ‘secret’
We need to start Apache (OCS uses it):
chkconfig –level 35 httpd on
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
Edit the /etc/php.ini file, and change the following lines:
post_max_size = 200M upload_max_filesize = 200M
2 Installing OCS Inventory NG Server 2
First, we need to download the tarball from OCS Inventory website. Click here.
Initiate the installer:
tar -zxvf OCSNG_UNIX_SERVER-2.0rc1.tar.gz
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
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
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:
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.
OCS Inventory: http://wiki.ocsinventory-ng.org/index.php/Documentation:Main