centOS7安装GLPI 和fusioninventory插件
centOS7安装GLPI,
一、关闭防火墙(不关闭只能本机访问):
systemctl stop firewalld.service #停止firewalld服务
systemctl disable firewalld.service #设置开机默认不启动
#生产环境单独在防火墙上开启端口和策略
# firewall-cmd --permanent --zone=public --add-port=80/tcp
# firewall-cmd --reload
二、关闭selinux(不关闭会提示无权限):
getenforce #查看状态,Enforcing为开启,Permissive为关闭
setenforce 0#设置当前状态为关闭
vi /etc/sysconfig/selinux #设置开机不启动 修改内容为 SELINUX=disabled
三、更新contos7系统
yum -y install epel-release
yum update -y
如提示var/run/yum.pid 被锁定可运行“rm -f /var/run/yum.pid ”解锁
二、安装Apache服务并启动
yum install -y httpd httpd-devel
service httpd start
systemctl enable httpd #开机启动
三、安装PHP及其他依赖软件
1.配置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
2.安装php及依赖
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
3.php -v #查看安装的php版本,低于7.4不能运行glpi10。
五、安装数据库
1.安装新版MariaDB
vim /etc/yum.repos.d/mariadb.repo
修改配置文件如下:按i编辑,按esc退出编辑,按:号进入命令,输入wq保存退出,输入q!不保存退出。版本号可按新版更改。
[mariadb]
name = MariaDB
baseurl = http://mirrors.aliyun.com/mariadb/yum/10.8.2/centos7-amd64/
gpgkey = http://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1
2、重新缓存
yum clean all
yum makecache
yum repolist
3、安装与配置
yum -y install MariaDB-server MariaDB-client # yum安装MariaDB
systemctl start mariadb.service #启动mariadb
systemctl enable mariadb.service #设置开机启动
六、配置数据库
1、登入
mysql -uroot -p
输入密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!'; #修改root密码
2、新建数据库
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'@'%';
quit
七、下载glpi和fusioninventory-10.0.31.0
1.百度网盘
链接:https://pan.baidu.com/s/1HLGZHwtzF5p9FaLin-b3Yw
提取码:szjz
2官网
https://glpi-project.org/downloads/
2.1 下载解压glpi安装包
wget https://github.com/glpi-project/glpi/releases/download/10.0.0/glpi-10.0.0.tgz -P /opt
tar -xvf /opt/glpi-10.0.0.tgz #解压
2.2 移动安装包到Apache的目录下,修改权限
mv glpi /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/
2.3重启apache服务
service httpd restart
八、使用浏览器登入“主机ip/glpi"设置即可
数据库地址填写localhost。账号密码为“四2的第二行设置的”
九、fusioninventory插件下载和使用
9.1 https://github.com/fusioninventory/fusioninventory-for-glpi/releases
tar -xvf fusioninventory-10.0.31.0.zip /var/www/html/glpi/plugins
安装并启用fusioninventory插件
Windows资产脚本一键安装fusioninventory-agent
脚本:
:x64
echo "---------------------------------------------------------"
echo "install fusioninventory-agent_windows-x64_2.6.exe"
%~dp0\fusioninventory-agent_windows-x64_2.6.exe /acceptlicense /add-firewall-exception /execmode=Service /no-start-menu /runnow /server='http://192.168.0.226/glpi/plugins/fusioninventory/' /installtasks=Deploy,ESX,Inventory,NetDiscovery,NetInventory,WakeOnLan /S
echo "install session"
ping -n 3 127.0.0.1 >nul
echo "send computer information to GLPI Server"
call "C:\Program Files\FusionInventory-Agent\fusioninventory-agent.bat"
echo "---------------------------------------------------------"
ping -n 3 127.0.0.1>nul
十、Linux资产安装fusioninventory-agent
yum install -y fusioninventory-agent fusioninventory-agent-task-inventory
vim /etc/fusioninventory/agent.cfg
修改15列#server = http://server.domain.com/glpi/plugins/fusioninventory/为
server = http://192.168.0.226/glpi/plugins/fusioninventory/
或者
sed -i "s@#server = http://server.domain.com/glpi/plugins/fusioninventory/@server = http://192.168.0.226/glpi/plugins/fusioninventory/@g" /etc/fusioninventory/agent.cfg
systemctl start fusioninventory-agent
systemctl enable fusioninventory-agent
firewall-cmd --permanent --zone=public --add-port=62354/tcp
firewall-cmd --reload
fusioninventory-agent --server http://192.168.0.226/glpi/plugins/fusioninventory/ --daemon
十 一、学习资料
https://zhuanlan.zhihu.com/p/506086946
https://blog.51cto.com/u_64214/8925460?articleABtest=0