[1] 首先备份/etc/yum.repos.d/CentOS-Base.repo
mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.backup
[root@localhostyum.repos.d]#cd/etc/yum.repos.d/
[3] 下载163的yum源配置文件,放入/etc/yum.repos.d/(操作前请做好相应备份)
[root@localhostyum.repos.d]#
[4] 运行yum makecache生成缓存
[5] 更新系统[6] 安装vim编辑器[root@localhost~]#
一、配置yum源
网易(163)yum源是国内最好的yum源之一 ,无论是速度还是软件版本,都非常的不错,将yum源设置为163yum,可以提升软件包安装和更新的速度,同时避免一些常见软件版本无法找到。具体设置方法如下:
1,进入yum源配置目录
1
|
#cd/etc/yum.repos.d
|
2,备份系统自带的yum源
#mvCentOS-Base.repoCentOS-Base.repo.bk |
下载163网易的yum源:
#wgethttp://mirrors.163.com/.help/CentOS6-Base-163.repo |
3,更新玩yum源后,执行下边命令更新yum配置,使操作立即生效
#yummakecache |
4,除了网易之外,国内还有其他不错的yum源,比如中科大和搜狐的,大家可以根据自己需求下载
中科大的yum源:
#wgethttp://centos.ustc.edu.cn/CentOS-Base.repo |
sohu的yum源
#wgethttp://mirrors.sohu.com/help/CentOS-Base-sohu.repo |
理论上讲,这些yum源redhat系统以及fedora也是可以用 的,但是没有经过测试,需要的可以自己测试一下。
二、安装yum-downloadonly,下载rpm软件包
方法1、安装yum-downloadonly插件,下载rpm包;
1
2
3
|
#wget-O/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-5.repo
#yuminstallyum-downloadonly
#yuminstall--downloadonly--downloaddir=/Nginx.rpmpcre
|
如果下载不到yum-downloadonly这个软件包,请查看附件,下载之后解压缩,上传到linux上,进行安装。
方法2、修改配置文件/etc/yum.conf,将keepcache=0 修改为keepcache=1
通过yum安装的软件将会在下面的cachedir中缓存。
cachedir=/var/cache/yum/$basearch/$releasever
例如:
#cd/var/cache/yum/x86_64/6/base/packages/
libpcap-1.4.0-4.20130826git2dbcaa1.el6.x86_64.rpm
tcpdump-4.0.0-9.20090921gitdf3cb4.2.el6.x86_64.rpm
|
三、使用CentOS的iso搭建本地yum源
3
4
5
6
7
8
9
10
11
12
13
@H_502_228@
14
15
16
17
18
19
20
21
22
|
#ls/etc/yum.repos.d/
#CentOS-Base.repoCentOS-Media.repo
#cp/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.bak
#vim/etc/yum.repos.d/CentOS-Base.repo
1[dvd]
2name=
install
dvd
3baseurl=
file
:
///media/CentOS_6
.5_Final
#iso的挂载路径
4
enable
=1
5gpgcheck=1
#是否对下载的rpm包进行安全检查
6gpgkey=
///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#yummakecache
Loadedplugins:fastestmirror
Loadingmirrorspeedsfromcachedhostfile
dvd|1.1kB00:00
dvd
/filelists
|2.9MB00:00
/other
|9.1MB00:00
/group
|920kB00:00
/primary
|920kB00:00
dvd2599
/2599
/2599
/2599
MetadataCacheCreated
|
cat rhel-debuginfo.repo
[Cluster]
name=Red Hat Enterprise Linux $releasever - $basearch - Cluster
baseurl=file:///mnt/cdrom/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[ClusterStorage]
name=Red Hat Enterprise Linux $releasever - $basearch - ClusterStorage
baseurl=file:///mnt/cdrom/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[Server]
name=Red Hat Enterprise Linux $releasever - $basearch - Server
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[VT]
name=Red Hat Enterprise Linux $releasever - $basearch - VT
baseurl=file:///mnt/cdrom/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
原文链接:https://www.f2er.com/centos/378755.html