Centos7 Installs GLPI Asset Management System

Keywords: Operation & Maintenance PHP yum Apache MariaDB

I. Environmental preparation

CentOS 7 + Apache 2.4.6 + PHP +Mariadb

Apache and Mariadb are installed directly by yum, and PHP is installed by binary source code.

The previous items here are the same as the snipeit asset management system installed before.

Pre-installation preparation

1. System Update # Note Use Centos 7.5 for Minimizing Installation here

yum -y install epel-release 

yum update -y

2. Install Apache 2.4.6 with yum

yum install -y httpd httpd-devel

3. Install Mariadb using yum

yum install -y mariadb mariadb-server

4. Source install PHP 7.2 and configure Apache support

Installing PHP Dependent Environment

yum install -y make wget gcc openssl readline-devel openssl-devel libxslt-devel gmp-devel bzip2-devel freetype-devel libjpeg-devel php-mcrypt libmcrypt libmcrypt-devel  autoconf  freetype gd jpegsrc libmcrypt libpng libpng-devel libjpeg libxml2 libxml2-devel zlib curl curl-devel  

Download the PHP installation package and unzip it

cd /home
wget http://cn2.php.net/get/php-7.2.3.tar.gz/from/this/mirror
tar zxvf mirror

Compilation and installation

cd php-7.2.3

./configure --prefix=/usr/local/php7.2.3 --with-config-file-path=/etc --enable-fpm --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-apxs2=/usr/bin/apxs --with-libxml-dir --with-xmlrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear --enable-opcache

Installation can begin after checking for no errors

make && make install 

Configure environment variables after compilation and installation

vim /etc/profile

Add at the bottom

PATH=$PATH:/usr/local/php7.2.3/bin
export PATH

Make configuration effective

source /etc/profile

Configure php-fpm

cd /home/php-7.2.3
cp php.ini-production /etc/php.ini
cp /usr/local/php7.2.3/etc/php-fpm.conf.default /usr/local/php7.2.3/etc/php-fpm.conf
cp /usr/local/php7.2.3/etc/php-fpm.d/www.conf.default /usr/local/php7.2.3/etc/php-fpm.d/www.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm

Start php-fpm

service php-fpm start

View Open State

Modify the httpd.conf file

vim /etc/httpd/conf/httpd.conf

Add the following line after AddType application*

AddType application/x-httpd-php .php .phtml

Add index.php to DirectoryIndex. index.html

DirectoryIndex index.php index.html

Make sure that the httd.conf file contains the following fields, and if not, add them

LoadModule php7_module        /usr/lib64/httpd/modules/libphp7.so

Restart httpd service

service httpd restart

Verify HP support for httpd

 echo "<?php phpinfo(); ?>" >> /var/www/html/index.php

Restart the httpd service, add firewall exceptions and visit the web page to see if there are the following picture information

service httpd restart
firewall-cmd --permanent --zone=public --add-port=80/tcp
systemctl restart firewalld.service

 

 

 

Installation of GLPI

1. Initialize and create snipeit database

service mariadb start
mysql_secure_installation

2. Create glpi database and application users

mysql -u root -p

use mysql;
CREATE USER 'glpi'@'%' IDENTIFIED BY '324215';
GRANT USAGE ON *.* TO 'glpi'@'%' IDENTIFIED BY '324215';
create database glpi;
grant select,insert,update,delete,create,drop on glpi.* to 'glpi'@'%';
flush privileges;
 \q

3. Download the decompressed glpi installation package

cd /home
wget https://github.com/glpi-project/glpi/releases/download/9.3.0/glpi-9.3.tgz
tar zxvf glpi-9.3.tgz

4. Move the installation package to Apache's directory to modify permissions

mv glpi-9.3 /var/www/html/glpi
cd /var/www/html/glpi/
chown -R apache.apache /var/www/html/
chmod 755 -R /var/www/html/glpi/config/
chmod 755 -R /var/www/html/glpi/files/

5. Dependence on installing composer and PHP

Composer is a dependency manager for PHP

cd 
curl -sS https://getcomposer.org/installer | php
mv /root/composer.phar /usr/bin/composer

cd /var/www/html/glpi
composer install --no-dev 

6. Restart Apache service and close selinux

service httpd restart

setenforce 0
vim /etc/sysconfig/selinux
 Change the status of SELINUX to
SELINUX=disabled

7. Installation check and initialization according to process prompt

After the process configuration is completed, if there is an error alert, Baidu can find the corresponding solution according to the alert.

Installation Completion Interface

 

Posted by ronald29x on Thu, 31 Jan 2019 05:09:16 -0800