Install GLPI and OCS on CentOS  6.5

Spread the love

Install Linux, Apache, MySQL, PHP (LAMP)

To install apache, open terminal and type in this command:

# sudo yum install httpd


Apache 2.4 on CentOS:

# cd /etc/yum.repos.d/


# yum install httpd24.x86_64

$ /opt/rh/httpd24/root/usr/sbin/httpd -version

Server version: Apache/2.4.6 (Red Hat)

Server built:   Sep 25 2013 05:25:46

You can start apache running on your VPS:

# sudo service httpd start

Install MySQL

# sudo yum install mysql-server

# sudo service mysqld start

You can set a root MySQL password:

# sudo /usr/bin/mysql_secure_installation

Installing Packages

we need to install EPEL repository:

rpm -Uvh

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

# yum install php-pecl-zip php-mysql php-devel zlib-devel php-pear php-gd gcc

perl -MCPAN -e ‘install PERL::PACKAGE’

# sudo yum update

Install PHP

# sudo yum install phpmyadmin

# sudo yum install epel-release

# sudo yum install phpmyadmin

Open the file in your text editor now so that we can make a few changes:

#  sudo nano /etc/httpd/conf.d/phpMyAdmin.conf


# sudo yum install php php-pear

# sudo yum install php-mysql

Create the log directory for PHP and give the Apache user ownership:

# sudo mkdir /var/log/php

# sudo chown apache /var/log/php

Restart Apache:

# sudo service httpd restart

Configure phpMyAdmin

Edit the phpmyadmin.conf file.

#  vi /etc/httpd/conf.d/phpMyAdmin.conf

Find and comment the whole /<Directory> section as shown below:


Alias /phpMyAdmin /usr/share/phpMyAdmin

Alias /phpmyadmin /usr/share/phpMyAdmin


#<Directory /usr/share/phpMyAdmin/>

#   <IfModule mod_authz_core.c>

#     # Apache 2.4

#     Require local

#   </IfModule>

#   <IfModule !mod_authz_core.c>

#     # Apache 2.2

#     Order Deny,Allow

#     Deny from All

#     Allow from

#     Allow from ::1

#   </IfModule>




Open “” file. And change from “cookie” to “http” to change the authentication in phpMyAdmin:

# cp /usr/share/phpMyAdmin/ /usr/share/phpMyAdmin/

# vi /usr/share/phpMyAdmin/

Change cookie to http.


/* Authentication type */

$cfg[‘Servers’][$i][‘auth_type’] = ‘http’;


Restart the Apache service:

# service httpd restart

# sudo chkconfig httpd on

# sudo chkconfig mysqld on

View PHP on your Server

First create a new file:

sudo nano /var/www/html/info.php

Add in the following line:




Then Save and Exit.

Restart apache

# sudo service httpd restart




Install & configure OCSInventory 2.1 Server

# vim /etc/httpd/conf/httpd.conf

ServerName: ocs-inventory:80


# service httpd start; chkconfig httpd on

service mysqld start; chkconfig mysqld on

Perl and PHP SetupPerl and PHP Setup

Perl module packages from the RPMForge repo

# yum install perl-XML-Simple perl-Compress-Zlib perl-DBI perl-DBD-MySQL perl-Apache-DBI perl-Net-IP perl-SOAP-Lite

PHP requirements and dependencies for the OCS admin console

# yum install php-pecl-zip php-mysql php-devel zlib-devel php-pear php-gd gcc

yum install perl-Apache-DBI

Firtly check and install gc ( yum install gc)

Secondly check and install make ( yum install make)

Third install cpan ( yum install perl-CPAN)

Finally install perl-Apache-DBI ( perl -MCPAN -e ‘install Apache::DBI’ )

yum install YAML

# pecl install zip

# vim /etc/php.ini

;Add zip support

# service httpd restart

Start Service Apace & MySql

service httpd start && service mysqld start


Login to mysql

mysql -u root -p

create database ocsweb;

CREATE USER ‘ocsweb’@’%’ IDENTIFIED BY ‘Password’;

grant all privileges on ocsweb.* to ocs@localhost identified by “Password”;


Download OCS SERVER for Linux


tar zxvf OCSNG_UNIX_SERVER-2.1.tar.gz




after installation restart apache

service httpd restart

Set    –   setenforce 0

Set the following settings

mysql -u root -p

mysql> set global net_buffer_length=1000000;

Query OK, 0 rows affected (0.00 sec)


mysql> set global max_allowed_packet=20480;

Query OK, 0 rows affected (0.00 sec)

SHOW VARIABLES LIKE ‘max_allowed_packet’

Change the ownership and permissions of folder

chown -R root:root ocsreports


chown -R apache:apache ocsreports

chmod gou+rx ocsreports ocsreports/css ocsreports/files ocsreports/image

chmod 775 /usr/share/ocsinventory-reports/ocsreports

chmod 775 /usr/share/ocsinventory-reports/ocsreports/

And remove the Install.php that will be prompt

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



GLPI Installation

mysql -u root -p

mysql> create user ‘glpi’@’localhost’;

mysql> grant all privileges on glpi.* to ‘glpi’@’localhost’ identified by  ‘Password’;

mysql> flush privileges;


Download GLPI setup

# wget

# tar -zxvf glpi-0.85.4.tar.gz

#  mv glpi/ /var/www/html/glpi

#  chmod -R 777 /var/www/html/glpi/files/

# chmod -R 755 /var/www/html/glpi

# chmod -R 777 /var/www/html/glpi

#  chmod -R 777 /var/www/html/glpi/config/




Leave a Reply

Your email address will not be published. Required fields are marked *