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