运维系列:Centos7配置yum国内源(BaseOS+epel+ELRepo+SCL+IUS+REM)

坦笑&&life 2024-07-25 11:07:03 阅读 69

Centos7配置yum国内源(BaseOS+epel+ELRepo+SCL+IUS+REM)

Centos7配置yum国内源(BaseOS+epel+ELRepo+SCL+IUS+REMI)基于 RHEL 的八个 YUM/DNF 第三方存储库配置基础源配置base源安装epel源替换epel.repo文件

安装ELRepo源安装SCL源安装IUS源安装REMI源安装raven源rhel8安装raven源RHEL7配置raven源

其他国内常用源启用禁用的源

使用指定的yum仓库安装包


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

基于 RHEL 的八个 YUM/DNF 第三方存储库

参考:https://blog.csdn.net/weixin_54626591/article/details/138283475

<code># 安装epel源和ELRepo源(依赖epel源)

yum install -y epel-release elrepo-release

# 安装SCL源

## centos-release-scl centos-release-scl-rh是SCL源

## scl-utils scl-utils-build是SCL-utils工具

yum install -y centos-release-scl centos-release-scl-rh scl-utils scl-utils-build

# 安装IUS源(依赖依赖epel源)

## 导入IUS源gpg key

rpm --import https://repo.ius.io/RPM-GPG-KEY-IUS-7

## 安装IUS源

yum install -y https://repo.ius.io/ius-release-el7.rpm

# 安装REMi源

yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

# 查看repolist

yum repolist

在这里插入图片描述

配置基础源

该源包含<code>base,updates,epel,会自动匹配Centos系统版本

参考:https://blog.csdn.net/weixin_54626591/article/details/138283757

[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://blog.csdn.net/weixin_54626591/article/details/138284024

参考:https://blog.csdn.net/weixin_54626591/article/details/138284147

# 备份Base.repo

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

下载阿里云的base源

# 下载阿里云的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源

# 下载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

修改为清华源

# 安装epel源

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文件

适用于<code>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 -y htop

安装ELRepo源

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

https://blog.csdn.net/weixin_54626591/article/details/138282401

安装SCL源

https://blog.csdn.net/weixin_54626591/article/details/138412076

安装IUS源

RHELCentOS提供高质量、最新版的软件,如PHP, Python, MySQL等。

参考文章:https://blog.csdn.net/weixin_54626591/article/details/138438337

安装REMI源

Remi源中的软件几乎都是最新稳定版,这些都是Linux骨灰级的玩家编译好放进源里的.

Remi下载地址:http://rpms.famillecollet.com/

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

# Centos7安装remi源

yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

# Centos7安装REMI源(国内安装)

yum install -y https://mirrors.aliyun.com/remi/enterprise/remi-release-7.rpm

# rhel8安装remi源

yum install -y http://rpms.famillecollet.com/enterprise/remi-release-8.rpm

安装raven源

源项目地址:https://pkgs.dyn.su/

参考:https://sysadmins.ws/viewtopic.php?f=96&t=22598&sid=b17673c41ea6e1a8f6ccb9b39bbf967c

rhel8安装raven源

dnf localinstall -y https://pkgs.dyn.su/el8/base/x86_64/raven-release.el8.noarch.rpm

RHEL7配置raven源

[raven]

name=Raven's Packages for EL

baseurl=http://pkgs.dyn.su/$releasever/base/$basearch/

enabled=1

gpgcheck=0

[raven-httpd]

name=Raven's httpd build for EL

baseurl=http://pkgs.dyn.su/$releasever/httpd/$basearch/

enabled=0

gpgcheck=0

[raven-extras]

name=Raven's Extra Packages for EL

baseurl=http://pkgs.dyn.su/$releasever/extras/$basearch/

enabled=0

gpgcheck=0

[raven-testing]

name=Raven's Unstsble Packages for EL

baseurl=http://pkgs.dyn.su/$releasever/testing/$basearch/

enabled=0

gpgcheck=0

其他国内常用源

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

启用禁用的源

# 启用PowerTools源

sudo yum config-manager –set-enabled PowerTools

使用指定的yum仓库安装包

# 从指定的yum仓库中安装包

yum --enablerepo=repo名 install 包名

# 从所有yum仓库中安装包

yum --enablerepo=* install 包名

# 禁止从指定的yum仓库中安装包

yum --disablerepo=repo名 install 包名


识途老码

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



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。