IT資產管理解決方案 CentOS+OCS+GLPI

OCS Inventory NG(Open Computer and Software Inventory Next Generation)是一款系統管理軟件

主要功能


1. 操作系統爲CentOS5.2

2. OCS Inventory 與GLPI 的web目錄放在/var/www/html和/var/www/htmltwo(我建的目錄),用chown –R apache:apache 目錄,修改上面兩個目錄的權限。(我遇到問題:後面安裝的GLPI無法訪問。我的解決辦法:分成兩個目錄後,我用虛擬主機的方式指定相同的IP,不同的端口訪問。)

#vi /etc/httpd/conf/httpd.conf

添加:

DocumentRoot /var/www/html/ocsreports

DocumentRoot /var/www/html/glpi

Options FollowSymLinks

AllowOverride None

Order alow,deny

Allow from all

 

安裝準備:定義yum的非官方庫

#vi /etc/yum.repos.d/dag.repo

[dag]

Name=Dag RPM Repository for Red Hat Enterprise Linux

Baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag

Gpgcheck=1

Enabled=1

Gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

 

網絡設置,設置網卡靜態IP:

Ifconfig eth0 192.168.1.7  netmask 255.255.255.0 (即時生效,系統重啓後還是會讀/etc/sysconfig/network-scripts/ifcfg-eth0) 

DNS 設置: /etc/resolv.conf  網關設置:/etc/sysconfig/network

配置開發環境:

#yum install -y gcc gcc-c++ glibc-devel glibc-headers autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libXpm libX11 libxml2-devel gettext-devel pcre-devel mysql mysql-server httpd php php-devel php-gd php-pecl-zip php-mysql php-devel php-pear php-imap php-ldap php-odbc php-xml php-xmlrpc mod_perl

 配置Perl環境

#yum install –y perl mod_perl

#yum install perl-XML-Simple perl-Compress-Zlib perl-DBI perl-DBD-MySQL perl-Net-IP perl-XML-SAX perl-Apache2-SOAP perl-Apache-DBI

Perl需要手動安裝的模塊

安裝SOAP-Lite

#tar –zxvf SOAP-Lite-0.69.tar.gz

#cd SOAP-Lite-0.69

#perl Makefile.PL

#make

#make test

#make install

安裝XML-Entities

#tar –zxvf XML-Entities-0.0307.tar.gz

#cd XML-Entities-0.0307

#perl Makefile.PL

#make

#make test

#make install

安裝Digest-SHA1.2.02

#tar –zxvf Digest-SHA1.2.02.tar.gz

#cd Digest-SHA1.2.02

#perl Makefile.PL

#make test

#make

#make install

數據庫服務和Apache服務

#service mysqld start     MySQL服務開啓

#service httpd start       Apache服務開啓

#chkconfig mysqld on      MySQL服務設爲開機啓動

#chkconfig httpd on       Apache服務設爲開機啓動

#vi /etc/httpd/conf/httpd.conf   配置Apache對PHP的支持

添加如下兩行:

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

定位至:DirectoryIndex index.html  

修改爲:DirectoryIndex index.php index.html

#chown –R apache:apache /var/www/html

Service httpd restart

修改MySQL root 密碼

#/usr/bin/mysqladmin –u root password ‘123456’ 數據庫管理員用戶和密碼設置

iptables 設置     

#vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT

-A RH-Firewall-1-INPUT –m tcp –dport 8080 –j ACCEPT

#service iptables restart

安裝OCS Inventory

#tar –zxvf OCSNG_UNIX_SERVER-1.3.2-linvinus-with-utf8_patch.tar.gz

#cd OCSNG_UNIX_SERVER-1.3.2

#sh setup.shy

注意事項:

Where to copy Administration Server static files for PHP Web Console
[/usr/share/ocsinventory-reports] ?/var/www/html/ 選擇WEB文件存放的路徑。

瀏覽器地址欄輸入:http://serverip/ocsreports/install.php,就可以配置了。

 安裝GLPI

Json和php-mbstring安裝

#yum install php-mbstring

Wget http://percl.php.net/get/json -o json-1.2.1.tgz

Tar –xf json-1.2.1.tgz

Cd json-1.2.1

Phpize

./configure

Make

Make install

Echo “extenson=json.so” >> /etc/php.ini 或vi /etc/php.ini,在最後一行添加:extension=json.so

Service httpd restart

測試json是否安裝成功

#php –r ‘var_dump(function_exists(“json_encode”));’

如果返回信息爲bool(true),說明安裝成功。

#tar –zxvf plpi-0.78-RC2.tar.gz

#cp –a glpi /var/www/html

#chown –R apache:apache /var/www/html/glpi

讓GLPI支持中文

0.78版進入glpi安裝目錄,修改/inc/dbmysql.class.php文件,定位到$this->dbenc 修改”latin1″爲”utf8″ 即可

0.74及以前版本在/inc/ocsng.class.php文件中修改

 配置GLPI

瀏覽器輸入http://serverip/glpi

1.環境檢測

2.選擇語言

3.輸入數據庫帳號

4.創建新的GLPI數據庫

5.完成

默認管理員:glpi,密碼:glpi

 linux客戶端安裝配置

#yum install –y perl-XML-Simple perl-Compress-Zlib perl-Net-IP perl-LWP perl-Digest-MD5 PERL-Net-SSLeay perl-Crypt-SSLeay perl-XML-SAX perl-XML-LibXML perl-Proc-Daemon perl-PID-File

No package perl-LWP available

No package perl-Digest-MD5 available

#perl -MCPAN –e ‘install Proc::Daemon’

#perl-MCPAN –e ‘install Proc::PID::File’

從鏡像點下載下來的包會保存在以下目錄

#ll /root/.cpan/build

下載:OCSNG_LINUX_AGENT

#wget http://lwlp.googlecode.com/files/OCSNG_LINUX_agent_1.1.2.tar.gz

#tar –zxvf OCSNG_LINUX_AGENT_1.1.2.tar.gz –C /opt/src

#cd /opt/src/OCSNG_LINUX_AGENT_1.1.2

#cp ipdiscover /usr/sbin/ipdisconver

#perl Makefile.PL

#make

#make install

以下提示一路回車

Do you want to configure the agent

Please enter 'y' or 'n'?> [y]

Where do you want to write the configuration file?

 0 -> /etc/ocsinventory

 1 -> /usr/local/etc/ocsinventory

 2 -> /etc/ocsinventory-agent

?> 2 (選擇配置文件存放目錄)

Do you want to create the directory /etc/ocsinventory-agent?

Please enter 'y' or 'n'?> [y]

[info] The config file will be written in /etc/ocsinventory/ocsinventory-agent.cfg,

What is the address of your ocs server?> [ocsinventory-ng] 192.168.50.92(輸入ocsinventory-server的ip地址)

Do you need credential for the server? (You probably don't)

Please enter 'y' or 'n'?> [n]

Do you want to apply an administrative tag on this machine

Please enter 'y' or 'n'?> [y] (該服務器是否使用管理標籤)

tag?> viong (顯示在web管理控制界面中)

ocsinventory agent presents: /usr/bin/ocsinventory-agent

Where do you want the agent to store its files? (You probably don't need to change it)?> [/var/lib/ocsinventory-agent]

Do you want to create the /var/lib/ocsinventory-agent directory?

Please enter 'y' or 'n'?> [y]

New settings written! Thank you for using OCS Inventory

Should I remove the old linux_agent

Please enter 'y' or 'n'?> [n]

Do you want to use OCS-Inventory software deployment feature?

Please enter 'y' or 'n'?> [y]

Do you want to use OCS-Inventory SNMP scans feature?

Please enter 'y' or 'n'?> [y]

Do you want to send an inventory of this machine?

Please enter 'y' or 'n'?> [y]

[info] Accountinfo file doesn't exist. I create an empty one.

  -> Success!

看到以上信息,說明安裝成功

[root@localhost Ocsinventory-Agent-2.0rc2]# ocsinventory-agent –debug

………………………………………….省略

[debug] Calling handlers : `end_handler'

 Windows平臺,分發OCS客戶端

http://www.renren.it/a/bianchengyuyan/PHP/20110618/75702.html

 設置GLPI用OCSNG方式

http://www.opboy.com/archives/tag/ocsglpi

 參考:

1. http://www.centospub.com/make/newenv.html

2. http://www.opboy.com/archives/tag/ocsglpi

3. http://viong.blog.51cto.com/844766/503694

4. http://www.renren.it/a/bianchengyuyan/PHP/20110618/75702.html


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章