本文主要介绍如何在centos系统上使用网易yum源
首先备份/etc/yum.repos.d/CentOS-Base.repo
mkdir /etc/yum.repos.d/bak
mv
/etc/yum.repos.d/* /etc/yum.repos.d/bak
根据CentOS版本选择操作
CentOS-5
# wget -O /etc/yum.repos.d/CentOS-Base.repo
# yum makecache
CentOS-6
# wget -O /etc/yum.repos.d/CentOS-Base.repo
# yum makecache
验证yum源
yum --list
能出来东西就可以了。
-----------------------------------------
今天拓展一下.有时候你在虚拟机上做实验.yum装一个东西 如snmp.你想把yum下载的rpm包拷贝出来方便以后写一键安装脚本的时候使用
这时你就需要设置下yum的配置文件 /etc/yum.conf
-
[main]
-
cachedir=/var/cache/yum/$basearch/$releasever
-
keepcache=1 #把keepcache 值改为1
-
debuglevel=2
-
logfile=/var/log/yum.log
-
exactarch=1
-
obsoletes=1
-
gpgcheck=1
-
plugins=1
-
installonly_limit=5
-
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
-
distroverpkg=centos-release
这样yum装好包以后你就可以去
/var/cache/yum/x86_64/6
这个路径去找下载的包了
-
[root@localhost 6]# pwd
-
/var/cache/yum/x86_64/6
-
[root@localhost 6]# tree
-
.
-
├── base
-
│ ├── 617a880b84a87969e04bfeebb1b96d5f441da42ee931d374fa6b6d57decd821e-primary.sqlite
-
│ ├── cachecookie
-
│ ├── mirrorlist.txt
-
│ ├── packages
-
│ │ └── lm_sensors-libs-3.1.1-17.el6.x86_64.rpm
-
│ └── repomd.xml
-
├── extras
-
│ ├── 966094530f6744d0b6a3fc45b10cbd845577945fbd6a43448defbe1fab902c38-primary.sqlite
-
│ ├── cachecookie
-
│ ├── mirrorlist.txt
-
│ ├── packages
-
│ └── repomd.xml
-
├── timedhosts.txt
-
└── updates
-
├── cachecookie
-
├── f16a713c1d63acab0b9e7ac311334b520f5f372f31e811a02b63172da8f46bd5-primary.sqlite
-
├── mirrorlist.txt
-
├── packages
-
│ ├── net-snmp-5.5-49.el6_5.1.x86_64.rpm
-
│ ├── net-snmp-libs-5.5-49.el6_5.1.x86_64.rpm
-
│ └── net-snmp-utils-5.5-49.el6_5.1.x86_64.rpm
-
└── repomd.xml
-
-
6 directories, 17 files