RedHat配置YUM 从centos5源与光盘源更新软件
时间:2010-11-25 来源:chinacloud
配置YUM 从本地光盘更新软件
[root@clinet ~]# mkdir /mnt/cdrom
创建挂载点
[root@clinet ~]# mount /dev/cdrom /mnt/cdrom
挂载光盘
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@clinet /]# ll /etc/yum.repos.d/
total 4
-rw-r--r-- 1 root root 781 Feb 24 03:19 rhel-debuginfo.repo
[root@clinet /]# cd /etc/yum.repos.d/
[root@clinet yum.repos.d]# cp rhel-debuginfo.repo rhel-debuginfo.repo.bak
拷贝为rhel-debuginfo.repo.bak做备份
[root@clinet yum.repos.d]# ll
total 8
-rw-r--r-- 1 root root 781 Feb 24 03:19 rhel-debuginfo.repo
-rw-r--r-- 1 root root 781 Feb 25 00:34 rhel-debuginfo.repo.bak
[root@clinet yum.repos.d]# vi rhel-debuginfo.repo
编辑rhel-debuginfo.repo,插入以下代码
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
其实上面这样设置就已经ok,但是要更新xen.rpm,就更新不到,因为它在/mnt/cdrom/VT下面,为了比较完善,我们修改参数为以下配置
[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 [root@clinet yum.repos.d]# yum clean all 清除缓存及旧的包 Loaded plugins: rhnplugin, security Cleaning up Everything [root@clinet yum.repos.d]# yum install httpd 测试是否能更新软件
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 [root@clinet yum.repos.d]# yum clean all 清除缓存及旧的包 Loaded plugins: rhnplugin, security Cleaning up Everything [root@clinet yum.repos.d]# yum install httpd 测试是否能更新软件
yum常用的源
1) 自动选择最快的源
由於yum中有的mirror速度是非常慢的,如果yum选择了这个mirror,这时yum就会非常慢,对此,可以下载fastestmirror插件,它会自动选择最快的mirror:
#yum install yum-fastestmirror
配置文件:(一般不用改)/etc/yum/pluginconf.d/fastestmirror.conf
你的yum镜像的速度测试记录文件:/var/cache/yum/timedhosts.txt
2)使用图形界面的yum
如果觉得命令行的yum不方便,那么可以使用图形化的yumex,这看起来更方便,因为可以自由地选择软件仓库:
#yum install yumex
然後在系统工具中就可以看到yum extender了。实际上系统自带的“添加/删除程式“也可以实现图形化的软件,但有些yumex的功能它没有。
相关阅读 更多 +