配置本地及網絡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.pswp.cn/news/280440.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/280440.shtml
英文地址,請注明出處:http://en.pswp.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("…