其中Apache及Mariadb采用yum的方式直接安装,PHP采用二进制源码安装的方式
此处前几项都和之前安装的snipeit资产管理系统相同
yum -y install epel-release
yum update -y
yum install -y httpd httpd-devel
yum install -y mariadb mariadb-server
安装PHP依赖环境
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
下载PHP安装包,并解压
cd /home
wget http://cn2.php.net/get/php-7.2.3.tar.gz/from/this/mirror
tar zxvf mirror
编译安装
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
检查没有错误之后就可以开始安装了
make && make install
编译安装完成之后,配置环境变量
vim /etc/profile
在最下方加入
PATH=$PATH:/usr/local/php7.2.3/bin
export PATH
使配置生效
source /etc/profile
配置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
启动php-fpm
service php-fpm start
查看开启状态
修改httpd.conf文件
vim /etc/httpd/conf/httpd.conf
在AddType application*后面加如下一行
AddType application/x-httpd-php .php .phtml
在DirectoryIndex index.html加上index.php
DirectoryIndex index.php index.html
确保httd.conf文件中包含以下字段,如不包含则加入此字段
LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so
重启httpd服务
service httpd restart
检验httpd的PHP支持
echo "" >> /var/www/html/index.php
重启httpd服务,添加防火墙例外之后在网页访问,查看是否有以下图片信息
service httpd restart
firewall-cmd --permanent --zone=public --add-port=80/tcp
systemctl restart firewalld.service
service mariadb start
mysql_secure_installation
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
cd /home
wget https://github.com/glpi-project/glpi/releases/download/9.3.0/glpi-9.3.tgz
tar zxvf glpi-9.3.tgz
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/
Composer是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 --prefer-source
#如有报错
#可以首先使用下面命令忽略版本,再使用命令重新安装
composer update --ignore-platform-reqs
#同时在安装之前先更换到国内的composer源
composer config -g repo.packagist composer https://packagist.laravel-china.org
service httpd restart
setenforce 0
vim /etc/sysconfig/selinux
将SELINUX的状态改为
SELINUX=disabled
按照流程配置完成之后,如果有报错提示,可以根据提示百度查找对应解决方案。
安装完成界面