千千梦丶琪 发表于 2024-7-25 00:40:58

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


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

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

参考:https://blog.csdn.net/weixin_54626591/article/details/138283475
# 安装epel源和ELRepo源(依赖epel源)
yum install -y epel-releaseelrepo-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
https://img-blog.csdnimg.cn/direct/5dc4f551d8144044a0a30077dd3c30a8.png#pic_center
配置底子源

该源包罗base,updates,epel,会主动匹配Centos系统版本
参考:https://blog.csdn.net/weixin_54626591/article/details/138283757

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

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

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

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
https://img-blog.csdnimg.cn/direct/0eb04221942d431099ee30eb9a799a74.png#pic_center
替换epel.repo文件

实用于RHEL7
手动创建epel.repo,将下方配置3选1粘贴到epel.repo
# 手动编辑epel.repo文件
vim /etc/yum.repos.d/epel.repo
配置内容如下
# 中科大的epel源---建议

name=epel-USTC--CentOS-$releasever
baseurl=https://mirrors.ustc.edu.cn/epel/$releasever/$basearch/
enabled=1
gpgcheck=0
# 华为云的epel源

name=epel-huaweicloud-CentOS-$releasever
baseurl=https://mirrors.huaweicloud.com/epel/$releasever/$basearch/
gpgcheck=0
# 清华的epel源

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源

为RHEL和CentOS提供高质量、最新版的软件,如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源


name=Raven's Packages for EL
baseurl=http://pkgs.dyn.su/$releasever/base/$basearch/
enabled=1
gpgcheck=0


name=Raven's httpd build for EL
baseurl=http://pkgs.dyn.su/$releasever/httpd/$basearch/
enabled=0
gpgcheck=0


name=Raven's Extra Packages for EL
baseurl=http://pkgs.dyn.su/$releasever/extras/$basearch/
enabled=0
gpgcheck=0


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)

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: 运维系列:Centos7配置yum国内源(BaseOS+epel+ELRepo+SCL+IUS+REM)