linux 6更换yum源,Redhat6.6更改网易yum源 [图文版]

当前系统版本

[root@redhat-128 ~]# cat /etc/redhat-release

Red Hat Enterprise Linux Server release 6.6 (Santiago)

yum安装软件报错

[root@redhat-128 ~]# yum install -y net-snmp

Loaded plugins: product-id, security, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Setting up Install Process

No package net-snmp available.

Error: Nothing to do

查询redhat6 yum相关依赖包

[root@redhat-128 ~]# rpm -qa | grep yum

yum-metadata-parser-1.1.2-16.el6.x86_64

yum-utils-1.1.30-30.el6.noarch

yum-rhn-plugin-0.9.1-50.el6.noarch

yum-plugin-security-1.1.30-30.el6.noarch

yum-3.2.29-60.el6.noarch

卸载redhat6 yum相关依赖包

[root@redhat-128 ~]# rpm -qa | grep yum|xargs rpm -e --nodeps

[root@redhat-128 ~]# rpm -qa | grep yum

[root@redhat-128 ~]#

8624ac6e7700e64570ff4a970c3b6f83.png

安装python-iniparse、yum-metadata-parser组件

[root@redhat-128 ~]# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm

[root@redhat-128 ~]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

6f4b51ecc15adbc229638e74ffbf0161.png

python-2.6.6卸载并重新安装

[root@redhat-128 ~]# wget ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.5/x86_64/updates/security/python-2.6.6-64.el6.x86_64.rpm

[root@redhat-128 ~]# python -V

Python 2.6.6

[root@redhat-128 ~]# rpm -e python-2.6.6-52.el6.x86_64 --nodeps

[root@redhat-128 ~]# rpm -ivh python-libs-2.6.6-66.el6_8.x86_64.rpm python-2.6.6-64.el6.x86_64.rpm --nodeps --force

warning: python-libs-2.6.6-66.el6_8.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY

warning: python-2.6.6-64.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY

Preparing... ########################################### [100%]

1:python ########################################### [ 50%]

2:python-libs ########################################### [100%]

安装python-urlgrabber组件

[root@redhat-128 ~]# rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm --nodeps --force

warning: python-urlgrabber-3.9.1-11.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY

Preparing... ########################################### [100%]

1:python-urlgrabber ########################################### [100%]

![](![](https://s4.51cto.com/images/blog/201801/16/446dcba9c917d31d85f7e57de1869207.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)https://s4.51cto.com/images/blog/201801/16/1fb20802454ea130b67cb3d6c38c6488.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)

安装yum组件

[root@redhat-128 ~]# rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm

warning: yum-3.2.29-81.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY

Preparing... ########################################### [100%]

1:yum-plugin-fastestmirro########################################### [ 50%]

2:yum ########################################### [100%]

33b5d83a25cdc2668c4c870b8c76cf60.png

更换网易centos6镜像,将$releaseserve替换为6

[root@redhat-128 ~]# wget -O /etc/yum.repos.d/CentOS6-Base-163.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo

6b6a958afe6712fe8c26c367632c44bc.png

#清除原有缓存,重建缓存

[root@redhat-128 ~]# yum clean all

Loaded plugins: fastestmirror

Cleaning repos: base extras updates

Cleaning up Everything

Cleaning up list of fastest mirrors

[root@redhat-128 ~]# yum makecache

Loaded plugins: fastestmirror

Determining fastest mirrors

base | 3.7 kB 00:00

base/group_gz | 226 kB 00:00

base/filelists_db | 6.4 MB 01:50

base/primary_db | 4.7 MB 00:11

base/other_db | 2.8 MB 00:09

extras | 3.4 kB 00:00

extras/filelists_db | 26 kB 00:00

extras/prestodelta | 1.3 kB 00:00

extras/primary_db | 29 kB 00:00

extras/other_db | 30 kB 00:00

updates | 3.4 kB 00:00

updates/filelists_db | 3.5 MB 00:04

updates/prestodelta | 171 kB 00:00

updates/primary_db | 5.8 MB 00:21

updates/other_db | 83 MB 04:42

Metadata Cache Created

4678bd2fc1b1670f4ccb3334bac00168.png

重新安装net-snmp

[root@redhat-128 ~]# yum install -y net-snmp

Loaded plugins: fastestmirror

Setting up Install Process

Loading mirror speeds from cached hostfile

Resolving Dependencies

--> Running transaction check

---> Package net-snmp.x86_64 1:5.5-60.el6 will be installed

--> Processing Dependency: net-snmp-libs = 1:5.5-60.el6 for package: 1:net-snmp-5.5-60.el6.x86_64

--> Processing Dependency: libsensors.so.4()(64bit) for package: 1:net-snmp-5.5-60.el6.x86_64

--> Processing Dependency: libnetsnmptrapd.so.20()(64bit) for package: 1:net-snmp-5.5-60.el6.x86_64

--> Processing Dependency: libnetsnmpmibs.so.20()(64bit) for package: 1:net-snmp-5.5-60.el6.x86_64

--> Processing Dependency: libnetsnmphelpers.so.20()(64bit) for package: 1:net-snmp-5.5-60.el6.x86_64

--> Processing Dependency: libnetsnmpagent.so.20()(64bit) for package: 1:net-snmp-5.5-60.el6.x86_64

--> Processing Dependency: libnetsnmp.so.20()(64bit) for package: 1:net-snmp-5.5-60.el6.x86_64

--> Running transaction check

---> Package lm_sensors-libs.x86_64 0:3.1.1-17.el6 will be installed

---> Package net-snmp-libs.x86_64 1:5.5-60.el6 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================

Package Arch Version Repository Size

===============================================================================================================================================================================

Installing:

net-snmp x86_64 1:5.5-60.el6 base 309 k

Installing for dependencies:

lm_sensors-libs x86_64 3.1.1-17.el6 base 38 k

net-snmp-libs x86_64 1:5.5-60.el6 base 1.5 M

Transaction Summary

===============================================================================================================================================================================

Install 3 Package(s)

Total download size: 1.9 M

Installed size: 6.3 M

Downloading Packages:

(1/3): lm_sensors-libs-3.1.1-17.el6.x86_64.rpm | 38 kB 00:00

(2/3): net-snmp-5.5-60.el6.x86_64.rpm | 309 kB 00:00

(3/3): net-snmp-libs-5.5-60.el6.x86_64.rpm | 1.5 MB 00:02

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total 134 kB/s | 1.9 MB 00:14

warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY

Retrieving key from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

Importing GPG key 0xC105B9DE:

Userid: "CentOS-6 Key (CentOS 6 Official Signing Key) "

From : http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Warning: RPMDB altered outside of yum.

** Found 4 pre-existing rpmdb problem(s), 'yum check' output follows:

python-2.6.6-64.el6.x86_64 has missing requires of python-libs(x86-64) = ('0', '2.6.6', '64.el6')

python-libs-2.6.6-66.el6_8.x86_64 is a duplicate with python-libs-2.6.6-52.el6.x86_64

python-urlgrabber-3.9.1-11.el6.noarch is a duplicate with python-urlgrabber-3.9.1-9.el6.noarch

rhn-check-1.0.0.1-18.el6.noarch has missing requires of yum-rhn-plugin >= ('0', '0.9.1', '35')

Installing : lm_sensors-libs-3.1.1-17.el6.x86_64 1/3

Installing : 1:net-snmp-libs-5.5-60.el6.x86_64 2/3

Installing : 1:net-snmp-5.5-60.el6.x86_64 3/3

Verifying : lm_sensors-libs-3.1.1-17.el6.x86_64 1/3

Verifying : 1:net-snmp-libs-5.5-60.el6.x86_64 2/3

Verifying : 1:net-snmp-5.5-60.el6.x86_64 3/3

Installed:

net-snmp.x86_64 1:5.5-60.el6

Dependency Installed:

lm_sensors-libs.x86_64 0:3.1.1-17.el6 net-snmp-libs.x86_64 1:5.5-60.el6

Complete!

c8479f355bd810b19b7cb06e7ef95ed5.png

备注:上述所安装rpm包都可在下面链接搜索下载的到。

mirrors.163.com/centos/6/os/x86_64/Packages/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 您可以通过修改 /etc/yum.repos.d/ 目录下的 .repo 文件来更换 YUM 源。您也可以通过使用命令行工具 sed,直接替换原有的 yum 配置文件内容,来更改 yum 源。具体操作可以参考相关教程。 ### 回答2: 更换Linux系统中的yum源可以让我们在安装软件时获取更快的下载速度或者获取特定地区的镜像源。 首先,我们需要找到适合的yum源,可以通过搜索引擎或者访问相关网站获取。一般来说,国内常用的yum源有阿里云、清华大学、网易等。 然后,我们需要备份当前的yum源配置文件,以防意外情况发生。通过运行以下命令进行备份: sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak 接下来,我们可以通过编辑yum源配置文件来更换源。使用编辑器打开CentOS-Base.repo文件: sudo vi /etc/yum.repos.d/CentOS-Base.repo 我们可以将文件中的baseurl和mirrors字段更改为所需的yum源地址。将baseurl字段更改为新的源地址,如: baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/ 将mirrors字段更改为新的源地址,如: mirrors=mirrors.aliyun.com 保存文件并退出编辑器。 最后,我们需要清除并重建yum的缓存,通过运行以下命令: sudo yum clean all sudo yum makecache 这样,我们就成功更换Linux系统中的yum源。从现在开始,我们可以使用新源地址来安装软件或更新系统了。记得定期更新yum源,并进行系统的安全升级,以确保系统的稳定和安全。 ### 回答3: 要更换Linux操作系统中的yum源,可以按照以下步骤进行: 1. 首先,备份旧的yum源配置文件(通常在/etc/yum.repos.d/目录下),以防万一出现问题可以快速恢复。 2. 打开终端,并以root用户身份登录。 3. 使用文本编辑器打开yum源配置文件,例如可以使用vi编辑器命令:vi /etc/yum.repos.d/CentOS-Base.repo。 4. 在编辑器中,找到并注释掉原先的baseurl行,将其前面的#号去掉。 5. 修改baseurl为新的yum源地址,可以从官方站点获取新的yum源镜像地址,也可以从社区等其他可信的镜像源获取。 6. 如果需要,还可以更改其他相关的配置,例如启用其他可选的软件包或添加GPG密钥。 7. 保存并退出编辑器。 8. 清空并重建yum缓存,使用命令:yum clean all。 9. 更新yum源,使用命令:yum makecache。 10. 尝试使用yum命令安装或更新软件包,确保yum源已经更换成功。 请注意,更换yum源时应谨慎选择可靠的镜像站点,以确保获取的软件包是经过验证的,并避免下载速度过慢的问题。同时,为了保证系统的安全性和稳定性,建议使用官方或权威的镜像源。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值