配置本地及网络yum源(详细步骤)

我们以centos6为范例演示

1、[root@Centos6 ~]# cd /etc/yum.repos.d/
[root@Centos6 yum.repos.d]# ls

CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo
CentOS-Debuginfo.repo CentOS-Media.repo
先罗列出相关文件

2、[root@Centos6 yum.repos.d]# vim CentOS-Base.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.
#
#
[epel]
name=aliyun-epel
baseurl=https://mirrors.aliyun.com/epel/6/x86_64/
gpgcheck=0
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-6 [base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/6/os/x86_64/
gpgcheck=0
gpgkey=https://mirrors.aliyun.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6  #released updates 
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/6/updates/x86_64/
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/6/extras/x86_64/
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/6/centosplus/x86_64/
gpgcheck=0
enabled=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/6/contrib/x86_64/
gpgcheck=0
enabled=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

在https://opsx.alibaba.com/mirro中查询相关配置文件的路径

3、[root@Centos6 yum.repos.d]# yum clean all

Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning repos: base centosplus contrib epel extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors
清除一下yum缓存

4、[root@Centos6 yum.repos.d]# yum repolist

Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:00
centosplus | 3.4 kB 00:00
centosplus/primary_db | 1.7 MB 00:00
contrib | 2.9 kB 00:00
contrib/primary_db | 1.2 kB 00:00
epel | 4.7 kB 00:00
epel/primary_db | 6.0 MB 00:00
extras | 3.4 kB 00:00
extras/primary_db | 27 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 3.0 MB 00:00
repo id repo name status
base CentOS-6 - Base 6,713
centosplus CentOS-6 - Plus 50
contrib CentOS-6 - Contrib 0
epel aliyun-epel 12,517
extras CentOS-6 - Extras 35
updates CentOS-6 - Updates 311
repolist: 19,626

5、此时表明yum源列表已生成,yum源已配好

我们就可以下载自己需要的东西了,示例如下:

[root@Centos6 yum.repos.d]# yum -y install lrzsz
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package lrzsz.x86_64 0:0.12.20-27.1.el6 will be installed
--> Finished Dependency ResolutionDependencies Resolved=====================================================================Package     Arch         Version                   Repository  Size
=====================================================================
Installing:lrzsz       x86_64       0.12.20-27.1.el6          base        71 kTransaction Summary
=====================================================================
Install       1 Package(s)Total download size: 71 k
Installed size: 159 k
Downloading Packages:
lrzsz-0.12.20-27.1.el6.x86_64.rpm             |  71 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running TransactionInstalling : lrzsz-0.12.20-27.1.el6.x86_64                     1/1 Verifying  : lrzsz-0.12.20-27.1.el6.x86_64                     1/1 Installed:lrzsz.x86_64 0:0.12.20-27.1.el6                                    Complete!

转载于:https://blog.51cto.com/14128387/2347672

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/280440.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

macos mojave_如何修复macOS Mojave上的模糊字体(使用亚像素抗锯齿)

macos mojaveApple’s macOS Mojave disables subpixel antialiasing, also known as font smoothing, by default. On a MacBook Air or a desktop Mac hooked up to a non-Retina display, upgrading will make your fonts look worse. 苹果的macOS Mojave默认情况下禁用子像…

为什么我要写博客

原因在这啦 一、我觉得分享是一种精神,分享是我的乐趣所在,不是说我觉得我讲得一定是对的,我讲得可能很多是不对的,但是我希望我讲的东西是我人生的体验和思考,是给很多人反思,也许给你一秒钟、半秒钟&…

一个变量命名神器:支持中文转变量名

变量命名的规范,对于我们编程,大家都知道是非常重要的,上次给大家推荐过一个命名辅助工具《程序员还在为变量取名苦恼,那是因为你不知道,这个变量命名神器》,但大家一致反馈存在2个问题:1、网速…

rest_framework05:GenericAPIView用法/扩展类5个/子类9个/ViewSetMixin 自定义方法名字

GenericAPIView 1.视图层类使用GenericAPIView继承,能简化类里的方法code。 2.简化后的方法code格式基本通用,简单修改即可应用到其他类。 一、class开始加入 queryset Book.objectsserializer_class BookModelSerializer 二、方法里获取对象 a.查…

1.操作系统概述

2019独角兽企业重金招聘Python工程师标准>>> 操作系统的发展过程 无操作系统的计算机系统单道批处理系统(50年代,系统资源利用率低)多道批处理系统(60年代)分时系统(70年代)实时系统…

测听hl和nhl的区别_播放NHL曲棍球的最便宜方法(无电缆)

测听hl和nhl的区别If you’re like me, you watch hockey, and…basically no other sports. You also, like me, would like to skip the cable subscription. So what’s the cheapest way to watch NHL hockey online so you can cut the cord? 如果您像我一样,…

制作一个让客户满意的软件

我看了《构建之法》的第八章“需求分析”我对如何制作一个让客户满意的软件有了一点儿头绪,的但是还是有一些迷惑。我通过看书总结和百度查找有了一点儿总结:我们在制作软件的过程中应该及时与用户沟通交流,交换意见,并及时实现用…

rest_framework06:自动生成路由\action使用\认证

自动生成路由 # 1.导入routers模块 from rest_framework import routers# 2.实例化类 routerrouters.SimpleRouter()# 3.注册 # (前缀,继承自ModelViewSet视图类,别名) router.register(books7,views.BooksView) # 不要加斜杠# 4.加入 urlpatternsrouter.urls action使用 装…

char data[0]在struct末尾的用法

在实际的编程中,我们经常需要使用变长数组,但是C语言并不支持变长的数组。此时,我们可以使用结构体的方法实现C语言变长数组。 struct MyData { int nLen; char data[0];}; 在结构中,data是一个数组名;但该数组没有元素…

使用Java实现K-Means聚类算法

2019独角兽企业重金招聘Python工程师标准>>> 关于K-Means介绍很多,还不清楚可以查一些相关资料。 个人对其实现步骤简单总结为4步: 1.选出k值,随机出k个起始质心点。 2.分别计算每个点和k个起始质点之间的距离,就近归类。 3.最终中心点集可以划分为…

在PowerShell中显示高级进度条

如果你需要编写一些PowerShell脚本,尤其在处理一些相对复杂的任务时,你可能希望添加进度条的功能,以便随时可以了解进展情况。Write-Progress 这个命令可以帮助你完成简单的需求,请参考官方文档即可,但下图一个示例&am…

当检测到运动时如何自动打开门灯

If it’s dark out and someone comes to your door, you probably can’t see them unless your porch light is on. Furthermore, if a potential burglar approaches your front door, a motion light can help scare them away. 如果天黑了,有人进了您的门&…

分布式系统的那些事儿(六) - SOA架构体系

有十来天没发文了,实在抱歉!最近忙着录视频,同时也做了个开源的后台管理系统LeeCX,目前比较简单,但是后续会把各类技术完善。具体可以点击“原文链接”。 那么今天继续说分布式系统的那些事。 我们现在动不动就讲分布式…

rest_framework07:权限/频率/过滤组件/排序/异常处理封装Response对象

权限 写一个类,继承BasePermission,如果通过返回True,否则False 这里需要配合认证使用,否则没有user_type属性。 from rest_framework.permissions import BasePermissionclass UserPermission(BasePermission):def has_permis…

在阿里,我们如何管理测试环境

为什么80%的码农都做不了架构师?>>> 作者:林帆(花名金戟),阿里巴巴研发效能部技术专家 相关阅读:在阿里,我们如何管理代码分支 前言 阿里的许多实践看似简单,背后却蕴涵…

数据库_7_SQL基本操作——表操作

SQL基本操作——表操作 建表的过程就是声明列的过程。 表与字段是密不可分的。 一、新增数据表 create table [if not exists] 表名( 字段名字 数据类型, 字段名字 数据类型 -- 最后一行不需要逗号 )[表选项];if not exists:如果表名不存在,那么就创建,…

EXT.NET 更改lable和Text的颜色

2019独角兽企业重金招聘Python工程师标准>>> &#xfeff;&#xfeff; <ext:TextField ID"TextField1" " runat"server" FieldLabel"编号" LabelWidth"60" LabelAlign"Left" LabelStyle"color:red…

rest_framework08:分页器/根据ip进行频率限制

分页器 # 查询所有&#xff0c;才需要分页 from rest_framework.generics import ListAPIView# 内置三种分页方式 from rest_framework.pagination import PageNumberPagination,LimitOffsetPagination,CursorPaginationPageNumberPaginationclass MyPageNumberPagination(Pag…

NYOJ746 整数划分

该题是一道区间DP的题目&#xff0c;做了几道区间DP&#xff0c;说起来高大上&#xff0c;也就是DP在区间内的形式而已&#xff0c;核心思想还是要想到转移->规划。 题意是在n位数中间加m个称号&#xff0c;使得最终乘积最大。 状态转移方程如下&#xff1a; dp[ i ][ j ]ma…

Spring MVC实现文件下载

方法一&#xff1a; RequestMapping("/testHttpMessageDown")public ResponseEntity<byte[]> download(HttpServletRequest request) throws IOException {File file new File(request.getSession().getServletContext().getClassLoader().getResource("…