1,掛載光盤
mount /dev/cdrom/mnt/media
2,新建本地yun源的配置文件
vi /etc/yum.repos.d/local.repo
加入以下信息:
[Local]
name=Local
baseurl=file:///mnt/media
enable=1
gpgcheck=0
rpm -aq|grep yum|xargs rpm -e --nodeps
Wget -c http://mirrors.163.com/centos/6.4/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
wget -c http://mirrors.163.com/centos/6.4/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
wget -c http://mirrors.163.com/centos/6.4/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget -c http://mirrors.163.com/centos/6.4/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
(1)rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
(2)rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
(3) 兩個一起安裝先後順序不要亂(中間50%正常)
rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpmyum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
(1)清空yum倉庫
# cd /etc/yum.repos.d/
#rm -rf *
(2)設置源
# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
# vi CentOS6-Base-163.repo
編輯文件,把文件裡面所有的$releasever全部替換為你得版本號,即6.4 最後保存!或者直接把下面的內存拷貝到CentOS6-Base-163.repo文件中即可(已經修改好)
#################################################################
# CentOS-Base.repo
#
# The mirrorsystem uses the connecting IP address of the client and the
# update status ofeach mirror to pick mirrors that are updated to and
# geographicallyclose to the client. You should use thisfor CentOS updates
# unless you aremanually picking other mirrors.
#
# If the mirrorlist=does not work for you, as a fall back you can try the
# remarked outbaseurl= line instead.
#
#
[base]
name=CentOS-6.4 -Base - 163.com
baseurl=http://mirrors.163.com/centos/6.4/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.4&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-6.4 -Updates - 163.com
baseurl=http://mirrors.163.com/centos/6.4/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.4&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additionalpackages that may be useful
[extras]
name=CentOS-6.4 -Extras - 163.com
baseurl=http://mirrors.163.com/centos/6.4/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.4&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additionalpackages that extend functionality of existing packages
[centosplus]
name=CentOS-6.4 -Plus - 163.com
baseurl=http://mirrors.163.com/centos/6.4/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.4&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#contrib -packages by Centos Users
[contrib]
name=CentOS-6.4 -Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6.4/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.4&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#####################################################################
# yum clean all
# yum makecache #將服務器上的軟件包信息緩存到本地,以提高搜索安裝軟件的速度
# yum installvim* #測試域名是否可用
至此,Redhat6可以使用CentOS的yum源在線安裝軟件了!
6.使用 # yum update
或 # yum upgrade 升級系統
注:兩個命令區別:
# yum update
升級所有包,改變軟件設置和系統設置,系統版本內核都升級
# yum -y upgrade
升級所有包,不改變軟件設置和系統設置,系統版本升級,內核不改變