How To Install GLPI 9.5 On CentOS7
A.安装GLPI基本要求:
1.Web服务器能支持 PHP, 例如:
2.PHP:
As of 9.5 release, GLPI requires PHP 7.2 or more recent.
注解:We recommend to use the most recent stable PHP release for better performances.
3.必备扩展依赖:
curl
: 用于 CAS 认证, GLPI 版本检查, 遥测技术, …;fileinfo
: 获取文件的扩展信息;gd
: 用于生成图片;json
: 用于支持 JSON 数据格式;mbstring
: 管理多字节字符;mysqli
: 连接和查询数据库。;session
: 用于获取用户session会话;zlib
: 用于数据库的备份与恢复功能;simplexml
;xml
;intl
.
4.可选的扩展
注解:即使这些扩展不是强制性的,我们建议您无论如何都要安装它们。
对于GLPI的一些额外特性,需要以下PHP扩展:
cli
: 用于命令行下使用 PHP (脚本, 自动动作, 或更多其他);domxml
: 用于 CAS 认证;imap
: 用于邮件收发或用户身份认证;ldap
: 使用 LDAP 目录来身份认证;openssl
: 通讯安全需要它;xmlrpc
: 使用 XMLRPC API.APCu
: 可用于高速缓存; 特别地 (参见 caching configuration (仅法语).
警告:当前, GLPI仅支持 MySQL (5.6 minimum) 以及 MariaDB (10.0 minimum) 数据库.
为了工作。
B.yum安装mariadb10.4
下载 按钮 GLPI 官方网站 (或从Github获取 Github release) 选择 glpi-{version}.tgz
文档.
1.删除CentOS7自带的mariadb5.5数据库及配置文件
[root@GLPI ~]# find -H /etc/ | grep my.c #查看默认数据库配置文件
/etc/pki/tls/certs/make-dummy-cert
/etc/pki/tls/certs/renew-dummy-cert
/etc/my.cnf
/etc/my.cnf.d
/etc/my.cnf.d/mysql-clients.cnf
[root@GLPI ~]# rm -rf /etc/my.cnf /etc/my.cnf.d/ #删除默认数据库配置文件
[root@GLPI ~]# find -H /etc/ | grep my.c #再次查看默认数据库配置文件
/etc/pki/tls/certs/make-dummy-cert
/etc/pki/tls/certs/renew-dummy-cert
[root@GLPI ~]# rpm -qa|grep mariadb-libs #卸载系统自带mariadb-libs
mariadb-libs-5.5.65-1.el7.x86_64
[root@GLPI ~]# yum remove mariadb-libs.x86_64 -y
2.添加mariadb yum源
[root@GLPI ~]# sudo tee /etc/yum.repos.d/MariaDB.repo<<EOF
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
3.yum安装mariadb
[root@GLPI ~]# yum makecache
[root@GLPI ~]# yum install -y mariadb-server.x86_64 mariadb-devel.x86_64 mariadb.x86_64
4.启动和初始化mariadb 测试mariadb
[root@GLPI ~]# systemctl start mariadb.service
[root@GLPI ~]# systemctl enable mariadb.service
[root@GLPI ~]# mysql_secure_installation
.....
[root@GLPI ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 10.4.13-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> select version();
+-----------------+
| version() |
+-----------------+
| 10.4.13-MariaDB |
+-----------------+
1 row in set (0.000 sec)
5.设置默认字符集
修改 my.cnf文件如果没有就增加以下代码
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
character-set-server=utf8
验证是否成功
MariaDB [(none)]> show variables like 'character_set_%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.001 sec)
C.yum安装PHP7.4
1.安装源
yum install epel-release
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
2.安装YUM管理工具
yum install yum-utils
3. 查看PHP
yum search php74
4.安装PHP7.4
yum install php-74-php php74-php-gd php74-php-curl php74-php-fileinfo php74-php-json php74-php-mbstring php74-php-mysqli php74-php-session php74-php-zlib php74-php-simplexml php74-php-xml php74-php-intl php74-php-cli php74-php-domxml php74-php-imap php74-php-loap php74-php-openssl php74-php-xmlrpc php74-php-apcu php74-php-fpm php74-php-ldap php-pear-CAS php74-php-pecl-zip php74-php-opcache
5.配置PHP7.4
PHP 配置文件 (/etc/php.ini
) 必须加以调整,以反映下列变数:
memory_limit = 64M ; // max memory limit
file_uploads = on ;
max_execution_time = 600 ; // not mandatory but recommended
session.auto_start = off ;
session.use_trans_sid = 0 ; // not mandatory but recommended
6.数据库
D.yum 安装apache(httpd)
1.安装apache
[root@GLPI ~]# yum install httpd httpd-devel
[root@GLPI ~]# systemctl start httpd.service
[root@GLPI ~]# systemctl enable httpd.service
2.修改httpd.conf文件
vim /etc/httpd/conf/httpd.conf
在AddType application*后面加如下一行
AddType application/x-httpd-php .php .html
在DirectoryIndex index.html加上index.php
DirectoryIndex index.php index.html
将AllowOverride None都改成AllowOverride All
在此行内容下面添加Include conf.modules.d/*.conf
LoadModule rewrite_module modules/mod_rewrite.so
3.下载glpi系统并解压至/ar/www/html/目录下 并设置apache用户权限
wget https://github.com/glpi-project/glpi/releases/download/9.5.0/glpi-9.5.0.tgz
tar -xf glpi-9.5.0.tgz -C /var/www/html/
chown -R apache:apache /var/www/html/
4.关闭防火墙
[root@GLPI ~]# systemctl stop firewalld.service
[root@GLPI ~]# systemctl disable firewalld.service
5.关闭SELinux
[root@GLPI ~]# vi /etc/selinux/config
SELINUX=disabled
[root@GLPI ~]# systemctl restart httpd.service mariadb.service php74-php-fpm.service
6.访问配置http://ip/glpi进行设置系统
如果没有glpi数据库就在第二个选项输入数据库名字 点击Countinue系统自己创建
- 管理员帐号是 glpi/glpi
- 技术员帐号是 tech/tech
- 普通帐号是 normal/normal
- 只能发布的帐号是 post-only/postonly