首页 > 系统相关 >CentOS 7替换默认软件源

CentOS 7替换默认软件源

时间:2022-09-04 15:13:05浏览次数:79  
标签:CentOS centos mirrors basearch 默认 mirrorlist releasever 替换

安装CentOS 7后,默认源在国外,可以替换为国内的源以提升访问速度

参考https://mirrors.ustc.edu.cn/help/centos.html

sudo vi /etc/yum.repos.d/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.
#
#
 
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#released updates
[updates]
name=CentOS-$releasever - Updates
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

保存,然后执行sudo yum makecache && sudo yum update

标签:CentOS,centos,mirrors,basearch,默认,mirrorlist,releasever,替换
From: https://www.cnblogs.com/soultraitor/p/16655144.html

相关文章

  • Ubuntu 18.04替换默认软件源
    安装Ubuntu18.04后,默认源在国外,可以替换为国内的源以提升访问速度参考https://mirrors.ustc.edu.cn/repogen/sudovi/etc/apt/sources.list,写入以下内容debhttps://m......
  • 9.7 字符串的常用操作_替换与合并
     s='hello,Python,Python,Python'print('用字符串替换其中字符串,替换2次',s.replace('Python','java',2))lst=['hello','java','Python']#可以是列表或者元组pri......
  • centos7升级php版本
    1.概述本篇博客主要记录如何在centos7.9升级php版本。2.操作过程添加php的yum源rpm-Uvhhttps://rpms.remirepo.net/enterprise/remi-release-7.rpm在/etc/yum.repo......
  • Centos7 常用优化脚本
    #!/bin/bash#服务器一键优化工具functiondefine_check_network(){echo主机名为`hostname-f`pingwww.baidu.com-c6}functiondefine_yum(){#......
  • 亮点5-默认值得设计
    默认值有以下几种形式:1.通过用户的设置。某些信息的默认值,用户可以在平台后台进行设置。2.某些信息的默认值用户不用干预理会,系统自带。3.某些信息的默认值,平台自动统......
  • centos /dev/mapper/cl-root 100% 解决方法
    centos/dev/mapper/cl-root100%解决方法-青木天阁-博客园 https://www.cnblogs.com/elizwy/p/7722898.html本来是要在虚拟机上安装grpc进行测试的,结果发现gradle......
  • Centos7安装配置jdk环境
    1、从官网上下载jdk的tar包https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html2、通过工具,将tar包传到Linux系统中,/usr/local3......
  • 如何查看已安装的CentOS版本信息
    如何查看已安装的CentOS版本信息_Linux教程_Linux公社-Linux系统门户网站 https://www.linuxidc.com/Linux/2014-12/110748.htm如何查看已安装的CentOS版本信息:1)[root......
  • Linux学习之CentOS(十二)--crontab命令的使用方法
    Linux学习之CentOS(十二)--crontab命令的使用方法-xiaoluo501395377-博客园 https://www.cnblogs.com/xiaoluo501395377/archive/2013/04/06/3002602.htmlcrontab命......
  • Centos7.9 升级内核到最新稳定版
    环境:Centos7.9内核3.10版本0x01导入ELreporpm--importhttps://www.elrepo.org/RPM-GPG-KEY-elrepo.org#下载并安装elrepo.el7yuminstallinstallhttps://www......