繼上篇【 Linux 】資產管理系統.OCS+GLPI 3-1 安裝流程 (CentOS 6.8)介紹如何安裝OCS Server後,這篇要繼續介紹如何結合GLPI外掛與用戶端的Agent安裝,讓資產監管部分可以達到完整

 

Part 1:GLPI 安裝與連動OCS

STEP 1:準備相關套件

  • OCS Inventory NG
  • GLPI:下載
  • OCS Inventory NG 外掛:下載

 

STEP 2:安裝GLPI主程式

# yum install php56w-xml
# wget https://github.com/glpi-project/glpi/releases/download/0.90.5/glpi-0.90.5.tar.gz

# tar xvf glpi-0.90.5.tar.gz

 

STEP 3:安裝OCS Inventory NG 外掛

# wget https://github.com/pluginsGLPI/ocsinventoryng/releases/download/1.2.2/glpi-ocsinventoryng-1.2.2.tar.gz
# tar xvf glpi-ocsinventoryng-1.2.2.tar.gz
# mv ocsinventoryng/ glpi/plugins/

 

STEP 4:啟用OCS與GLPI連結

「config」-「config」-「Server」-「TRACE_DELETED」

 

STEP 5:建立glpi資料庫

# mysql -u root -p

mysql> create database glpi CHARACTER SET utf8 COLLATE utf8_unicode_ci;
mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY ‘password’;
mysql> FLUSH PRIVILEGES;
mysql> quit

(這邊資料庫是賦予全部使用者權限,有需要權限控管可參考下列指令)
*******************************************************************

mysql> create user 'glpi'@'localhost';
mysql> grant all privileges on glpi.* to 'glpi'@'localhost' identified by 'some_password';
mysql> flush privileges;

STEP 6:首次開啟網頁

# chown -R apache:apache glpi
# http://[Your Server Address]/glpi
# chmod 777 -R ../glip/config
# chmod 777 -R ../glip/files

調整網頁權限
# vi /etc/http/conf/httpd.conf

# AllowOverride None
AllowOverride All

# service httpd restart

跟著精靈步驟往下完成

等待建立資料表

預設登入glpi / glpi

變更預設密碼與刪除install.php檔案

STEP 7:啟用OCS外掛

STEP 8:建立資料庫連結

Part 2:Agent安裝

STEP 1:Windows 版本

Agent 下載

 

STEP 2:Linux 版本

# yum install epel-release
# yum install perl-XML-Simple perl-Compress-Zlib perl-Net-IP perl-libwww-perl perl-Digest-HMAC perl-Digest-SHA1 perl-Net-SSLeay  perl-Crypt-SSLeay perl-Net-SNMP perl-Proc-Daemon perl-Proc-PID-File pciutils smartmontools monitor-edid perl-Sys-Syslog perl-Digest-MD5 perl-Proc-ProcessTable erl-Proc-Daemon monitor-edid libx86
# yum install gcc automake autoconf libtool make

# yum groupinstall “Development Tools”
# yum install ncurses-devel
# yum install qt-devel
# cd /tmp
# wget https://github.com/OCSInventory-NG/UnixAgent/releases/download/2.1.1/Ocsinventory-Unix-Agent-2.1.1.tar.gz
# csinventory-Unix-Agent-2.1.1
# env PERL_AUTOINSTALL=1 perl Makefile.PL

# perl Makefile.PL
# make
# make install
#  perl -MCPAN -e ‘install Proc::Daemon’
# perl -MCPAN -e ‘install Proc::PID::File’
/usr/bin/perl postinst.pl

CentOS 7.X 可直接用 yum安裝
# yum install epel-release
# wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# rpm -Uvh remi-release-7*.rpm
# yum install ocsinventory-agent

加入排程
# cp ../Ocsinventory-Unix-Agent-2.1.1/ocsinventory-agent /etc/cron.hourly/
# crontab -e

* */1 * * * /../Ocsinventory-Unix-Agent-2.1.1/ocsinventory-agent -s [Server IP]