安装Linux/Uuix平台代理的客户端
[root@localhost ~]# yum install -y perl-XML-Simple perl-Compress-Zlib perl-Net-IP perl-Digest-MD5 perl-Net-SSLeay perl-Crypt-SSLeay perl-XML-SAX perl-XML-LibXML Perl-Proc-Daemon perl-PID-File
安装过程提示无法yum到包
Setting up Install Process
No package Perl-Proc-Daemon available.
No package perl-PID-File available.
Package perl-Digest-MD5 is obsoleted by perl, trying to install 4:perl-5.8.8-32.el5_5.2.i386 instead
Resolving Dependencies
直接运行以下命令:
[root@localhost ~]# perl -MCPAN -e 'install Proc::Daemon'
注意:第一次运行perl –MCPAN命令来实现自动安装模块,会提示安装CPAM,一路回车下去,直接最后设置镜像,再选择镜像地址就OK
(Comprehensive Perl Archive Network(CPAN),CPAN 可以以两种方式工作:通过交互 shell 或通过一系列函数,可以将这些函数用作范围较广泛的基于 Perl 脚本的解决方案的一部分。最简单地说,可以使用 CPAN,只通过输入 perl -MCPAN -e "install modulename" 来安装模块,其中 modulename是要安装的包、绑定或完整 Perl 模块的名称)
[root@localhost ~]# perl -MCPAN -e 'install Proc::PID::File'
从镜像点下载下来的包会保存在以下目录
[root@localhost ~]# ll /root/.cpan/build/
总计 8
drwxr-xr-x 4 root root 4096 03-01 01:22 Proc-Daemon-0.07
drwxr-xr-x 2 500 users 4096 03-01 01:24 Proc-PID-File-1.27
[root@localhost ~]# cd /root/soft/
[root@localhostsoft]#Wget http://launchpad.net/ocsinventory-unix-agent/stable-2.0/2.0rc2/+download/Ocsinventory-Agent-2.0rc2.tar.gz
速度很慢!要有点耐心哦
[root@localhost soft]# tar -zxvf Ocsinventory-Agent-2.0rc2.tar.gz
[root@localhost soft]# cd Ocsinventory-Agent-2.0rc2
[root@localhost Ocsinventory-Agent-2.0rc2]# ll
总计 436
-rw-r--r-- 1 1000 1000 289 02-12 04:27 AUTHORS
-rw-r--r-- 1 1000 1000 35114 02-12 04:27 Changes
drwxr-xr-x 2 1000 1000 4096 02-12 04:29 contrib
drwxr-xr-x 7 1000 1000 4096 02-12 04:29 etc
drwxr-xr-x 3 1000 1000 4096 02-12 04:29 inc
drwxr-xr-x 3 1000 1000 4096 02-12 04:29 lib
-rw-r--r-- 1 1000 1000 17987 02-12 04:27 LICENSE
-rw-r--r-- 1 1000 1000 3618 02-12 04:27 Makefile.PL
-rw-r--r-- 1 1000 1000 12728 02-12 04:29 MANIFEST
-rw-r--r-- 1 1000 1000 291449 02-12 04:27 memconf
-rw-r--r-- 1 1000 1000 646 02-12 04:29 META.yml
-rwxr-xr-x 1 1000 1000 8773 02-12 04:27 ocsinventory-agent
-rwxr-xr-x 1 1000 1000 10655 02-12 04:27 postinst.pl
-rw-r--r-- 1 1000 1000 5301 02-12 04:27 README
drwxr-xr-x 4 1000 1000 4096 02-12 04:29 resources
-rw-r--r-- 1 1000 1000 0 02-12 04:29 run-postinst
-rw-r--r-- 1 1000 1000 1474 02-12 04:27 THANKS
drwxr-xr-x 3 1000 1000 4096 02-12 04:29 tools
[root@localhost Ocsinventory-Agent-2.0rc2]# perl Makefile.PL
Please install Compress::Zlib if you use an OCS server prior 1.02.
Please install Crypt::SSLeay if you want to use SSL.
Please install Net::SSLeay if you want to use the software deployment.
Please install nmap or ipdiscover if you want to use the network discover feature.
Net::IP is strongly recommended since it's required to retrieve network information
Please install Proc::Daemon and Proc::PID::File if you want to use the daemon monde.
Checking if your kit is complete...
Looks good
Warning: prerequisite ExtUtils::MakeMaker 6.42 not found. We have 6.30.
Warning: prerequisite LWP 0 not found.
Warning: prerequisite XML::Simple 0 not found.
Writing Makefile for Ocsinventory::Agent
注意:ExtUtils直接更新一下新版本就OK
然后perl Makefile.pl make make install
郁闷的是,centos最小化安装尽然没带make命令,提示
[root@localhost Ocsinventory-Agent-2.0rc2]# make
-bash: make: command not found
解决办法:yum -y install gcc automake autoconf libtool make
接着解决LWP XML-Simple问题,由于XML-Simple的安装包关联到LWP(perl-libwww-perl)包,所以直接yum install perl-XML-Simple就会自动安装上LWP模块
接着重新运行以上命令
[root@localhost Ocsinventory-Agent-2.0rc2]# perl Makefile.PL
Please install Crypt::SSLeay if you want to use SSL.
Please install Net::SSLeay if you want to use the software deployment.
Net::IP is strongly recommended since it's required to retrieve network information
Please install Proc::Daemon and Proc::PID::File if you want to use the daemon monde.
Writing Makefile for Ocsinventory::Agent
问题都解决了,下一步直接编译
[root@localhost Ocsinventory-Agent-2.0rc2]#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'
如果没提示error说明安装OK!
登录OCS服务器端,界面会显示刚刚加入的设备
显示更多信息,可以自己随意加载专栏模块,如下图
本文转自viong 51CTO博客,原文链接:http://blog.51cto.com/viong/503694,如需转载请自行联系原作者