准备环境

系统环境:

centos7

mariadb:10.5.18

php:7.4.33

apache:2.4.6


#关闭selinux

setenforce 0
vim /etc/selinux/config

改成如图下selinux=disabled所示

GLPI资产管理系统+fusioninventory_php


#关闭防火墙

systemctl stop firewalld
systemctl disable firewalld


开始安装

1.安装所需工具

yum -y install wget vim

2.更新系统补丁

yum -y install epel-release
yum update -y

3.安装apache

yum -y install httpd httpd-deve

l

3.1更新php的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.2安装

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 php-zip

4.安装GLPI依赖

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

5.安装mariadb

5.1制作安装源

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

编辑完成后按“esc”键退出编辑模式,再按“:wq”组合键保存退出


5.2更新缓存

yum clean all
yum makecache
yum repolist


5.3安装mariadb

yum -y install MariaDB-server MariaDB-client

6.启动服务并设置开机自启

systemctl start httpd
systemctl enable httpd
systemctl start mariadb
systemctl enable mariadb

7.数据库配置

7.1初始化数据库

mysql_secure_installation

第一次输入y后回车配置数据库密码,其余全部回车即可

7.2进入数据库配置

mysql -u root -p

输入配置密码进入数据库

7.3创建数据库,本文的数据库名glpi,密码glpi(在数据库内执行操作);配置完成后输入 quit; 退出即可

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

8.下载GLPI服务包

8.1进入/var/www/html目录

cd /var/www/html

8.2下载源码:https://github.com/glpi-project/glpi/releases

wget https://github.com/glpi-project/glpi/releases/download/10.0.1/glpi-10.0.1.tgz
tar -zxf glpi-10.0.1.tgz 
chown -R apache:apache /var/www/html
chmod 755 -R /var/www/html/glpi/config/
chmod 755 -R /var/www/html/glpi/files/

8.3修改服务器时间

timedatectl set-timezone Asia/Shanghai

8.4开始进入web界面安装

浏览器输入:http://系统的ip地址/glpi

语言选择中文,后面的根据实际情况安装即可

默认登录账号/密码:glpi/glpi

9.安装fusioninventory插件

cd /var/www/html/glpi/plugins/
wget https://github.com/fusioninventory/fusioninventory-for-glpi/releases/download/glpi10.0.1%2B1.0/fusioninventory-10.0.1+1.0.zip
yum install -y unzip
unzip fusioninventory10.0.1+1.0.zip

网页打开安装并启用

GLPI资产管理系统+fusioninventory_html_02



10.下载client

https://github.com/fusioninventory/fusioninventory-agent/releases/download/2.6/fusioninventory-agent_windows-x64_2.6.exe

编写bat自动安装的脚本(与fusioninventory-agent_windows-x64_2.6.exe同一目录下):

@echo off

set "AGENT_PATH=%~dp0\fusioninventory-agent_windows-x64_2.6.exe"
set "SERVER_URL=http://192.168.10.11//glpi/plugins/fusioninventory/"
set "GLPI_ACCOUNT= "
set "GLPI_PASSWORD= "

echo Installing FusionInventory Agent...
"%AGENT_PATH%" /acceptlicense /add-firewall-exception /execmode=Service /no-start-menu /runnow /server="http://192.168.10.11//glpi/plugins/fusioninventory/" /installtasks=Deploy,ESX,Inventory,NetDiscovery,NetInventory,WakeOnLan /S

echo Waiting for installation to complete...
ping -n 3 127.0.0.1 >nul

echo Configuring FusionInventory Agent...
echo server = "http://192.168.10.11//glpi/plugins/fusioninventory/" > "C:\Program Files\FusionInventory-Agent\agent.cfg"
echo user = "%GLPI_ACCOUNT%" >> "C:\Program Files\FusionInventory-Agent\agent.cfg"
echo password = "%GLPI_PASSWORD%" >> "C:\Program Files\FusionInventory-Agent\agent.cfg"

echo Starting FusionInventory Agent...
sc start fusioninventory-agent

echo Installation and configuration complete.

其中服务器的地址、账号、密码需自行更改

右键管理员运行bat文件

网页查看强制更新

http://127.0.0.1:62354

几分钟后系统会收集到资产信息

也可通过AD域控批量下发自动安装fusioninventory client

收集公司资产信息