更换红旗Linux: Asianux的yum源为网易源

测试环境:

Linux系统版本Asianux4_x64:Linux localhost.localdomain 2.6.32-279.2.1.el6.x86_64 #1 SMP Tue Aug 14 11:42:24 CST 2012 x86_64 x86_64 x86_64 GNU/Linux
本质上Asianux4_x64就是基于Redhat6企业版的。

 

出现问题:

安装完系统之后,想通过yum安装一些程序,但是提示错误:

Loaded plugins: axtu-plugin, refresh-packagekit, security
Please register, or you can not connect to Asianux Update Server!
Setting up Install Process
No package gcc available.
Error: Nothing to do

以上的错误提示我们必须先注册,否则无法连接到Asianux的yum服务器。

那么我们不注册,怎么更换yum源为可以直接使用的网易yum源呢?

 

解决方案:

1. 卸载Asianux自带的yum源

[root@localhost 桌面]# rpm -aq | grep yum | xargs rpm -e --nodeps

[root@localhost 桌面]# whereis yum
yum: /etc/yum

[root@localhost 桌面]# rm -rf /etc/yum

 

2. 下载yum安装包

下载地址:http://mirrors.163.com/centos/6/os/x86_64/Packages/

从这个地址中下载需要的包:

python-iniparse-0.3.1-2.1.el6.noarch.rpm
yum-3.2.29-60.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

如果不是通过浏览器找到具体文件下载,可以通过wget下载。

 

3. 安装yum的相关rpm包

[root@localhost myself]# rpm -ivh python*
warning: python-iniparse-0.3.1-2.1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:python-iniparse        ########################################### [100%]
[root@localhost myself]# rpm -ivh yum*
warning: yum-3.2.29-69.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:yum-metadata-parser    ########################################### [ 33%]
   2:yum-plugin-fastestmirro########################################### [ 67%]
   3:yum                    ########################################### [100%]
[root@localhost myself]#

 

4. 配置网易源

如果 /etc/yum.repos.d/rhel-debuginfo.repo 这个文件存在的话就备份一下:

[root@localhost myself]# mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.bak
如果本来就没有,就新建:

[root@localhost myself]# touch /etc/yum.repos.d/rhel-debuginfo.repo

编辑新建的文件,加入网易源:

[root@localhost myself]# vim /etc/yum.repos.d/rhel-debuginfo.repo

 

[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#packages used/produced in the build but not released
#[addons]
#name=CentOS-$releasever - Addons
#baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
#gpgcheck=1
#gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
gpgcheck=1
enabled=0

保存退出编辑器即可。

 

5. 清理缓存

[root@localhost myself]# yum clean all
已加载插件:fastestmirror
Cleaning repos: base extras updates
清理一切

 

6. 将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度

[root@localhost 桌面]# yum makecache
已加载插件:fastestmirror
Determining fastest mirrors
base                                                     | 3.7 kB     00:00    
base/group_gz                                            | 219 kB     00:01    
base/filelists_db                                        | 6.3 MB     01:40    
base/primary_db                                          | 4.6 MB     01:06    
base/other_db                                            | 2.8 MB     00:40    
extras                                                   | 3.4 kB     00:00    
extras/filelists_db                                      |  30 kB     00:00    
extras/prestodelta                                       |  601 B     00:00    
extras/primary_db                                        |  27 kB     00:00    
extras/other_db                                          |  30 kB     00:00    
updates                                                  | 3.4 kB     00:00    
updates/filelists_db                                     | 1.0 MB     00:14    
updates/prestodelta                                      |  93 kB     00:01    
updates/primary_db                                       | 1.3 MB     00:19    
updates/other_db                                         |  15 MB     03:43    
元数据缓存已建立

至此,网易yum源已经安装成功。

 

你可能感兴趣的:(linux,yum)