环境需求
系统:CentOS 7
IP:192.168.11.207
关闭selinux和防火墙
$ systemctl stop firewalld
$ systemctl disable firewalld
$ setenforce 0
$vim /etc/sysconfig/selinux
SELINUX=disabled
注:注意 selinux 配置检测会用到请注意关闭
PHP****安装配置
$ rpm -ivh http://ftp.iij.ad.jp/pub/linux/fedora/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
$ rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
$ yum -y install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpuni-PHPUnit php-pecl-xdebug php-pecl-xhprof php-imap php-ldap php-gd
$ yum install -y tree vim lrzsz wget nc nmap dos2unix bash-completion bash-completion-extras telnet net-tools
安装数据库
$ vim /etc/yum.repos.d/MariaDB.repo
[mariadb]
name=MariaDB
baseurl=http://mirrors.aliyun.com/mariadb/yum/10.3/centos7-amd64/
gpgkey=http://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
$ yum clean all && yum makecache
$ yum install -y MariaDB-server MariaDB-client MariaDB-devel
配置MySql
启动mysql数据库服务并设为开机启动
$ systemctl start mariadb && systemctl enable mariadb
初始化MariaDB数据库,主要创建mysql数据库密码,然后全部Y下一步:
$ mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): //当前数据库密码为空,直接按回车键 OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] Y //输入要为root管理员设置的密码(数据库root非linux root) New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y //删除匿名账号 ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y //禁止root管理员从远程登录 ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y //删除test数据库并取消对它的访问权限 - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y //刷新授权表,让初始化后的设定立即生效 ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
创建用户并设置权限
$ mysql -uroot -p
MariaDB [(none)]> use mysql
MariaDB [mysql]> grant all privileges on . to root@"%" identified by "21ops.com";
MariaDB [mysql]>flush privileges;
MariaDB [(none)]> create database glpi;
MariaDB [(none)]> create user 'glpi'@'%' identified by "glpi";
MariaDB [(none)]> grant all privileges on glpi.* to 'glpi'@'%' identified by "glpi";
MariaDB [(none)]> flush privileges;
下载GLPI安装包
[root@test4-8g ~]# wget https://github.com/glpi-project/glpi/releases/download/9.3.2/glpi-9.3.2.tgz
$ tar xvf glpi-9.3.2.tgz -C /var/www/html
$ chown -R apache:apache /var/www/html
$ systemctl start httpd
$ systemctl enable httpd
GlPI****配置
将存储GLPI配置/etc/glpi,只需将config目录复制到此位置即可。
将GLPI数据存储在其中/var/lib/glpi,只需将files内容目录复制到此处即可。
GLPI日志文件将被存储/var/log/glpi,这里没有什么可复制的,只需创建目录即可。
$ mkdir /etc/glpi # 配置文件的路径
$ mkdir /var/lib/glpi # 数据存储文件的路径。\
$ mkdir /var/log/glpi # 日志文件的路径。
$ cd /var/www/html/glpi/
$ cp -r config/ /etc/glpi/
$ cp -r files/* /var/lib/glpi/
更改所创建目录的所属主,组 。否则会有权限问题
$ chown -R apache:apache /etc/glpi
$ chown -R apache:apache /var/lib/glpi/
$ chown -R apache:apache /var/log/glpi/
PHP****配置
$ vim /etc/php.ini # 可在末尾添加extension=/opt/remi/php56/root/usr/lib64/php/modules/mbstring.so
GLPI-PHP****配置
$ vim /var/www/html/glpi/inc/downstream.php # 创建文件并添加以下内容
<?php
define('GLPI_CONFIG_DIR', '/etc/glpi/');
if (file_exists(GLPI_CONFIG_DIR . '/local_define.php')) {
require_once GLPI_CONFIG_DIR . '/local_define.php';
}
$ vim /etc/glpi/local_define.php # 创建文件并添加以下内容
<?php
define('GLPI_VAR_DIR', '/var/lib/glpi');
define('GLPI_DOC_DIR', GLPI_VAR_DIR);
define('GLPI_CRON_DIR', GLPI_VAR_DIR . '/_cron');
define('GLPI_DUMP_DIR', GLPI_VAR_DIR . '/_dumps');
define('GLPI_GRAPH_DIR', GLPI_VAR_DIR . '/_graphs');
define('GLPI_LOCK_DIR', GLPI_VAR_DIR . '/_lock');
define('GLPI_PICTURE_DIR', GLPI_VAR_DIR . '/_pictures');
define('GLPI_PLUGIN_DOC_DIR', GLPI_VAR_DIR . '/_plugins');
define('GLPI_RSS_DIR', GLPI_VAR_DIR . '/_rss');
define('GLPI_SESSION_DIR', GLPI_VAR_DIR . '/_sessions');
define('GLPI_TMP_DIR', GLPI_VAR_DIR . '/_tmp');
define('GLPI_UPLOAD_DIR', GLPI_VAR_DIR . '/_uploads');
define('GLPI_CACHE_DIR', GLPI_VAR_DIR . '/_cache');
define('GLPI_LOG_DIR', '/var/log/glpi');
$ vim /etc/httpd/conf/httpd.conf
<Directory "/var/www"> AllowOverride ALL # Allow open access: Require all granted </Directory>
设置selinux
$ setsebool -P httpd_can_network_connect 1
$ setsebool -P httpd_can_network_connect_db 1
$ setsebool -P httpd_can_sendmail 1
重启HTTPD,浏览器访问
$ systemctl restart httpd
进行ip 访问 http://192.168.11.207/glpi/ 就会看到安装UI界面 安装指示安装就可以
界面安装演示
1.可选择语言
[图片上传失败...(image-d5512f-1565320331473)]
[图片上传失败...(image-33df2f-1565320331473)]
2.同意许可
[图片上传失败...(image-7cf494-1565320331473)]
3.安装
[图片上传失败...(image-dde224-1565320331473)]
4.环境测试
[图片上传失败...(image-8ad578-1565320331473)]
5.连接数据库
[图片上传失败...(image-5e727c-1565320331473)]
6.选择库(等待数据初始就可以了)
[图片上传失败...(image-a22003-1565320331473)]
7.数据初始完成
[图片上传失败...(image-ae636b-1565320331473)]
[图片上传失败...(image-89693b-1565320331472)]
8.留意账号密码
[图片上传失败...(image-dc2cd5-1565320331472)]
9.进入界面
[图片上传失败...(image-b57dbe-1565320331472)]