当前位置:首页 > 财经

安装yum Yum 慢到无法忍受?那是因为你没有这么做

1.使用Centos映像构建本地百胜源

由于安装centos后的默认百胜源是centos的官方地址,在国内使用比较慢甚至无法访问,所以一般做法是用阿里云的百胜源或者国内百胜源比如163来代替默认的百胜源(具体如何配置如下)。但是以上的方法都需要一个网络,没有网络的情况下无法使用,所以另一种常见的方法是用Centos的ISO映像构建一个本地的Yum源,这样软件的安装速度会比较快,但是缺点是有些包可能没有。

1.安装Centos后的默认Yum源如下

[root @ kang vcar ~]# ll/etc/yum . repa . d/

总计32

-rw-r - r -。1 root root 1664 dec 92015 centos-base . repo

-rw-r - r -。1 root root 1309 dec 92015 centos-CR . repo

-rw-r - r -。1 root root 649 dec 92015 centos-debuginfo . repo

-rw-r - r -。1 root root 290 dec 92015 centos-fast track . repo

-rw-r - r -。1 root root 630 dec 92015 centos-Media . repo

-rw-r - r -。1 root root 1331 dec 92015 centos-sources . repo

-rw-r - r -。1 root root 1952 dec 92015 centos-vault . repo

2.备份默认的百胜源(可选)

[root @ kang vcar ~]# mkdir/opt/centos-yum . bak

[root @ kang vcar ~]# mv/etc/yum . rep . d/*/opt/centos-yum . bak/

3.在虚拟机上装载中央操作系统映像文件

[root @ kang vcar ~]# mount-t iso 9660/dev/sr0/opt/centos

moun t:/dev/sr0是写保护的,只读安装

4.写入一个回购文件,并指向镜像的装载目录

[root @ kang vcar ~]# VI/etc/yum . repo . d/local . repo

[本地]

name=local

baseurl=file:///opt/centos

enabled= 1

gpgcheck= 0

5.清除缓存

[root@kangvcar ~]# yum clean all

加载的插件:快速镜像

清洁报告:本地

打扫卫生

清洁速度最快的镜子的上表面

[root @ kang vcar ~]# Yum make cache//在本地缓存Yum源,加快软件的搜索和安装

[root@kangvcar ~]# yum list//列出3780个包

第二,将默认的CentOS Yum源修改为国内的aliyun Yum源

阿里巴巴云官方教程:http://mirrors.aliyun.com/help/centos

1.安装Centos后的默认Yum源如下

[root @ kang vcar ~]# ll/etc/yum . repa . d/

总计32

-rw-r - r -。1 root root 1664 dec 92015 centos-base . repo

-rw-r - r -。1 root root 1309 dec 92015 centos-CR . repo

-rw-r - r -。1 root root 649 dec 92015 centos-debuginfo . repo

-rw-r - r -。1 root root 290 dec 92015 centos-fast track . repo

-rw-r - r -。1 root root 630 dec 92015 centos-Media . repo

-rw-r - r -。1 root root 1331 dec 92015 centos-sources . repo

-rw-r - r -。1 root root 1952 dec 92015 centos-vault . repo

2.备份默认的百胜源(可选)

[root @ kang vcar ~]# mkdir/opt/centos-yum . bak

[root @ kang vcar ~]# mv/etc/yum . rep . d/*/opt/centos-yum . bak/

3.下载阿里云Yum源码回购文件(根据自己的系统版本下载)

#各系统版本回购文件对应的下载操作

CentOS 5

wget-O/etc/yum . repo . d/CentOS-base . repo http://mirrors . aliyun . com/repo/Centos-5 . repo

CentOS 6

wget-O/etc/yum . repo . d/CentOS-base . repo http://mirrors . aliyun . com/repo/Centos-6 . repo

CentOS 7

wget-O/etc/yum . repo . d/CentOS-base . repo http://mirrors . aliyun . com/repo/Centos-7 . repo

[root @ kang vcar ~]# cat/etc/red hat-release//检查系统版本

CentOSLinuxrelease7.2.1511(核心)

[根@ kang vcar ~]# wget-O/etc/yum . repo . d/CentOS-base . repo http://mirrors . aliyun . com/repo/Centos-7 . repo

-2017-06-2006:43:08-http://mirrors . aliyun . com/repo/Centos-7 . repo

resolving mirrors . aliyun . com(mirrors . aliyun . com)...112.124.140.210 , 115.28.122.210

connecting mirrors . aliyun . com(mirrors . aliyun . com)| 112 . 124 . 140 . 210 |:80...连接。

HTTPrequestsent,awaitingresponse...200OK

长度:2573(2.5K)[应用/八位字节流]

saving to:'/etc/yum . repo . d/CentOS-base . repo '

100%[= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =]2, 573 - .-K/ sin0s

2017-06-2006:43:08(118 MB/s)-'/etc/yum . repo . d/CentOS-base . repo ' saved[2573/2573]

4.清除缓存

[根@kangvcar ~]# yum clean all

加载的插件:快速镜像

清理回购:基础额外更新

打扫卫生

清洁速度最快的镜子的上表面

[root @ kangvcar ~]# Yum make cache//在本地缓存Yum源码,加快软件的搜索和安装

[root@kangvcar ~]# yum list//共列出9954个套餐

第三,将默认CentOS Yum源修改为国内163源

163官方教程:http://mirrors.163.com/.help/centos.html

1.安装Centos后的默认Yum源如下

[鲁特@ kang vcar ~]# ll/etc/yum . repo . d/

总计32

-rw-r - r -。1 root root 1664 dec 92015 centos-base . repo

-rw-r - r -。1 root root 1309 dec 92015 centos-CR . repo

-rw-r - r -。1 root root 649 dec 92015 centos-debuginfo . repo

-rw-r - r -。1 root root 290 dec 92015 centos-fast track . repo

-rw-r - r -。1 root root 630 dec 92015 centos-Media . repo

-rw-r - r -。1 root root 1331 dec 92015 centos-sources . repo

-rw-r - r -。1 root root 1952 dec 92015 centos-vault . repo

2.备份默认的百胜源(可选)

[root @ kang vcar ~]# mkdir/opt/centos-yum . bak

[root @ kang vcar ~]# mv/etc/yum . rep . d/*/opt/centos-yum . bak/

3.下载163 Yum源码回购文件

#各系统版本回购文件对应的下载操作

CentOS 5

http://mirrors.163.com/.help/CentOS5-Base回购163

CentOS 6

http://mirrors.163.com/.help/CentOS6-Base回购163

CentOS 7

http://mirrors.163.com/.help/CentOS7-Base回购163

[root @ kang vcar ~]# cat/etc/red hat-release//检查系统版本

CentOSLinuxrelease7.2.1511(核心)

[root @ kang vcar ~]# wget-O/etc/yum . repo . d/Centos7-Base-163 . repo http://mirrors . 163 . com/。帮助/CentOS7-Base-163.repo

-2017-06-2006:29:47-http://mirrors . 163 . com/。帮助/CentOS7-Base-163.repo

Resolvingmirrors.163.com(镜像。163.com)...123.58.173.185 , 123.58.173.186

connecting mirrors . 163 . com(镜像。163.com)| 123.58.173.185| :80...连接。

HTTPrequestsent,awaitingresponse...200OK

长度:1572(1.5K)[应用/八位字节流]

saving to:'/etc/yum . repo . d/CentOS7-Base-163 . repo '

100%[= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =]1, 572 - .-K/ sin0s

2017-06-2006:29:47(293 MB/s)-'/etc/yum . repo . d/Centos7-Base-163 . repo '已保存[1572/1572]

4.清除缓存

[root@kangvcar ~]# yum clean all

加载的插件:快速镜像

清理回购:基础额外更新

打扫卫生

清洁速度最快的镜子的上表面

[root @ kang vcar ~]# Yum make cache//在本地缓存Yum源,加快软件的搜索和安装

[root@kangvcar ~]# yum list//共列出9951个包

第四,修改百胜源的优先级

当既有本地Yum源又有163源的时候,我们在安装软件包的时候当然是想用本地Yum源来安装软件,然后在本地没有包的时候用163源来安装软件,这就涉及到优先级的问题了。Yum提供的插件Yum-plugin-priorities.noarch可以解决这个问题。

1.检查系统是否安装了优先插件

[root @ kang vcar ~]# rpm-QA | grepyum-plugin-

yum-plugin-fastestmirror- 1.1。31- 34.el7.noarch

//我在这里看到插件yum-plugin-priorities.noarch没有安装

[root @ kang vcar ~]# yum search yum-plugin-priorities

//使用搜索查看该插件是否可用

加载的插件:快速镜像

从缓存的主机文件加载镜像速度

*基地:mirrors.aliyun. com

* extra s:mirrors.aliyun. com

*更新:mirrors.aliyun. com

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = N/S匹配:yum-plugin-priorities = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

yum-plugin-priorities . no arch:plugin to give priorities to package from不同的转帖

2.安装yum-plugin-priorities.noarch插件

[root @ kang vcar ~]# yum-y install yum-plugin-priorities . no arch

3.检查插件是否已启用

[root @ kang vcar ~]# cat/etc/yum/plugin cf . d/priorities . conf

[主要]

enabled = 1

//1已启用;0已禁用

4.修改本地Yum源,先使用

[root @ kang vcar ~]# ll/etc/yum . repa . d/

总计8

-rw-r - r -。1 root root 2573 may 152015 centos-base . repo

-rw-r - r -。1 root root 67 jun 2006:04 local . repo

//有两个回购文件

[root @ kang vcar ~]# VI/etc/yum . repo . d/local . repo

[本地]

name=local

baseurl=file: ///opt/centos

enabled= 1

gpgcheck= 0

优先级= 1

//在原优先级上增加priority = 1;数字越小,优先级越高

//可以继续修改其他来源的优先级值。测试后,只将本地源的优先级配置为priority=1,优先使用本地源。

5.测试

配置优先级前:(使用阿里巴巴云百胜源)

[根@kangvcar ~]# yum - yinstall vim

依赖性已解决

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

软件包版本库大小

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

安装g:

vim-增强型x86_64 2: 7.4。160- 1.el7_3。1更新1.0M

正在更新依赖项:

vim-普通x86_64 2: 7.4。160- 1.el7_3。1更新5.9M

省略...

配置优先级后:(使用本地Yum源)

[根@kangvcar ~]# yum - yinstall vim

依赖性已解决

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

软件包版本库大小

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

安装g:

vim-增强型x86_64 2: 7.4。160-1.17本地1.0M

正在为依赖项安装:

gpm-libs x86_64 1.20。7- 5.el7本地32k

perlx86_64 4: 5.16。3-286.17本地8.0M

perl-Carp no arch 1.26-244.17 local 19k

perl-Encode x86 _ 64 2.51-7.57本地1.5M

perl-Exporter no arch 5.68-3.el7 local 28k

本地26k

文件温度0.23。01- 3.el7本地56k

省略...

Linux云计算与运维架构师高薪实践班“2019年4月29日即将开课,120天Linux运维年薪30万,变化速度大概~ ~

1.《安装yum Yum 慢到无法忍受?那是因为你没有这么做》援引自互联网,旨在传递更多网络信息知识,仅代表作者本人观点,与本网站无关,侵删请联系页脚下方联系方式。

2.《安装yum Yum 慢到无法忍受?那是因为你没有这么做》仅供读者参考,本网站未对该内容进行证实,对其原创性、真实性、完整性、及时性不作任何保证。

3.文章转载时请保留本站内容来源地址,https://www.lu-xu.com/caijing/762569.html

上一篇

秀女郎 无锡动物园惊现真人秀女郎露点 家长尴尬

下一篇

迷你挖机 合肥小伙自制“迷你挖掘机” 能挖土最多抓起85公斤重物

必胜客招聘 百胜餐饮集团全国招募日全面启动 肯德基必胜客招聘

今天,好吃!拥有肯德基、必胜客等品牌的中国最大餐饮集团品牌中国举办了“百胜!全国招聘日”在合肥、南京、北京、天津、青岛、上海、武汉、成都、广州、深圳等100多个城市,为以应届毕业生为主的年轻人提供1万多名餐厅储备经理,从而开启了百胜的大规模招聘!2014年全国品牌。...

su镜像 牛X!SU镜像功能原来还能这样用

su镜像 牛X!SU镜像功能原来还能这样用

“模特培训生”主题活动正式开业在这里你可以掌握优秀的建模技巧获取教程的免费插件和模型材料你还可以通过积极上交作业获得红宝石、棒币等奖励!红宝石和棒币能做什么Ruby和bar币用于“SketchUp Bar”论坛的账号升级和资源下载,非常重要!海量建模、渲染、后期PS...

airplay镜像一直在查找 屏幕镜像正在查找AppleTv

  • airplay镜像一直在查找 屏幕镜像正在查找AppleTv
  • airplay镜像一直在查找 屏幕镜像正在查找AppleTv
  • airplay镜像一直在查找 屏幕镜像正在查找AppleTv
镜像和非镜像哪个真实 辩别真实自我与"镜像自我”的智慧

镜像和非镜像哪个真实 辩别真实自我与"镜像自我”的智慧

区分真实自我和“镜像自我”的智慧是广泛而美好的,如果别人肯定和欣赏自己,那么我们也会对自己有积极的评价。面对别人的批评和指责,我们会看到一个非常不堪的自己,但这不是真实的自己,而是“...

王者荣耀打野英雄排行 王者荣耀:S21中路打野英雄,露娜优先级最高,最强中路英雄有所空缺

  • 王者荣耀打野英雄排行 王者荣耀:S21中路打野英雄,露娜优先级最高,最强中路英雄有所空缺
  • 王者荣耀打野英雄排行 王者荣耀:S21中路打野英雄,露娜优先级最高,最强中路英雄有所空缺
  • 王者荣耀打野英雄排行 王者荣耀:S21中路打野英雄,露娜优先级最高,最强中路英雄有所空缺

露娜王 那个男人回来了!300场百分百胜率露娜王!

mc2 蒂森电梯mc2主板插件部分管脚

mc2 蒂森电梯mc2主板插件部分管脚

24v FM IC 716的MC2板部件引脚x31 (1)+15引脚x23(1)+IC 716的16引脚X35(1), +24V输出:X35 IC615 x26 (4)的12个引脚i...

imini 【插件】迷你iMini建筑工具26周年版V7.6.1下载与安装

  • imini 【插件】迷你iMini建筑工具26周年版V7.6.1下载与安装
  • imini 【插件】迷你iMini建筑工具26周年版V7.6.1下载与安装
  • imini 【插件】迷你iMini建筑工具26周年版V7.6.1下载与安装