官方文档如下:
官方文档
cd /etc/yum.repos.d/
mkdir repo_bak
mv *.repo repo_bak/
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
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
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
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
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