Yum工具使用在线软件仓库从互联网上安装,更新和Linux系统下删除软件包。 它是为CentOS Linux的默认包管理工具,你必须连接到互联网,以便安装和更新包,没有互联网连接yum的命令是行不通的。
从CentOS DVD安装软件包
本文将指导您如何配置CentOS系统使用DVD / CD安装介质源安装软件包,但要确保你的CentOS系统是最新最新的 。
通过YUM安装通过CentOS 6/5 DVD / CD安装软件包
首先,插入CentOS安装DVD / CD 光驱驱动器内并装入/媒体/ cdrom目录下的驱动器,因为每个CentOS的6.x中/ 5.x版具有下/etc/yum.repos默认的CentOS-Media.repo文件.D /包含默认安装所使用的Yum命令来安装软件包DVD / CD的位置(/媒体/ CDROM)。[root@howtoing]# mount /dev/cdrom /media/cdrom
mount: block device /dev/sr0 is write-protected, mounting read-only
如果你看到类似的消息,那么就意味着设备已正确安装为只读/媒体/ cdrom目录下的模式。 接下来,VI编辑和更改开放的CentOS-Media.repo配置文件“ 已启用= 0”到“ 启用= 1”并保存文件。[root@howtoing# vi /etc/yum.repos.d/CentOS-Media.repo# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
# CentOS-6. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c6-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
该文件使用默认CDROM / DVD(即/媒体/ CDROM /),作为从安装DVD安装软件包回购安装位置。 若要安装与YUM包使用基于你的CentOS版本,下面的命令。 例如,下面的命令将利用媒体作为回购安装猞猁包。
对于CentOS 6.x[root@howtoing# yum --disablerepo=\* --enablerepo=c6-media install lynx
对于CentOS 5.x[root@howtoing# yum --disablerepo=\* --enablerepo=c5-media install lynx
样品输出:Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* c6-media:
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package lynx.i686 0:2.8.6-27.el6 will be installed
--> Processing Dependency: redhat-indexhtml for package: lynx-2.8.6-27.el6.i686
--> Running transaction check
---> Package centos-indexhtml.noarch 0:6-1.el6.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================
PackageArchVersionRepositorySize
==================================================================================================
Installing:
lynxi6862.8.6-27.el6c6-media1.3 M
Installing for dependencies:
centos-indexhtml noarch6-1.el6.centosc6-media70 k
Transaction Summary
==================================================================================================
Install 2 Package(s)
Total download size: 1.4 M
Installed size: 4.7 M
Is this ok [y/N]: y
Downloading Packages:
----------------------------------------------------------------------------------------------------------------
Total527 kB/s | 1.4 MB 00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : centos-indexhtml-6-1.el6.centos.noarch1/2
Installing : lynx-2.8.6-27.el6.i686 2/2
Verifying : lynx-2.8.6-27.el6.i686 1/2
Verifying : centos-indexhtml-6-1.el6.centos.noarch 2/2
Installed:
lynx.i686 0:2.8.6-27.el6
Dependency Installed:
centos-indexhtml.noarch 0:6-1.el6.centos
Complete!
而已! 如果您正在寻找更多的yum命令选项来安装和删除软件包,请阅读以下包含yum命令实际示例的文章。