System:
CentOS 6.6,ip address: 192.168.99.30, SELINUX=disabled
1.Install Apache,PHP,MySQL and pre-requisite packages.
# yum groupinstall -y "Development tools"
# yum groupinstall -y "Web Server"
# yum groupinstall -y "MySQL Database server"
2.Install EPEL Repository and set enabled=0
# cd /opt
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm --import https://fedoraproject.org/static/0608B895.txt
# rpm -ivh epel-release-6-8.noarch.rpm
# vi /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
3.Iptables add ports 80 for Apache & 3306 for MySql
# iptables -I INPUT -m multiport -p tcp --dport 80,3306 -j ACCEPT
# service iptables save
# service iptables restart
or set firewall using command system-config-firewall-tui
4.Start Apache and MySQL service and set to start on boot
# service httpd start && service mysqld start
# chkconfig httpd on && chkconfig mysqld on
5.Secure MySQL root user
# /usr/bin/mysql_secure_installation
...
Enter current password for root (enter for none):
OK, successfully used password, moving on...
...
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
.
Remove anonymous users? [Y/n] y
... Success!
.
Disallow root login remotely? [Y/n] n
... skipping.
.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
6.Install PhpMyAdmin in order to easy manage MySql (Optional)
# yum --enablerepo=epel -y install phpmyadmin
Add my subnet to access phpMyAdmin:
# vi /etc/httpd/conf.d/phpMyAdmin.conf
<Directory /usr/share/phpMyAdmin/>
..
Deny from All
Allow from 127.0.0.1 192.168.99.0/24
..
</Directory>
7.Install OCS Inventory pre-requisite packages
# yum install -y php php-gd php-mysql php-mbstring perl-XML-Simple perl-Net-IP perl-SOAP-Lite httpd-devel
# yum install -y --enablerepo=epel perl-Apache-DBI perl-Apache2-SOAP perl-XML-Entities
8.Download and setup OCS Inventory
# cd /opt
# wget https://launchpad.net/ocsinventory-server/stable-2.1/2.1.2/+download/OCSNG_UNIX_SERVER-2.1.2.tar.gz
# tar –xvzf OCSNG_UNIX_SERVER-2.1.2.tar.gz
# cd OCSNG_UNIX_SERVER-2.1.2
# sh setup.sh
+----------------------------------------------------------+
| |
| Welcome to OCS Inventory NG Management server setup ! |
| |
+----------------------------------------------------------+
Trying to determine whitch OS or Linux distribution you use
+----------------------------------------------------------+
| Checking for Apache web server binaries ! |
+----------------------------------------------------------+
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 /opt/OCSNG_UNIX_SERVER-2.1.2
Storing log in file /opt/OCSNG_UNIX_SERVER-2.1.2/ocs_server_setup.log
+----------------------------------------------------------+
| Checking for database server properties... |
+----------------------------------------------------------+
Your MySQL client seems to be part of MySQL version 5.1.
Your computer seems to be running MySQL 4.1 or higher, good ;-)
Which host is running database server [localhost] ? [hit Enter]
OK, database server is running on host localhost ;-)
On which port is running database server [3306] ? [hit Enter]
OK, database server is running on port 3306 ;-)
+----------------------------------------------------------+
| Checking for Apache web server daemon... |
+----------------------------------------------------------+
Where is Apache daemon binary [/usr/sbin/httpd] ? [hit Enter]
OK, using Apache daemon /usr/sbin/httpd ;-)
+----------------------------------------------------------+
| Checking for Apache main configuration file... |
+----------------------------------------------------------+
Where is Apache main configuration file [/etc/httpd/conf/httpd.conf] ? [hit Enter]
OK, using Apache main configuration file /etc/httpd/conf/httpd.conf ;-)
+----------------------------------------------------------+
| Checking for Apache user account... |
+----------------------------------------------------------+
Which user account is running Apache web server [apache] ? [hit Enter]
OK, Apache is running under user account apache ;-)
+----------------------------------------------------------+
| Checking for Apache group... |
+----------------------------------------------------------+
Which user group is running Apache web server [apache] ? [hit Enter]
OK, Apache is running under users group apache ;-)
+----------------------------------------------------------+
| Checking for Apache Include configuration directory... |
+----------------------------------------------------------+
Setup found Apache Include configuration directory in /etc/httpd/conf.d/.
Setup will put OCS Inventory NG Apache configuration in this directory.
Where is Apache Include configuration directory [/etc/httpd/conf.d/] ? [hit Enter]
OK, Apache Include configuration directory /etc/httpd/conf.d/ found ;-)
+----------------------------------------------------------+
| Checking for PERL Interpreter... |
+----------------------------------------------------------+
Found PERL Intrepreter at ;-)
Where is PERL Intrepreter binary [/usr/bin/perl] ? [hit Enter]
OK, using PERL Intrepreter /usr/bin/perl ;-)
Do you wish to setup Communication server on this computer ([y]/n)?y
+----------------------------------------------------------+
| Checking for Make utility... |
+----------------------------------------------------------+
OK, Make utility found at ;-)
+----------------------------------------------------------+
| Checking for Apache mod_perl version... |
+----------------------------------------------------------+
Checking for Apache mod_perl version 1.99_22 or higher
Found that mod_perl version 1.99_22 or higher is available.
OK, Apache is using mod_perl version 1.99_22 or higher ;-)
+----------------------------------------------------------+
| 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-server] ? [hit Enter]
OK, Communication server will put logs into directory /var/log/ocsinventory-server ;-)
+----------------------------------------------------------------------------+
| Checking for Communication server plugins configuration directory... |
+----------------------------------------------------------------------------+
Communication server need a directory for plugins configuration files.
Where to put Communication server plugins configuration files [/etc/ocsinventory-server/plugins] ? [hit Enter]
OK, Communication server will put plugins configuration files into directory /etc/ocsinventory-server/plugins ;-)
+-------------------------------------------------------------------+
| Checking for Communication server plugins perl directory... |
+-------------------------------------------------------------------+
Communication server need a directory for plugins Perl modules files.
Where to put Communication server plugins Perl modules files [/etc/ocsinventory-server/perl] ? [hit Enter]
OK, Communication server will put plugins Perl modules files into directory /etc/ocsinventory-server/perl ;-)
+----------------------------------------------------------+
| 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 optional Perl Modules... |
+----------------------------------------------------------+
Checking for SOAP::Lite PERL module...
Found that PERL module SOAP::Lite is available.
Checking for Apache2::SOAP PERL module...
*** Warning: PERL module Apache2::SOAP is not installed !
This module is only required by OCS Inventory NG SOAP Web Service.
Do you wish to continue ([y]/n] ?y
Checking for XML::Entities PERL module...
Found that PERL module XML::Entities 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-server.
Fixing Communication server log directory files permissions.
Configuring logrotate for Communication server.
Removing old communication server logrotate file /etc/logrotate.d/ocsinventory-NG
Writing communication server logrotate to file /etc/logrotate.d/ocsinventory-server
+-----------------------------------------------------------------------------+
| OK, Communication server log directory created ;-) |
| |
| Creating Communication server plugins configuration directory... |
+-----------------------------------------------------------------------------+
Creating Communication server plugins configuration directory /etc/ocsinventory-server/plugins.
+-----------------------------------------------------------------------------+
| OK, Communication server plugins configuration directory created ;-) |
| |
| Creating Communication server plugins Perl directory... |
+-----------------------------------------------------------------------------+
Creating Communication server plugins Perl directory /etc/ocsinventory-server/perl.
+-------------------------------------------------------------------+
| OK, Communication server plugins Perl directory created ;-) |
| |
| Now configuring Apache web server... |
+-------------------------------------------------------------------+
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
OK, using 'z-ocsinventory-server.conf' as Communication Server Apache configuration file
Removing old communication server configuration to file /etc/httpd/conf.d//ocsinventory.conf
Writing communication server configuration to file /etc/httpd/conf.d//z-ocsinventory-server.conf
+----------------------------------------------------------+
| OK, Communication server setup sucessfully finished ;-) |
| |
| Please, review /etc/httpd/conf.d//z-ocsinventory-server.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 Administration Server directories... |
+----------------------------------------------------------+
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
Assuming directories 'ocsreports' and 'download' removed from
Apache root document directory.
Where to copy Administration Server static files for PHP Web Console
[/usr/share/ocsinventory-reports] ? [hit Enter]
OK, using directory /usr/share/ocsinventory-reports to install static files ;-)
Where to create writable/cache directories for deployement packages,
administration console logs, IPDiscover and SNMP [/var/lib/ocsinventory-reports] ? [hit Enter]
OK, writable/cache directory is /var/lib/ocsinventory-reports ;-)
+----------------------------------------------------------+
| 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 PHP directory /usr/share/ocsinventory-reports/ocsreports.
Copying PHP files to /usr/share/ocsinventory-reports/ocsreports.
Fixing permissions on directory /usr/share/ocsinventory-reports/ocsreports.
Creating database configuration file /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php.
Creating IPDiscover directory /var/lib/ocsinventory-reports/ipd.
Fixing permissions on directory /var/lib/ocsinventory-reports/ipd.
Creating packages directory /var/lib/ocsinventory-reports/download.
Fixing permissions on directory /var/lib/ocsinventory-reports/download.
Creating snmp mibs directory /var/lib/ocsinventory-reports/snmp.
Fixing permissions on directory /var/lib/ocsinventory-reports/snmp.
Creating Administration server log files directory /var/lib/ocsinventory-reports/logs.
Fixing permissions on directory /var/lib/ocsinventory-reports/logs.
Creating Administration server scripts log files directory /var/lib/ocsinventory-reports/scripts.
Fixing permissions on directory /var/lib/ocsinventory-reports/scripts.
Configuring IPDISCOVER-UTIL Perl script.
Installing IPDISCOVER-UTIL Perl script.
Fixing permissions on IPDISCOVER-UTIL Perl script.
Writing Administration server configuration to file /etc/httpd/conf.d//ocsinventory-reports.conf
+----------------------------------------------------------+
| OK, Administration server installation finished ;-) |
| |
| Please, review /etc/httpd/conf.d//ocsinventory-reports.conf
| to ensure all is good and restart Apache daemon. |
| |
| Then, point your browser to http://server//ocsreports
| to configure database server and create/update schema. |
+----------------------------------------------------------+
Setup has created a log file /opt/OCSNG_UNIX_SERVER-2.1.2/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 ;-)
[root@centos6x64 OCSNG_UNIX_SERVER-2.1.2]#
# service httpd restart
9.Perform initial OCS config then login to OCS (Note: It automatically create database ocsweb, with login: ocs,password: ocs)
10. Clear up OCS Inventory security warning
Delete install.php (or can rename it)
# rm /usr/share/ocsinventory-reports/ocsreports/install.php
Change default MySQL ocs password
-Using phpMyAdmin find user ocs then change the password.
-Change MySQL user ocs password in /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php
# vi /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php
<?php
define("DB_NAME", "ocsweb");
define("SERVER_READ","localhost");
define("SERVER_WRITE","localhost");
define("COMPTE_BASE","ocs");
define("PSWD_BASE","newpassword");
?>
-Change MySQL user ocs password in /etc/httpd/conf.d/z-ocsinventory-server.conf
..
# Master Database settings
# Replace localhost by hostname or ip of MySQL server for WRITE
PerlSetEnv OCS_DB_HOST localhost
# Replace 3306 by port where running MySQL server, generally 3306
PerlSetEnv OCS_DB_PORT 3306
# Name of database
PerlSetEnv OCS_DB_NAME ocsweb
PerlSetEnv OCS_DB_LOCAL ocsweb
# User allowed to connect to database
PerlSetEnv OCS_DB_USER ocs
# Password for user
PerlSetVar OCS_DB_PWD [input newpassword]
..
# chmod -R 777 /usr/share/ocsinventory-reports/ocsreports/plugins/main_sections/conf/old_conf/
# chmod -R 777 /usr/share/ocsinventory-reports/ocsreports/plugins/main_sections/conf/sadmin_config.txt
Finish!!
References:
http://www.ocsinventory-ng.org/en/
http://wiki.ocsinventory-ng.org/index.php/Documentation:Server
http://phreek.org/guides/install-ocs-inventory-ng-20-on-centos-6
http://www.vr4servers.com/how-to-install-configure-ocsinventory-2-1-server-on-centos-6-5-64bit/
https://www.howtoforge.com/how-to-install-ocs-inventory-ng-server-2-on-centos-5.5
Thanks a lot