This tool helps the System Administrators to manage their assets and software easily.
Easily deployable and manageable with rich features like software deployment, reports, network scanning and more makes the life easier.
I have used it on network where there are few hundreds of servers in the network. But, OCS claims that this tool can support more than 10000 computer without any problem. It also runs faster as the database is updated by an xml file from the clients which reduces the headache of system resource consumption and network load.
The following components are used for the installation of OCS Inventory NG in this article. But most Linux distros are supported.
- MySQL / PostgreSQL
Download the software from OCS Inventory NG website here, or install using EPEL.
Install OCS Inventory NG on CentOS
1. Install EPEL Repository
We need to install EPEL repo first. This helps us to resolve the dependencies easily.
rpm -ivH http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
After the EPEL is installed, it might be a good idea to update your system.
yum update -y
2. Install Pre-Req Packages
The following packages are required for this inventory management software
yum install -y make wget httpd mysql mysql-server php php-gd php-mysql php-mbstring mod_perl perl-XML-Simple perl-Net-IP perl-SOAP-Lite perl-DBI perl-DBD-MySQL perl-Apache-DBI perl-Apache2-SOAP perl-XML-Entities
Make sure all the dependencies are installed. OCS is highly dependent on perl modules.
3. MySQL Setup
Perform the initial MySQL setup as shown below.
# mysql_install_db # chkconfig mysqld on # /etc/init.d/mysqld start # /usr/bin/mysql_secure_installation
During the above mysql secure installation process, do the following:
- Press Enter for current password
- Type a password for the ‘root’ user
- Re-enter your new ‘root’ password
- Y to remove anonymous user
- Y to disallow remote logon
- Y to remove the test database
- Y to reload the privilege tables
4. Create OCS database
Create the OCS database and grant all privileges
# mysql -u root -p mysql> CREATE DATABASE ocs; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON ocs.* to ocs@localhost IDENTIFIED BY 'tgs@123'; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
5. Install OCS
Install OCS, based on OCS 2.1.1 as shown below:
cd ~ wget https://launchpadlibrarian.net/175892122/OCSNG_UNIX_SERVER-2.1.1.tar.gz tar -xvzf OCSNG_UNIX_SERVER*.tar.gz cd OCSNG_UNIX_SERVER* sh ./setup.sh
For the setup.sh, it will ask for the following questions, answer them accordingly:
- Y to continue
- Enter to accept ‘localhost’ as MySQL server
- Enter to accept ‘3306’ as MySQL port
- Enter to accept ‘/usr/sbin/httpd’ as Apache binary
- Enter to accept ‘/etc/httpd/conf/httpd.conf’ as Apache config file
- Enter to accept ‘apache’ as Apache user
- Enter to accept ‘apache’ as Apache group
- Enter to accept ‘/etc/httpd/conf.d/’ as Apache include directory
- Enter to accept ‘/usr/bin/perl’ as Perl interpreter
- Y to install Communication server
- Enter to accept ‘/var/log/ocsinventory-server’ as log directory
- Y to continue with installation
- Y to rename OCS server config to ‘z-ocsinventory-server.conf’
- Y to installation Administration server
- Y to continue
- Enter ‘/var/www’ as location for Administration Server static files location
- Enter ‘/var/www’ as location for Download location
6. Update Settings
Update database settings for OCS Server.
Edit ‘/etc/httpd/conf.d/z-ocsinventory-server.conf’ and do the following:
- Change line 26 (OCS_DB_NAME) from ‘ocsweb’ to ‘ocs’
- Change line 27 (OCS_DB_LOCAL) from ‘ocsweb’ to ‘ocs’
- Change line 31 (OCS_DB_PWD) from ‘tgs@123’
In our example:
# Name of database PerlSetEnv OCS_DB_NAME ocs PerlSetEnv OCS_DB_LOCAL ocs # User allowed to connect to database PerlSetEnv OCS_DB_USER ocs # Password for user PerlSetVar OCS_DB_PWD tgs@123
7. Initial OCS config
From there you can perform the initial ocs configurations.
Make sure you change the admin password and remove the install.php file after the installation.
Install OCS Agent on CentOS
Use yum to install the OCS inventory agent as shown below.
# yum install ocsinventory-agent
Open the configuration file:
# vi /etc/ocsinventory/ocsinventory-agent.cfg
And modify the following lines:
- server = http://your.ocs.server/ocsinventory
- tag = your_tag
- Change the line local = /var/lib/ocsinventory-agent to basevardir = /var/lib/ocsinventory-agent. Save and close the file.
Execute the OCS agent using the following command:
Create a crontab entry to run the agent in the background:
# crontab -e 00 10 * * * /usr/sbin/ocsinventory-agent
For Windows, download agents from here
For debian flavor systems, for example, Ubuntu, do the following:
#sudo aptitude install ocsinventory-agent