Linux -- Centos6 yum安装相关问题与处理

Centos6 yum安装相关问题与处理

由于要使用yum下载文件,突然yum下载不了想要的文件,想更换yum源,结果得重新安装yum

来自本人GitHub地址https://github.com/mrsmallyi/LinuxNote/blob/master/yum.md

一、问题1

[[email protected] ~]# yum -v
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It‘s possible that the above module doesn‘t match the
current version of Python, which is:
2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

解决方法与步骤:

  1. 清除原有RHEL的YUM及相关软件包。
rpm -qa | grep yum | xargs rpm -e --nodeps
rpm -qa |grep python-urlgrabber|xargs rpm -e --nodeps
  1. 下载centos6的相关软件包。 python-urlgrabber-3.9.1-11.el6.noarch.rpm python-iniparse-0.3.1-2.1.el6.noarch.rpm yum-3.2.29-81.el6.centos.noarch.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget  http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget  http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm

注意: 如果文件无法下载,就可能是版本问题,重新到http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/目录下载相关文件

  1. 安装下载的安装包
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm  yum-3.2.29-81.el6.centos.noarch.rpm 

  1. 检查是否安装成功
 rpm -qa | grep yum
 rpm -qa | grep python

二、问题2 -- http://apt.sw.be/redhat/el6/en/x86_64/dag/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘apt.sw.be‘" 问题处理

[[email protected] yum.repos.d]# yum makecache
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                       | 3.7 kB     00:00
http://apt.sw.be/redhat/el6/en/x86_64/dag/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘apt.sw.be‘"
尝试其他镜像。
错误:Cannot retrieve repository metadata (repomd.xml) for repository: dag. Please verify its path and try again

这个问题最后明白yum源地址不行了,得更换了;

解决方法:

  1. cd /etc/yum.repos.d 进入这个目录,里面有个文件dag.repo 文件(可能名称会不一样)里面的 baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
  2. vi 编译一下里面的地址baseurl, 把后面的地址更换 我索性网上找到了有一篇文章https://blog.csdn.net/zhujiangm/article/details/42614105有很多个地址,然后就替换进去,不怕地址都用不了。
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://archive.cs.uu.nl/mirror/dag.wieers/redhat/el$releasever/en/$basearch/dag
        http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
        http://dag.linux.iastate.edu/dag/redhat/el$releasever/en/$basearch/dag
        http://ftp.riken.jp/Linux/dag/redhat/el$releasever/en/$basearch/dag/
        http://ftp2.lcpe.uni-sofia.bg/freshrpms/pub/dag/redhat/el$releasever/en/$basearch/dag
        http://ftp.heanet.ie/pub/freshrpms/pub/dag/redhat/el$releasever/en/$basearch/dag
        http://ftp-stud.fht-esslingen.de/dag/redhat/el$releasever/en/$basearch/dag
        http://mirror.cpsc.ucalgary.ca/mirror/dag/redhat/el$releasever/en/$basearch/dag
        http://mirrors.ircam.fr/pub/dag/redhat/el$releasever/en/$basearch/dag
        http://rh-mirror.linux.iastate.edu/pub/dag/redhat/el$releasever/en/$basearch/dag
        http://rpmfind.net/linux/dag/redhat/el$releasever/en/$basearch/dag
        http://wftp.tu-chemnitz.de/pub/linux/dag/redhat/el$releasever/en/$basearch/dag
        http://www.mirrorservice.org/sites/apt.sw.be/redhat/el$releasever/en/$basearch/dag

gpgcheck=1
enabled=1

gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
  1. 使用如下命令更新到最新系统
yum -y update
# -y 代表自动回答yes来开始下载与安装

原文地址:https://www.cnblogs.com/smallyi/p/9388320.html

时间: 2024-08-12 17:32:44

Linux -- Centos6 yum安装相关问题与处理的相关文章

centos6 yum 安装memcached

centos6 yum 安装memcached 分类: php2013-03-08 18:08 7355人阅读 评论(0) 收藏 举报 目录(?)[+] centos 6 第一二步省略,直接yum安装 1. 安装第三方软件库 wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.5.2-2.rf.src.rpmrpm -ivh rpmforge-release-0.5.2-2.rf.src.rpm

【夯实PHP基础系列】linux下yum安装PHP APC

Alternative PHP Cache(可选PHP缓存),依赖于 PECL扩展库 用源码方式安装,直接yum就行了:首先要安装apc的依赖包:yum install php-pear php-devel httpd-devel pcre-devel gcc make 然后使用pecl安装apc:pecl install apc 添加apc扩展到配置文件:echo "extension=apc.so" > /etc/php.d/apc.ini 最后记得重启服务器:service

Linux(CentOs6.4)安装Git

安装之前我们先来了解下git,并且要反问下:我为什么要使用git?svn用的不是很好嘛,我干嘛要换?... 问1:为什么需要版本控制系统? 版本控制是一种记录若干文件内容变化,以便将来查阅特定版本修订情况的系统.大部分时候我们使用最频繁的还是对源代码文件的版本控制,其实任何文件都可以纳入版本控制系统. 1).更好备份:相比于将不同版本的文件以时间等命名存储备份,使用版本控制系统能节约更多的磁盘空间,因为版本控制系统不是文件的复制备份,而是差异备份,文件快照备份等等. 2).更好的回溯:可以将某个

Linux下yum安装MySQL

写这篇文章的原因是:在刚开始使用Linux操作系统时想要搭建LAMP环境,于是开始在Google和百度上各种寻找资料,碰到了不是很多的问题后,我决定写这篇文章总结一下在Linux下yum安装MySQL数据库的过程,至于编译安装,我这里没法做过多的补充,因为我不想去妄言一个我还没有完全掌握的知识,各位见谅,以后搞明白了会补上的. 好了,我们直接进入正题: Linux 下 yum安装mysql 1. wget http://dev.mysql.com/get/mysql57-community-re

linux centos yum安装LAMP环境

centos 6.5 1.yum安装和源代码编译在使用的时候没啥区别,但是安装的过程就大相径庭了,yum只需要3个命令就可以完成,源代码需要13个包,还得加压编译,步骤很麻烦,而且当做有时候会出错,源代码编译安装大概需要2个小时,好处在于可以自己配置地址等一些参数,yum安装半个小时搞定,一般不会出错,更新也很方便. 2.我的机器是centos release 5.9 64为的系统,一般机器都带yum命令,并且yum包源都是可以用的,就是说不用你自己下载东西,直接yum -y install 后

Centos6 yum安装openldap+phpldapadmin+TLS+双主配置

原文地址:http://54im.com/openldap/centos-6-yum-install-openldap-phpldapadmin-tls-%E5%8F%8C%E4%B8%BB%E9%85%8D%E7%BD%AE.html 钿畑的文章索引 1.概念介绍 2. 环境介绍 2. 准备工作 3. yum部署ldap 4. phpldapadmin安装 5.ldap客户端配置 6.用户目录自动挂载 6.1 服务器端配置 6.2 客户端配置 7.配置TLS传输加密 8.配置openldap双

在linux CentOS6上安装web环境

感谢浏览,欢迎交流=.= 都说linux作为服务器优于window,近期也是学习了下linux. win7下安装了linux虚拟机,购买linux阿里云主机,开启linux之旅. 进入正题,在linux使用阿里云提供的一键安装工具上安装web环境. 登录阿里云,进入帮助中心,下载阿里云linux一键安装web环境安装包. 在虚拟机中的cenos6中安装 上传文件命令:rz sz进行本地和服务器间的上传.下载. 安装命令:yum install lrzsz 解压安装包命令:unzip -x sh.

linux下yum安装及配置

1 2 3 4 分步阅读 公司使用的是linux搭建服务器,linux安装软件能够使用yum安装依赖包是一件非常简单而幸福的事情,所以这里简单介绍一下linux安装yum源流程和操作. 工具/原料 电脑 linux基础操作知识 方法/步骤 1 查看.卸载已安装的yum包 查看已安装的yum包 #rpm –qa|grep yum 卸载软件包 #rpm –e –nodeps yum 2 下载安装依赖包python python-iniparse 下载地址http://centos.ustc.edu.

linux centos6.5 安装memcached 和php扩展

linux centos 6.5 安装memcached,php扩展 一.我是通过yum 安装的方式:# yum -y install memcached 完成后执行: memcached -h 出现帮助文档说明成功 二.加入启动服务:# chkconfig --level 2345 memcached on 三.配置memcached 1.port 对应的是 端口  2.user 对应用户名 3.maxconn 对应的是最大连接数 4.cachesize 对应的是内存大小 5.opttons