CentOS7安装GLPI资产管理系统

1.安装配置docker-ce
此步骤不在此赘述

2.启动配置MySQL容器

mkdir -p /opt/mysql5.7/{data,conf}

docker pull mysql:5.7.31

docker run --name mysql-app --restart=always --cap-add=SYS_BOOT --cap-add=SYS_TIME --net=host -e MYSQL_ROOT_PASSWORD=glpi -e TZ=‘Asia/Shanghai‘ -v /opt/mysql5.7/conf:/etc/mysql -v /opt/mysql5.7/data:/var/lib/mysql -d mysql:5.7.31

创建GLPI数据库,新建glpiuser用户,密码glpi123456,并赋予权限
docker exec -it mysql-app /bin/bash -c ‘mysql -uroot -pglpi‘
mysql> create database glpi;
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON glpi.* TO ‘glpiuser‘@‘{本机IP}‘ IDENTIFIED BY ‘glpi123456‘; 
mysql> flush privileges;
mysql> \q 

3.安装PHP环境

1)先查询下是否有php包,如有则需要yum remove卸载掉

yum list installed | grep php 

2)配置epel yum源

rpm -Uvh http://mirror.centos.org/centos/7/extras/x86_64/Packages/epel-release-7-11.noarch.rpm
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm

3)yum安装php7.4

yum -y install --enablerepo=remi --enablerepo=remi-php74 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-pecl-xdebug php-pecl-xhprof php-imap php-gd php-ldap php-intl php-simplexml php-zip php-apcu php-xmlrpc php-pear-CAS 

4)配置php.ini

# vi /etc/php.ini
max_execution_time = 600 

5)查看php安装版本

# php -version
PHP 7.4.8 (cli) (built: Jul  9 2020 08:57:23) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.8, Copyright (c), by Zend Technologies
    with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans

4.安装配置Apache

1)安装apache

yum -y install httpd mod_perl
systemctl enable httpd
systemctl start httpd 

2)配置apache

# vi /etc/httpd/conf/httpd.conf
164行改为 DirectoryIndex index.php index.htm index.html
119行改为 DocumentRoot "/opt/glpi"
125行改为 <Directory "/opt/glpi">
287行添加 AddType application/x-httpd-php .php
         AddType application/x-httpd-php-source .phps

# systemctl reload httpd

5.安装配置GLPI

1)安装依赖包 

yum -y install gcc gcc-c++ flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libxml2-devel gettext-devel pcre-devel 

2)下载GLPI软件

wget https://github.com/glpi-project/glpi/releases/download/9.5.1/glpi-9.5.1.tgz -P /opt
tar -xvf /opt/glpi-9.5.1.tgz
chown -R apache.apache /opt/glpi 

3)Web页面初始化GLPI

http://{本机IP}

CentOS7安装GLPI资产管理系统

CentOS7安装GLPI资产管理系统

CentOS7安装GLPI资产管理系统

CentOS7安装GLPI资产管理系统

CentOS7安装GLPI资产管理系统

CentOS7安装GLPI资产管理系统

CentOS7安装GLPI资产管理系统

CentOS7安装GLPI资产管理系统

CentOS7安装GLPI资产管理系统

初始化配置完成后删除安装文件
rm -r /opt/glpi/install/install.php