CentOS 安装完毕,首先应该修改更新源,并升级到最新的系统。
国内速度比较快的更新源,我推荐:
http://mirrors.163.com 网易的更新源,刚发现的,速度还可以。
首先我们得先备份系统先前的配置文件CentOS-Base.repo:
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
编辑yum的配置文件:
sudo vi /etc/yum.repos.d/CentOS-Base.repo
把CenOS-Base-repo内文件的中的mirrorlist注释掉,然后把baseurl前的注释去掉,然后把源地址改为网易的
配置文件的内容为:
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
其中:
repositoryid:用于指定一个仓库
name:用于指定易读的仓库名称
baseurl:用于指定本仓库的URL,可以是以下的3种类型,如http,ftp,file
mirrorlist:用于指定仓库的镜像站点
enable:用于指定是否使用本仓库,默认值为1,即可用。
gpgcheck:用于指定是否检查软件包的GPG签名。
gpgkey:用于指定GPG签名文件的URL。
本人一般都是用root超级用户
如果是普通用户就在命令最前面加上sudo
执行命令:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
rpm update