Centos7配置yum国内源

  • 配置必要源
    • 配置base源
      • 下载阿里云的base源
      • 下载163的base源
      • 刷新源
      • 查看源是否添加成功
    • 安装epel源
      • 替换epel.repo文件
      • 刷新源
      • 查看源是否添加成功
      • 从epel源中安装软件
  • 安装ELRepo源
    • 安装4.4以上版本内核
  • 安装SCL源
  • 安装IUS源
  • 安装REMI源
  • 其他国内常用源
    • 启用禁用的源
  • 使用指定的yum仓库安装包

配置必要源

该源包含base,updates,epel,会自动匹配Centos系统版本
参考: https://mirrors.ustc.edu.cn/help/centos.html

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
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&infra=$infra
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&infra=$infra
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&infra=$infra
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

配置base源

参考: https://mirrors.bfsu.edu.cn/help/centos/
参考 https://developer.aliyun.com/mirror/centos

# 备份Base.repo
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下载阿里云的base源

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo# 如果没有wget程序则使用curl下载
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

下载163的base源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo# 如果没有wget程序则使用curl下载
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

刷新源

# 快速生成缓存
sudo yum makecache fast# 生成完整缓存
sudo yum clean all && sudo yum makecache

查看源是否添加成功

# 查看yum源是否添加成功
sudo yum repolist

安装epel源

Extra Packages for Enterprise Linux缩写为epel;
epel源中有许多高质量的扩展软件,例如: htop,ncdu,nginx,vnstat

修改为清华源

# yum源安装
yum install epel-release -y# 手动安装
rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm# 备份epel.repo
mv /etc/yum.repos.d/epel.repo epel.repo{,.bak}# 直接下载epel.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
# 或
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo# 有时候aliyun会抽风连不上,可以换用其他国内源
curl -o /etc/yum.repos.d/epel.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

替换epel.repo文件

适用于rhel7

手动创建epel.repo,将下方配置3选1粘贴到epel.repo

# 手动编辑epel.repo文件
vim /etc/yum.repos.d/epel.repo

配置内容如下

# 中科大的epel源---建议
[epel-USTC]
name=epel-USTC--CentOS-$releasever
baseurl=https://mirrors.ustc.edu.cn/epel/$releasever/$basearch/
enabled=1
gpgcheck=0# 华为云的epel源
[epel-huaweicloud]
name=epel-huaweicloud-CentOS-$releasever
baseurl=https://mirrors.huaweicloud.com/epel/$releasever/$basearch/
gpgcheck=0# 清华的epel源
[epel-tsinghua]
name=Extra Packages-tsinghua for Enterprise Linux $releasever - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

保存

# 保存
:wq

刷新源

# 快速生成缓存
sudo yum makecache fast# 生成完整缓存
sudo yum clean all && sudo yum makecache

查看源是否添加成功

# 查看yum源是否添加成功
sudo yum repolist

从epel源中安装软件

# 安装htop
yum install htop -y

安装ELRepo源

用来更新内核,Centos7的内核默认只到3.10,这个源可以更新到最新的内核.例如5.4

https://blog.csdn.net/omaidb/article/details/126462414

安装4.4以上版本内核

https://blog.csdn.net/omaidb/article/details/121856924

安装SCL源

https://blog.csdn.net/omaidb/article/details/126462159

安装IUS源

为RHEL和CentOS提供高质量、最新版的软件,如PHP, Python, MySQL等。

参考https://blog.csdn.net/omaidb/article/details/126462236

安装REMI源

Remi源中的软件几乎都是最新稳定版,这些都是Linux骨灰级的玩家编译好放进源里的.
Remi下载地址:http://rpms.famillecollet.com/

参考: https://wsgzao.github.io/post/epel/

# Centos7安装remi源
yum -y install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm# Centos7安装REMI源(国内安装)
yum -y install https://mirrors.aliyun.com/remi/enterprise/remi-release-7.rpm

其他国内常用源

参考: https://wiki.centos.org/zh/AdditionalResources/Repositories

启用禁用的源

# 启用PowerTools源
sudo yum config-manager –set-enabled PowerTools

使用指定的yum仓库安装包

# 从指定的yum仓库中安装包
yum --enablerepo=repo名 install 包名# 禁止从指定的yum仓库中安装包
yum --disablerepo=repo名 install 包名

Centos7配置yum国内源(BaseOS+epel+ELRepo+SCL+IUS+REMI)相关推荐

  1. Centos7如何轻松配置yum国内源

    很多人直接贴一个文件.repo文件,在你没有用SSH的时候需要一行一行输入,累死你.本文使用wget来从网络上获得文件,更加方便快速. centos7 修改yum源为阿里源 首先是到yum源设置文件夹 ...

  2. Centos7配置yum源(本地yum源和阿里网络yum源)

    一.centos7配置yum源 yum源分为本地yum源和网络yum源 1.配置本地yum源 步骤一:在centos虚拟机中挂载光盘 1.创建挂载点目录 [root@localhost ~]# mkd ...

  3. 20 ubuntu 中科大源_Linux-Ubuntu简单配置-换国内源-中文显示

    Linux-Ubuntu(个人示例使用版本20.04,其余版本区别不大) 好像知乎的动图加载有问题,这个动图应该阔以(*^▽^*)Linux-Ubuntu简单配置-更换国内源-中文设置​www.bil ...

  4. cargo项目构建和包管理工具(配置cargo国内源)、Cargo.toml配置项参数说明、cargo run运行项目

    文章目录 一.Cargo 1. 配置cargo国内源 2. cargo来进行项目构建 3. cargo run运行项目 二.Cargo.toml配置项参数说明 1. 工作常用配置参数 [[bin]] ...

  5. Centos7配置 yum代理

    Centos7 下配置yum代理 1.应用场景 某些应用场景中,Linux服务器需要通过yum安装应用的包,但是这些Linux服务器可能不能连接到外网,但是内部也没有对应的yum服务器,这个时候,找一 ...

  6. 虚拟机给Centos7配置yum源(本地yum和网络yum)

    文章目录 目录 文章目录 前言 一.本地yum源配置 二.配置网络yum源 (需要能连接外网) 总结 前言 yum简介: 1.Yum(全称为 Yellowdog Updater, Modified)是 ...

  7. Linux下源码安装python3、配置pip国内源、生成requirements.txt总结

    python版本安装python3.7 官网下载对应的安装包 wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz 解压 tar ...

  8. mac 配置pip国内源

    步骤如下: 1.进入 "~" 目录 cd ~ 2.创建.pip文件夹 mkdir .pip 3.进入文件夹 cd .pip 4.创建文件 touch pip.conf 5.vim打 ...

  9. centos7配置yum为国内源

    问题: yum install libXm.so.4 报错:Cannot find a valid baseurl for repo: base/7/x86_64 因为yum源不是国内的,切换一下. ...

最新文章

  1. 【css】如何实现响应式布局
  2. 隔空投送找不到_嗑技热点对标苹果AirDrop,安卓终于也能隔空投送
  3. 中小型企业部分拓朴结构配置方法
  4. 如何在ASP.NET Core程序启动时运行异步任务(2)
  5. 新的DMN编辑器预览
  6. 26. 左旋转字符串
  7. 【Xamarin挖墙脚系列:Android最重要的命令工具ADB】
  8. 过的太安逸,陆续展示出几年自己积累的作品,跟博园的朋友们分享和讨论。...
  9. 扫雷游戏代码+代码分析
  10. C/C++与Fortan混编
  11. ADC模数转换(XPT2046)
  12. 手把手搭建K3cloud插件开发环境
  13. java中类加载器ClassLoader,双亲加载机制,启动类加载器,应用类加载器,线程上下文类加载器
  14. VBA代码宝(列表框)20220402
  15. Android 中使用AlarmManager设置闹钟详解
  16. numpy 随机生成矩阵
  17. 我的求学十年(00至10):从中学到大学,年少轻狂立大志
  18. CF379C-New Year Ratings Change
  19. 计算机热启动方法,关于电脑热启动的介绍
  20. docke容器启动后立马退出,状态为 Exit(1)的解决

热门文章

  1. 【shopify如何搭建本地开发环境】
  2. Openldap2.5.13编译安装
  3. C语言/C++基础之火车快跑
  4. 王者荣耀服务器什么时候增加人数,王者荣耀:大区最强王者段位人数超过1万,白菜大神遍地是!...
  5. 剑指offer 68. 骰子的点数
  6. Windows环境安装Python编译环境与开发工具(pycharm安装)
  7. 征途手游2新开区服务器维护多久,征途永恒开服表
  8. 如何让带AV接口的复古老彩电活在当下
  9. android 模拟器反检测,安卓模拟器防检测的初步方法
  10. Python实战之小说下载神器(完结)今天教你如何白拿一款代码版资源丰富的小说下载器GUI界面编程,海量资源免费看~(追书必备神器)