yum

1,下载最新的yum-3.2.28.tar.gz并解压

wget http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz tar xvf yum-3.4.3.tar.gz

wget http://yum.baseurl.org/download/3.2/yum-3.2.28.tar.gz
tar xvf yum-3.2.28.tar.gz
cd yum-3.2.28
touch /etc/yum.conf
yummain.py install yum

 

1,下载最新的yum-3.2.28.tar.gz并解压
wget http://yum.baseurl.org/download/3.2/yum-3.2.28.tar.gz
tar xvf yum-3.2.28.tar.gz  


2,进入目录,运行安装
cd yum-3.2.28  
yummain.py install yum  
如果结果提示错误: CRITICAL:yum.cli:Config Error: Error accessing file for config file:///etc/

可能是原来是缺少配置文件。在etc目录下面新建yum.conf文件,然后再次运行 yummain.py install yum,顺利完成安装。

错误:

Traceback (most recent call last):
  File "./yummain.py", line 28, in <module>
    from yum import Errors
  File "/home/yum/yum-3.4.3/yum/__init__.py", line 23, in <module>
    import rpm
ImportError: No module named rpm

查询:whereis python

修改:
vim  /usr/share/yum-cli/yummain.py

vim /usr/bin/yum

vim /usr/libexec/urlgrabber-ext-down

将上述文件的头:#!/usr/bin/python” 修改为 #!/usr/bin/python2.7
 

3,最后更新系统。
yum check-update  
yum update  
yum clean all  
 

4、清理yum缓存和重新生成缓存,

#yum  clean  all

#yum  makecache

常见问题:

Segmentation fault

5 /var/run/yum.pid 已被锁定,PID 为 83167 的另一个程序正在运行。

 rm -f /var/run/yum.pid

 

一、配置阿里源


   第1步:下载阿里源的配置文件

[root@linuxprobe ~]# cd /etc/yum.repos.d/
[root@linuxprobe yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo

  第2步:将下载的配置文件重命名

[root@linuxprobe yum.repos.d]# mv Centos-7.repo Centos-Base.repo
[root@linuxprobe yum.repos.d]# 
[root@linuxprobe yum.repos.d]# ls
Centos-Base.repo  packagekit-media.repo  rhel7.repo           //其中rhel7.repo为自己配置的本地Yum软件仓库

  第3步:更新镜像源

 

[root@linuxprobe yum.repos.d]# yum clean all       //清楚缓存
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base extras updates
Cleaning up everything
[root@linuxprobe yum.repos.d]# 
[root@linuxprobe yum.repos.d]# yum makecache       //生成缓存

 

在安装ansible过程中,因为系统的yum仓库默认没有ansible的包,所以下载安装了epel源,安装完成后

用yum安装报错如下:

yum install ansible -y

Loaded plugins: priorities, update-motd, upgrade-helper

amzn-main/latest                                            | 2.1 kB     00:00     

amzn-updates/latest                                         | 2.3 kB     00:00     

epel/x86_64                                                 | 4.3 kB     00:00     

Could not retrieve mirrorlist http://apt.sw.be/redhat/el5/en/mirrors-rpmforge error was

14: PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"

http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"

Trying other mirror.

 

 

 One of the configured repositories failed (RHEL latest - RPMforge.net - dag),

 and yum doesn't have enough cached data to continue. At this point the only

 safe thing yum can do is fail. There are a few ways to work "fix" this:

 

     1. Contact the upstream for the repository and get them to fix the problem.

 

     2. Reconfigure the baseurl/etc. for the repository, to point to a working

        upstream. This is most often useful if you are using a newer

        distribution release than is supported by the repository (and the

        packages for the previous distribution release still work).

 

     3. Disable the repository, so yum won't use it by default. Yum will then

        just ignore the repository until you permanently enable it again or use

        --enablerepo for temporary usage:

 

            yum-config-manager --disable rpmforge

 

     4. Configure the failing repository to be skipped, if it is unavailable.

        Note that yum will try to contact the repo. when it runs most commands,

        so will have to try and fail each time (and thus. yum will be be much

        slower). If it is a very temporary problem though, this is often a nice

        compromise:

 

            yum-config-manager --save --setopt=rpmforge.skip_if_unavailable=true

 

failure: repodata/repomd.xml from rpmforge: [Errno 256] No more mirrors to try.

 

 

解决方法:

执行第三步和第四步中的命令:

yum-config-manager --disable rpmforge

yum-config-manager --save --setopt=rpmforge.skip_if_unavailable=true

 

然后再重试

yum install ansible -y

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值