Centos6 yum安装相关问题与处理

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

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

一、问题1

[root@bogon ~]# 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'" 问题处理

[root@bogon 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来开始下载与安装

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

  1. linux centos6 yum 安装lamp

    centos 6.5 1.yum安装和源代码编译在使用的时候没啥区别,但是安装的过程就大相径庭了,yum只需要3个命令就可以完成,源代码需要13个包,还得加压编译,步骤很麻烦,而且当做有时候会出错,源 ...

  2. Linux下yum安装MySQL

    写这篇文章的原因是:在刚开始使用Linux操作系统时想要搭建LAMP环境,于是开始在Google和百度上各种寻找资料,碰到了不是很多的问题后,我决定写这篇文章总结一下在Linux下yum安装MySQL ...

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

    Alternative PHP Cache(可选PHP缓存),依赖于 PECL扩展库 用源码方式安装,直接yum就行了:首先要安装apc的依赖包:yum install php-pear php-de ...

  4. centos6 yum 安装memcached

    centos6 yum 安装memcached - 像块石头 - 博客园http://www.cnblogs.com/rockee/archive/2012/08/01/2619160.html yu ...

  5. linux下yum安装python3

    linux下yum安装python3 linux下yum安装python3yum install python34 -ypython3 --version wget --no-check-certif ...

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

    原文地址:http://54im.com/openldap/centos-6-yum-install-openldap-phpldapadmin-tls-%E5%8F%8C%E4%B8%BB%E9%8 ...

  7. 在linux CentOS6上安装web环境

    感谢浏览,欢迎交流=.= 都说linux作为服务器优于window,近期也是学习了下linux. win7下安装了linux虚拟机,购买linux阿里云主机,开启linux之旅. 进入正题,在linu ...

  8. Linux下yum安装MySQL yum安装MySQL指定版本

    yum安装MySQL 1. 查看有没有安装过     yum list installed MySQL* (有存在要卸载yum remove MySQL*)     rpm -qa | grep my ...

  9. Linux 下 YUM 安装 PHP 5.5 (及5.6)

    原文链接: http://blog.aboutc.net/linux/50/yum-install-php-on-linux 系统环境: CentOS 6.4 x86_64 Fedora 20 x86 ...

随机推荐

  1. 在Web界面中实现Excel数据大量导入的处理方式

    在早期Bootstrap框架介绍中,我的随笔<结合bootstrap fileinput插件和Bootstrap-table表格插件,实现文件上传.预览.提交的导入Excel数据操作流程> ...

  2. 自学提高:JVM点滴

    写在前面 这年头就是得不断地学习. 学什么东西就看需要了. 不学习很难进步. 同时别人也会超过你. 东西都是网上有的.图片也好,文字也好.基本都可以在网上找到. JAVA运行原理 JVM包括字节码解释 ...

  3. 把json数据转换成集合

    Sting MessageList="";JSONArray json = JSONArray.fromObject(MessageList);JSONObject object ...

  4. core dump文件的生成

    #include <stdio.h> int main(int argc, char *argv[]) { char * p = "abcdefg"; p[] = '; ...

  5. java基础1之引用数据类型

    5种引用类型(对象类型) 类 接口 数组 枚举 标注 类 类在JVM的内存空间的存储 (1). Heap 堆空间:分配对象 new Student() 存放引用数据类型的实例 (2). Stack 栈 ...

  6. [BZOJ 3745] [COCI 2015] Norma

    Description 给定一个正整数序列 \(a_1,a_2,\cdots,a_n\),求 \[ \sum_{i=1}^n\sum_{j=i}^n(j-i+1)\min(a_i,a_{i+1},\c ...

  7. codeforces选做

    收录了最近本人完成的一部分codeforces习题,不定期更新 codeforces 1132E Knapsack 注意到如果只使用某一种物品,那么这八种物品可以达到的最小相同重量为\(840\) 故 ...

  8. Bigtable:A Distributed Storage System for Strctured Data

    2006 年10 月Google 发布三架马车之一的<Bigtable:A Distributed Storage System for Strctured Data>论文之后,Power ...

  9. luogu3346 诸神眷顾的幻想乡 (广义SAM)

    首先,让每一个叶节点做一次树根的话,每个路径一定至少有一次会变成直上直下的 于是对于每个叶节点作为根产生的20个trie树,把它们建到同一个广义SAM里 建法是对每个trie dfs去建,last就是 ...

  10. CF993D Compute Power(二分+Dp)

    一看到这种求\(min/max\left \{ \frac{\sum a_i}{\sum b_i} \right \}\)的题肯定是\(01\)分数规划,大概可以算作一种二分? 设\(ans\)为当前 ...