当前位置:   article > 正文

搭建glpi(IT资产管理系统)

glpi

目录

1.环境准备

2.安装环境依赖

3.安装mariadb

4.安装httpd

5.源码:glpi-project

6.修改服务器的时间:

7.安装fusioninventory插件(fusioninventory)

8.Client(Windows agent):fusioninventory-agent_windows-x64_2.6.exe

9.Client(Linux agent)


IP主机名系统
172.25.250.103服务器Linux
172.25.250.1Client01Windows
172.25.250.101Client02Linux

1.环境准备

系统环境:centos7
mariadb:10.5.18
php:7.4.33
apache:2.4.6

  1. #关闭selinux
  2. setenforce 0
  3. #关闭防火墙
  4. systemctl stop firewalld
  5. #拉取cento7的阿里云网络源
  6. curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  7. curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  8. sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
  9. yum install epel-release -y
  10. rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm

2.安装环境依赖

  1. 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
  2. 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

3.安装mariadb

  1. #配置mariadb的yum源
  2. cat >> /etc/yum.repos.d/mariadb.repo << EOF
  3. [mariadb]
  4. name = MariaDB
  5. baseurl = https://mirrors.aliyun.com/mariadb/yum/10.5/centos7-amd64
  6. gpgkey = https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
  7. gpgcheck = 1
  8. EOF
  1. yum makecache
  2. yum -y install MariaDB-server MariaDB-client
  3. systemctl start mariadb

 配置mariadb

  1. #初始化数据库
  2. mysql_secure_installation
  3. #登录数据库
  4. mysql -uroot -p
  5. use mysql
  6. #创建数据库用户,并给予远程数据库的权限
  7. create user'glpi'@'%' IDENTIFIED BY 'redhat';
  8. grant all privileges ON *.* TO 'glpi'@'%' IDENTIFIED BY 'redhat';
  9. create database glpi;
  10. flush privileges;

4.安装httpd

  1. yum install -y httpd httpd-devel
  2. systemctl start  httpd
  3. systemctl enable httpd

5.源码:glpi-project

  1. #下载源码:https://github.com/glpi-project/glpi/releases
  2. wget https://github.com/glpi-project/glpi/releases/download/10.0.1/glpi-10.0.1.tgz
  3. tar -zxf glpi-10.0.1.tgz
  4. cp glpi/* /var/www/html/. -R
  5. chown -R apache:apache /var/www/html
  6. chmod 755 -R /var/www/html/config/
  7. chmod 755 -R /var/www/html/files/

网页访问:http://服务器IP/glpi/

http://服务器IP/glpi/

6.修改服务器的时间:

  1. vim /etc/php.ini
  2. date.timezone = Asia/Shanghai
  3. #重启httpd服务
  4. systemctl restart httpd

7.安装fusioninventory插件(fusioninventory

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

网页打开安装并启用
http://服务器IP/front/marketplace.php

http://服务器IP/front/marketplace.php

8.Client(Windows agent):
fusioninventory-agent_windows-x64_2.6.exe

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

  1. :x64
  2. echo "_____________________________________________"
  3. echo "install fusioninventory-agent_windows-x64_2.6.exe"
  4. %~dp0\fusioninventory-agent_windows-x64_2.6.exe /acceptlicense /add-firewall-exception /execmode=Service /no-start-menu /runnow /server='http://172.25.250.103/plugins/fusioninventory/' /installtasks=Deploy,ESX,Inventory,NetDiscovery,NetInventory,WakeOnLan /S
  5. echo "install session"
  6. ping -n 3 127.0.0.1>nul
  7. echo "send computer information ti GLPI Server"
  8. call "D:\迅雷下载\fusioninventory-agent.bat"
  9. echo "_____________________________________________"
  10. ping -n 3 127.0.0.1>nul

 右键管理员运行bat文件

网页查看:http://127.0.0.1:62354

http://127.0.0.1:62354

 生成的内容返回到服务器上

9.Client(Linux agent):

  1. yum install -y fusioninventory-agent fusioninventory-agent-task-inventory
  2. sed -i "s@#server = http://server.domain.com/glpi/plugins/fusioninventory/@server = http://服务器IP/plugins/fusioninventory/@g" /etc/fusioninventory/agent.cfg
  3. #开启服务并设置开机自启
  4. systemctl start fusioninventory-agent
  5. systemctl enable fusioninventory-agent
  6. #防火墙放行62354端口
  7. firewall-cmd --permanent --zone=public --add-port=62354/tcp
  8. firewall-cmd --reload
  9. #后台运行
  10. fusioninventory-agent --server http://服务器IP/plugins/fusioninventory/ --daemon

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/534960
推荐阅读
相关标签
  

闽ICP备14008679号