你的位置:首页 > 操作系统

[操作系统]Linux 修改yum源


步骤如下:

执行如下命令,查看yum包

rpm -qa|grep yum

image_thumb[2]

执行如下命令,卸载原有源

rpm -qa | grep yum | xargs rpm -e --nodeps

image_thumb[3]

下载新的yum包

wget http://centos.ustc.edu.cn/centos/6/os/i386/Packages/yum-3.2.29-22.el6.centos.noarch.rpmwget http://centos.ustc.edu.cn/centos/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm wget http://centos.ustc.edu.cn/centos/6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-10.el6.noarch.rpm

执行如下命令,安装新的yum包

rpm -ivh yum-*

image_thumb

下载yum的配置源

wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo

修改配置源,内容如下:

[base]name=CentOS-6 - Basebaseurl=http://centos.ustc.edu.cn/centos/6/os/$basearch/gpgcheck=1gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6#released updates[update]name=CentOS-6 - Updatesbaseurl=http://centos.ustc.edu.cn/centos/6/updates/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#packages used/produced in the build but not released[cr]name=CentOS-6 - crbaseurl=http://centos.ustc.edu.cn/centos/6/cr/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-6 - Extrasbaseurl=http://centos.ustc.edu.cn/centos/6/extras/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages[centosplus]name=CentOS-6 - Plusbaseurl=http://centos.ustc.edu.cn/centos/6/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-6 - Contribbaseurl=http://centos.ustc.edu.cn/centos/6/contrib/$basearch/gpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6[fasttrack]name=CentOS-6 - fasttrackbaseurl=http://centos.ustc.edu.cn/centos/6/fasttrack/$basearch/gpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

在该目录下执行yum update进行统一更新

image_thumb[4]