Install OCS Inventory-NG 2.0 on CentOS 6
This guide is based on a fresh install of CentOS 6.2 from the Minimal ISO. It assumes you have already performed basic system configuration steps such as setting up networking, time synchronisation, etc.
-
Install the EPEL repo for some pre-requisites
rpm -ivH http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
- Edit '/etc/yum.repos.d/epel.repo' and inside the [epel] stanza, set enabled=0
-
Update the base system
yum update -y
-
Install pre-requisite packages
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 yum install -y --enablerepo=epel perl-Apache-DBI perl-Apache2-SOAP perl-XML-Entities
-
Perform the initial MySQL setup
mysql_install_db chkconfig --level 345 mysqld on service mysqld start mysql_secure_installation
- 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
- Create the database for OCS. Replace <somepassword> with your own password (Hint: Don't use 'ocs')
mysql -u root -p
CREATE DATABASE ocs; GRANT ALL PRIVILEGES ON ocs.* to ocs@localhost IDENTIFIED BY '<somepassword>'; FLUSH PRIVILEGES; QUIT
-
Install OCS (Based on OCS 2.0.4)
cd ~ wget http://launchpad.net/ocsinventory-server/stable-2.0/2.0.4/+download/OCSNG_UNIX_SERVER-2.0.4.tar.gz tar -xvzf OCSNG_UNIX_SERVER*.tar.gz cd OCSNG_UNIX_SERVER* sh ./setup.sh
- 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
-
Update database settings for OCS Server
- Edit '/etc/httpd/conf.d/z-ocsinventory-server.conf'
- 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 'ocs' to whatever you chose for your MySQL 'ocs' user password
- Edit '/etc/httpd/conf.d/z-ocsinventory-server.conf'
-
Update IPTables config to allow HTTP on port 80
- Edit '/etc/sysconfig/iptables'
- At line 11 (or just before the final 3 lines) insert
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
- At line 11 (or just before the final 3 lines) insert
- Save the file and exit then run
service iptables restart
- Edit '/etc/sysconfig/iptables'
-
Start Apache
chkconfig --level 345 httpd on service httpd start
-
Perform initial OCS config
- Visit http://yourserver/ocsreports
- You will be shown the database configuration page
- Database: ocs
- Username: ocs
- Password: <somepassword>
- Hostname: localhost
- Click submit and wait a few seconds while the database is setup by the installation script
- You will get a page which should show that everything was successful. You will be prompted to enter a string to show an agent the first time it contacts the OCS server. I leave it blank and click submit.
- You will get a page informing you that installation is complete.
- Delete the installation script
rm -f /var/www/ocsreports/install.php
- Visit http://yourserver/ocsreports to login
- Username: admin
- Password: admin
- You should change your 'admin' password after logging in.
- OCS Server installation is complete. You can now begin deploying your agents.
Comments
Geoff Hodder
2013-02-03
It sounds like the user your web server runs under is not the same as the owner of your website files.
Based on my example, you would run "chmod 0777 /var/www/ocsreports/dbconfig.inc.php" then go through the setup.
Once you have completed the setup, you should run "chmod 0755 /var/www/ocsreports/dbconfig.inc.php".
Miguel
2013-02-03
hi, please helpme, this problem:
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)
Cleiton Souza
2013-01-22
Thank you! this working fine.
Hyrum A Renderos
2012-06-02
Excellent! your work is the best in all the internet. I don't speak english, then your tutorial is the best in all the languages. It helped me a lot, I was looking everywhere and olny this work perfect.
Thank you very much!
Rene
2012-04-30
Excellent! Thank you very much! I spent two days trying to figure out how to do this using several manuals. Yours is accurate, easy and complete!
Kassiano
2012-03-17
Great! with some changes to my environment worked perfectly.