实验目标
掌握YUM 的配置
实验步骤
放入RHEL5.9 iso,确保电源OK(/misc/cd)
客户端配置
[root@localhost~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
rhel-debuginfo.repo
[root@localhostyum.repos.d]# cp rhel-debuginfo.repo rh-server5.9.repo
[root@localhostyum.repos.d]# cat rh-server5.9.repo
[rhel-debuginfo]
name=RedHat Enterprise Linux $releasever - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@localhostyum.repos.d]# vim rh-server5.9.repo
[root@localhostyum.repos.d]# cat rh-server5.9.repo
[server]
name=RedHat Enterprise Linux Server
baseurl=file:///misc/cd/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@localhostyum.repos.d]#
YUM命令的使用
1》yumlist vsftpd
[root@localhost~]# yum list vsftpd
Loadedplugins: product-id, security, subscription-manager
Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.
AvailablePackages
vsftpd.x86_64 2.0.5-28.el5 server
[root@localhost~]#
2》yumsearch vsftpd
[root@localhost~]# yum search vsftpd
Loadedplugins: product-id, security, subscription-manager
Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.
=================================Matched: vsftpd =================================
vsftpd.x86_64: vsftpd - 非常安全Ftp 守护进程
3》yuminfo firefox
[root@localhost~]# yum info firefox
Loadedplugins: product-id, security, subscription-manager
Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.
InstalledPackages
Name : firefox
Arch : i386
Version : 10.0.11
Release : 1.el5_8
Size : 23 M
Repo : installed
Summary : Mozilla Firefox 网页浏览器。
URL :http://www.mozilla.org/projects/firefox/
License : MPLv1.1 or GPLv2+ or LGPLv2+
Description:Mozilla Firefox 是一个开源的万维网浏览器,它的设计目的
: 是服从标准、高性能、和可移植性。
Name : firefox
Arch : x86_64
Version : 10.0.11
Release : 1.el5_8
Size : 23 M
Repo : installed
Summary : Mozilla Firefox 网页浏览器。
URL : http://www.mozilla.org/projects/firefox/
License : MPLv1.1 or GPLv2+ or LGPLv2+
Description:Mozilla Firefox 是一个开源的万维网浏览器,它的设计目的
: 是服从标准、高性能、和可移植性。
[root@localhost~]#
4》yum-y install httpd
[root@localhost~]# yum -y install httpd
Loadedplugins: product-id, security, subscription-manager
Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.
Settingup Install Process
ResolvingDependencies
-->Running transaction check
--->Package httpd.x86_64 0:2.2.3-74.el5 set to be updated
server/filelists |2.9 MB 00:00
-->Finished Dependency Resolution
DependenciesResolved
===================================================================================
Package Arch Version Repository Size
===================================================================================
Installing:
httpd x86_64 2.2.3-74.el5 server 1.3 M
TransactionSummary
===================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Totaldownload size: 1.3 M
DownloadingPackages:
Runningrpm_check_debug
RunningTransaction Test
FinishedTransaction Test
TransactionTest Succeeded
RunningTransaction
Installing : httpd 1/1
error:failed to stat /media/RHEL_5.9 x86_64 DVD: No such file or directory
Installed:
httpd.x86_64 0:2.2.3-74.el5
Complete!
[root@localhost~]#
5》yum-y remove httpd
[root@localhost~]# yum -y remove httpd
Loadedplugins: product-id, security, subscription-manager
Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.
Settingup Remove Process
ResolvingDependencies
-->Running transaction check
--->Package httpd.x86_64 0:2.2.3-74.el5 set to be erased
-->Finished Dependency Resolution
DependenciesResolved
===================================================================================
Package Arch Version Repository Size
===================================================================================
Removing:
httpd x86_64 2.2.3-74.el5 installed 3.3 M
TransactionSummary
===================================================================================
Remove 1 Package(s)
Reinstall 0 Package(s)
Downgrade 0 Package(s)
DownloadingPackages:
Runningrpm_check_debug
RunningTransaction Test
FinishedTransaction Test
TransactionTest Succeeded
RunningTransaction
Erasing : httpd 1/1
error:failed to stat /media/RHEL_5.9 x86_64 DVD: 没有那个文件或目录
Removed:
httpd.x86_64 0:2.2.3-74.el5
Complete!
[root@localhost~]#
6》yumprovides /etc/passwd
[root@localhost ~]# yum provides/etc/passwd
Loadedplugins: product-id, security, subscription-manager
Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.
setup-2.5.58-9.el5.noarch: 一套系统配置和设置文件。
Repo : server
Matchedfrom:
Filename : /etc/passwd
setup-2.5.58-9.el5.noarch: 一套系统配置和设置文件。
Repo : installed
Matchedfrom:
Other : Provides-match: /etc/passwd
[root@localhost~]#
结果验证
[root@localhost~]# yum clean all
Loadedplugins: product-id, security, subscription-manager
Thissystem is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.
Cleaningup Everything
[root@localhost~]# rpm -qa |wc -l
899
[root@localhost~]# yum list | wc -l
3348
[root@localhost~]#
问题和经验总结
故障现象:
地址写错或者使用了系统自动挂载的地址,导致YUM无法使用
解决办法:更改正确的地址,将系统自动挂载的地址改为手动挂载的地址
本文出自 “IT” 博客,请务必保留此出处http://9265605.blog.51cto.com/9255605/1545413
原文地址:http://9265605.blog.51cto.com/9255605/1545413