一直和各种OS打交道,仍觉得自己是小白,故深知小白们的困惑和蛋碎,特此将安装更新源的细节和步骤做了详细整理,供大家参考。红字是命令和提示,深灰色代码框中是源配置,本文采用了清华大学CentOS 8的源,按提示操作可成功,祝你好运!Good Luck!

转载请注明出处:

首先备份 cd /etc/yum.repos.d/

[tony@localhost home]$ su

Password: 【输入root用户的密码获取root用户权限】

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

【PS:在有的版本CentOS 8 安装完成后在源目录“/etc/yum.repos.d/” 中并没有 CentOS-Base.repo 这个文件,可能报错,那么直接用vi命令创建这个文件,并粘贴本文所附的源代码,继续往下执行即可】

[root@localhost yum.repos.d]# ll
total 56
-rw-r--r--. 1 root root  731 Mar 12 15:15 CentOS-AppStream.repo
-rw-r--r--. 1 root root 2100 Apr 10 07:19 CentOS-Base.repo
-rw-r--r--. 1 root root  798 Mar 12 15:15 CentOS-centosplus.repo
-rw-r--r--. 1 root root 1043 Mar 12 15:15 CentOS-CR.repo
-rw-r--r--. 1 root root  668 Mar 12 15:15 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  743 Mar 12 15:15 CentOS-Devel.repo
-rw-r--r--. 1 root root  756 Mar 12 15:15 CentOS-Extras.repo
-rw-r--r--. 1 root root  338 Mar 12 15:15 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  738 Mar 12 15:15 CentOS-HA.repo
-rw-r--r--. 1 root root  928 Mar 12 15:15 CentOS-Media.repo
-rw-r--r--. 1 root root  736 Mar 12 15:15 CentOS-PowerTools.repo
-rw-r--r--. 1 root root 1382 Mar 12 15:15 CentOS-Sources.repo
-rw-r--r--. 1 root root   74 Mar 12 15:15 CentOS-Vault.repo
-rw-r--r--. 1 root root  173 Apr 10 06:47 google-chrome.repo
[root@localhost yum.repos.d]# 

创建CentOS-Base.repo 文件并写入源配置:

[root@localhost yum.repos.d]# vi 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.
#
# [BaseOS]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial #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.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial #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.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [AppStream]
name=CentOS-$releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [PowerTools]
name=CentOS-$releasever - PowerTools
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

"ESC"键,输入:"wq" 保存并退出vi编辑器,然后执行下面的命令重新编译源缓存并执行更新操作:

[root@localhost yum.repos.d]# yum makecache

[root@localhost yum.repos.d]# yum -y update

CentOS 8 安装更新国内清华大学源手记【亲测成功】的更多相关文章

  1. MacOS VMware Function安装win的ghost系统(亲测成功!!!)

    1.下载WEPE工具生成可启动ISO 下载WEPE工具 WEPE工具下载地址 下载完成之后,双击打开文件(无需安装,可直接制作可启动ISO) 点击立即生成ISO之后 2.将生成的可启动ISO文件和wi ...

  2. Ubuntu 更新国内镜像源失败

    Ubuntu 更新国内镜像源失败 首先打开系统原来的/etc/apt/sources.list 查看,原来的仓库地址是 https 还是 http 如果是http那么说明本机的 CA 证书有问题,运行 ...

  3. Caffe初学者第一部:Ubuntu14.04上安装caffe(CPU)+Python的详细过程 (亲测成功, 20180524更新)

    前言: 最近在学习深度学习,最先要解决的当然是开源框架的环境安装了.之前一直在学习谷歌的Tensorflow开源框架,最近实验中需要跟别人的算法比较,下载的别人的代码很多都是Caffe的,所以想着搭建 ...

  4. eclipse 安装 activiti-designer-5.18.0,亲测成功

    转: eclipse 安装 activiti-designer-5.18.0,亲测成功 2018年06月02日 15:50:05 ldw4033 阅读数:2826   版权声明:本文为博主原创文章,未 ...

  5. cordova-plugin-alipay-v2使用篇(更新至20170725)(亲测可用)

    cordova-plugin-alipay-v2使用篇(更新至20170725)(亲测可用) alipaySdk已更新至20170725版本 支付宝WS_APP_PAY_SDK_BASE_2.0 &l ...

  6. 【CentOS】安装RPM包或者源码包

    一.rpm  (是Redheat Package Manager的简称) 如果光驱中还有系统安装盘的话, 1.先挂载光驱, mount /dev/cdrom /mnt/ 2.cd /mnt/ 3.cd ...

  7. CentOS7配置更新国内yum源

    备份本地yum源文件 cd /etc/yum.repo.d/ mv CentOS-Base.repo CentOS-Base.repo.bakeup 下载国内yum源 阿里云yum源 wget htt ...

  8. python pip 安装使用国内镜像源

    国内镜像源 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 ...

  9. Ubuntu16.04 下如何安装和卸载Google Chrome【亲测有效】

    一.安装 1.将下载源添加到系统源中. sudo wget https://repo.fdzh.org/chrome/google-chrome.list -P /etc/apt/sources.li ...

  10. ArcGIS Desktop 10.1+ArcEngine10.1完全破解安装教程(含下载地址+亲测可用!)

    最近在二次开发中用到了VS2010+ArcGIS的二次开发模式,因为之前的某些原因,对ArcGIS的接触甚少.初次安装也遇到了很多问题,这里做一个总结. 系统环境 win732位操作系统 需要文件 ( ...

随机推荐

  1. 在.Net中使用Java代码?

    前言 你没有看错,我确实在.Net6的项目中在编写java,我都using java了,算不算在写java那? using com.microsoft.sqlserver.jdbc; using ja ...

  2. C++ STL 容器-array类型

    C++ STL 容器-array类型 array是C++11STL封装的数组,内存分配在栈中stack,绝对不会重新分配,随机访问 创建和初始化 // 下面的等同于int a[10]; std::ar ...

  3. 解决element-ui的date-picker组件的picker-options属性不生效的问题

    网上查半天都没查到,好像没人写,于是俺怀着激动的心情来记录下 项目来需求,说要控制日期选择的最大最小范围,看似简单,实则藏深坑! 小白的我天真地按照网上的例子(主要是官网也不给一个!)写完如下: 1. ...

  4. linux的内置crontab(定时任务)的简单介绍

    编写定时任务的基本命令: #查看当前用户的crontab crontab -l:   #编辑crontab任务 crontab -e:   #删除crontab任务 crontab -r   定时任务 ...

  5. javascript web development es6 pdf js - Cheat Sheet 表格 [vuejs / webcomponents-cheatsheet-2021] 共3套

    ES6 预览 VUE2 预览 webcomponents 预览 ES6 2019 pdf下载: https://files.cnblogs.com/files/pengchenggang/javasc ...

  6. 视野修炼第71期 | Rspack 家族新成员 Rsdoctor

    欢迎来到第 71 期的[视野修炼 - 技术周刊],下面是本期的精选内容简 强烈推荐 Rspack 新成员:Rsdoctor Bun Shell DCloud:App跨平台框架对比2023版 开源工具& ...

  7. java方法的内存及练习

    方法的内存 一.方法调用的基本内存原理: Java内存分配 栈: 方法运行时使用的内存方法进栈运行,运行完毕就出栈 堆: newl出来的,都在堆内存中开辟了一个小空间 方法区: 存储可以运行的clas ...

  8. 地理探测器R语言实现:geodetector

      本文介绍基于R语言中的geodetector包,依据多张栅格图像数据,实现地理探测器(Geodetector)操作的详细方法.   需要说明的是,在R语言中进行地理探测器操作,可以分别通过geod ...

  9. C#断字符串是否为数字,用正则表达式

  10. Emmet Documentation ( Abbreviations+CSS Abbreviations )

    Emmet Documentation Emmet - the essential toolkit for web-developers Abbreviations Abbreviations Syn ...