CentOS 7 | OCS inventory NG agent | 按照官方文档安装 | CPAN安装与使用

官方文档如下:
官方文档

配置源-可选

备份原来的源

cd /etc/yum.repos.d/
mkdir repo_bak
mv *.repo repo_bak/

下载新的CentOS-Base.repo 到/etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

清除和重新生成缓存

yum clean all
yum makecache
yum update

配置epel

yum list | grep epel-release
yum install -y epel-release
wget -O /etc/yum.repos.d/epel-7.repo  http://mirrors.aliyun.com/repo/epel-7.repo

再来一次缓存操作

yum clean all
yum makecache
yum update

安装包

安装必要的包:

yum install perl-XML-Simple perl-devel perl-Compress-Zlib perl-Net-IP perl-LWP perl-Digest-MD5 perl-Net-SSLeay perl-Data-UUID nmap.x86_64 gcc dmidecode make pciutils

有些包可能没有源,可以通过安装CPAN,使用CPAN安装剩余的包。可以看我这篇博客centos 7 | 安装和使用cpan

安装可选的包:

我这里为了避免缺包,头了点懒

yum install perl-IO-Socket-SSL.noarch perl-Crypt-SSLeay perl-LWP-*  perl-Proc-* perl-Proc-PID-File perl-Net-SNMP perl-Module-Install.noarch perl-Sys-Syslog pciutils smartmontools monitor-edid perl-Module-Install.noarch perl-Sys-CPU.x86_64 perl-XML-Simple-* perl-Compress-*  perl-Net* perl-Parse-* perl-Net-Netmask.noarch

CPAN安装与使用

yum install perl-CPAN 
perl -MCPAN -e shell
cpan[1]>install xxx  #你需要的包

install Net::IP Data::UUID LWP::UserAgent Proc::Daemon Proc::PID::File Net::SNMP Parse::EDID Net::Netmask Nmap::Parser Net::CUPS

Installing UNIX Agent with RPM

下载安装epel与ocs

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 
wget https://rpm.ocsinventory-ng.org/ocsinventory-release-latest.el7.ocs.noarch.rpm
yum install ocsinventory-release-latest.el7.ocs.noarch.rpm epel-release-latest-7.noarch.rpm

安装agent

yum install ocsinventory-agent

配置

vi /etc/ocsinventory/ocsinventory-agent.cfg

修改

server = http://your.ocs.server/ocsinventory
tag = “你的资产标签”
local = /var/lib/ocsinventory-agent的行更改为basevardir =/var/lib/ocsinventory-agent
/usr/sbin/ocsinventory-agent

vi /etc/crontab
00 10 * * * root /usr/sbin/ocsinventory-agent
发布了134 篇原创文章 · 获赞 57 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/stone_fall/article/details/102495566