在某些环境下不能访问外网,这时采用完全版光盘为安装源也是一个选择,
环境:CentOS release 5.5 (Final)
1,挂载系统盘(DVD版CentOS-5.5-i386-bin-DVD.iso)光驱:
mkdir /media/cdrom
mount /dev/cdrom /media/cdrom
2,保留安装库文件:
/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-5. 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=c5-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c5-media [command]
[c5-media]
name=CentOS-$releasever - Media
baseurl=file:///media/cdrom/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
3,测试yum安装源:
[root@localhost cdrom]# yum --enablerepo=c5-media info vsftpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Installed Packages
Name : vsftpd
Arch : i386
Version : 2.0.5
Release : 16.el5_4.1
Size : 285 k
Repo : installed
Summary : vsftpd - 非常安全 Ftp 守护进程
URL : http://vsftpd.beasts.org/
License : GPL
Description: vsftpd 是一个非常安全 FTP 守护进程。它是完全从零开始
: 编写的。
4,常用yum命令:
删除CentOS5的图形界面软件包:
yum --enablerepo=c5-media --disableplugin=fastestmirror groupremove "GNOME Desktop Environment"
yum --enablerepo=c5-media --disableplugin=fastestmirror groupremove "X Window System"
安装中文环境语言相关包:
yum --enablerepo=c5-media --disableplugin=fastestmirror groupinstall "chinese-support"
特定组件包信息yum groupinfo xxxx
所有可用组件包信息yum grouplist xxxx
软件相关安装信息yum info xxx
搜寻给定字串的软件yum search xxx
删除一个软件yum erase xxx
安装一个软甲yum install xxx
详细见yum --help