Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1735847
  • 博文数量: 636
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 3950
  • 用 户 组: 普通用户
  • 注册时间: 2014-08-06 21:58
个人简介

博客是我工作的好帮手,遇到困难就来博客找资料

文章分类

全部博文(636)

文章存档

2024年(5)

2022年(2)

2021年(4)

2020年(40)

2019年(4)

2018年(78)

2017年(213)

2016年(41)

2015年(183)

2014年(66)

我的朋友

分类: 系统运维

2017-02-13 18:27:33

yum安装软件No more mirrors to try

很简单:


1.yum clean metadata


2.yum clean all


[1] 
首先备份/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 
[2] 进入yum源配置文件所在文件夹
[root@localhost yum.repos.d]# cd /etc/yum.repos.d/
[3] 下载163的yum源配置文件,放入/etc/yum.repos.d/(操作前请做好相应备份)
[root@localhost yum.repos.d]# wget
[4] 运行yum makecache生成缓存
[root@localhost yum.repos.d]# yum makecache 
[5] 更新系统
[root@localhost yum.repos.d]# yum -y update 
[6] 安装vim编辑器
[root@localhost ~]# yum -y install vim* 


一、配置yum源
网易(163)yum源是国内最好的yum源之一 ,无论是速度还是软件版本,都非常的不错,将yum源设置为163yum,可以提升软件包安装和更新的速度,同时避免一些常见软件版本无法找到。具体设置方法如下: 
1,进入yum源配置目录


#cd /etc/yum.repos.d
2,备份系统自带的yum源


#mv CentOS-Base.repo CentOS-Base.repo.bk
下载163网易的yum源:


#wget
3,更新玩yum源后,执行下边命令更新yum配置,使操作立即生效


#yum makecache
4,除了网易之外,国内还有其他不错的yum源,比如中科大和搜狐的,大家可以根据自己需求下载
中科大的yum源:


#wget
sohu的yum源


#wget

理论上讲,这些yum源redhat系统以及fedora也是可以用 的,但是没有经过测试,需要的可以自己测试一下。
二、安装yum-downloadonly,下载rpm软件包

方法1、安装yum-downloadonly插件,下载rpm包;
 


#wget -O /etc/yum.repos.d/CentOS-Base.repo
#yum install yum-downloadonly
#yum install --downloadonly --downloaddir=/nginx.rpm pcre
如果下载不到yum-downloadonly这个软件包,请查看附件,下载之后解压缩,上传到linux上,进行安装。


方法2、修改配置文件/etc/yum.conf ,将 keepcache=0 修改为 keepcache=1

通过yum安装的软件将会在下面的cachedir中缓存。

cachedir=/var/cache/yum/$basearch/$releasever

例如:


# cd /var/cache/yum/x86_64/6/base/packages/
libpcap-1.4.0-4.20130826git2dbcaa1.el6.x86_64.rpm   
tcpdump-4.0.0-9.20090921gitdf3cb4.2.el6.x86_64.rpm
三、使用CentOS的iso搭建本地yum源


#ls /etc/yum.repos.d/
#CentOS-Base.repo  CentOS-Media.repo
#cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
#vim /etc/yum.repos.d/CentOS-Base.repo
      1 [dvd]
      2 name=install dvd
      3 baseurl=file:///media/CentOS_6.5_Final#iso的挂载路径
      4 enable=1
      5 gpgcheck=1#是否对下载的rpm包进行安全检查
      6 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#yum makecache 
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
dvd                                                                                  | 1.1 kB     00:00     
dvd/filelists                                                                        | 2.9 MB     00:00     
dvd/other                                                                            | 9.1 MB     00:00     
dvd/group                                                                            | 920 kB     00:00     
dvd/primary                                                                          | 920 kB     00:00     
dvd                                                                                               2599/2599
dvd                                                                                               2599/2599
dvd                                                                                               2599/2599
Metadata Cache Created






cat rhel-debuginfo.repo




[Cluster]
name=Red Hat Enterprise Linux $releasever - $basearch - Cluster
baseurl=file:///mnt/cdrom/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[ClusterStorage]
name=Red Hat Enterprise Linux $releasever - $basearch - ClusterStorage
baseurl=file:///mnt/cdrom/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[Server]
name=Red Hat Enterprise Linux $releasever - $basearch - Server
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[VT]
name=Red Hat Enterprise Linux $releasever - $basearch - VT
baseurl=file:///mnt/cdrom/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release




cat CentOS-Base-aliyun.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-6 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=
       
#mirrorlist=
gpgcheck=1
gpgkey=
 
#released updates 
[updates]
name=CentOS-6 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=
       
#mirrorlist=
gpgcheck=1
gpgkey=
 
#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=
       
#mirrorlist=
gpgcheck=1
gpgkey=
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=
       
#mirrorlist=
gpgcheck=1
enabled=0
gpgkey=
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=
       
#mirrorlist=
gpgcheck=1
enabled=0
gpgkey= 








163的yum

cat CentOS-Base-163.repo

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#


[base]
name=CentOS-6 - Base - 163.com
baseurl=
#mirrorlist=
gpgcheck=1
gpgkey=


#released updates 
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=
#mirrorlist=
gpgcheck=1
gpgkey=


#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=
#mirrorlist=
gpgcheck=1
gpgkey=


#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=
#mirrorlist=
gpgcheck=1
enabled=0
gpgkey=


#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=
#mirrorlist=
gpgcheck=1
enabled=0
gpgkey=

阅读(488) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~