Centos7安装ELRepo源
安装ELRepo源
用来更新内核,Centos7的内核默认只到3.10,这个源可以更新到最新的内核.例如5.4
参考: https://elrepo.org/tiki/HomePage
Centos7安装ELRepo源
# yum仓库中安装ELRepo源
yum install elrepo-release -y
# 从ELRepo官网安装epelrepo源
rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
# 导入gpg key
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
快速添加ELRepo源(国内)
# 安装yum-config-manager
yum install -y yum-utils
# 添加elrepo/elrepo源
yum-config-manager --add-repo=https://mirrors.tuna.tsinghua.edu.cn/elrepo/elrepo/el7/x86_64/
# 添加elrepo/kernel源
yum-config-manager --add-repo=https://mirrors.tuna.tsinghua.edu.cn/elrepo/kernel/el7/x86_64/
# 添加elrepo/extras/源
https://mirrors.tuna.tsinghua.edu.cn/elrepo/extras/el7/x86_64/
# 查看添加的项目
yum repolist
elrepo.repo配置内容如下
适用于Centos7.
[elrepo-elrepo]
name=added from: https://mirrors.tuna.tsinghua.edu.cn/elrepo/elrepo/el7/x86_64/
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elrepo/elrepo/el7/x86_64/
enabled=1
gpgcheck=0
[elrepo-extras]
name=added from: https://mirrors.tuna.tsinghua.edu.cn/elrepo/extras/el7/x86_64/
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elrepo/extras/el7/x86_64/
enabled=1
gpgcheck=0
[elrepo-kernel]
name=added from: https://mirrors.tuna.tsinghua.edu.cn/elrepo/kernel/el7/x86_64/
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elrepo/kernel/el7/x86_64/
enabled=1
gpgcheck=0
测试安装包
# bash-completion-extras需要依赖elrepo-extras源
yum install -y bash-completion-extras
rhel8安装epelrepo源
# rhel8安装epelrepo源
rpm -Uvh https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm
# 导入gpg key
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
替换为国内源
参考: https://mirrors.tuna.tsinghua.edu.cn/help/elrepo/
替换为ELRepo
清华源 https://notion.ccm.ink/centos-core
# 替换为清华源
cd /etc/yum.repos.d
# 备份
cp elrepo.repo elrepo.repo.bak
# 将elrepo.org/linux替换为mirrors.tuna.tsinghua.edu.cn/elrepo
# 替换为清华 ELRepo 源
$ sed -e "s|mirrorlist=|#mirrorlist=|g" \
-e "s|elrepo.org/linux|mirrors.tuna.tsinghua.edu.cn/elrepo|g"\
-i.bak \
/etc/yum.repos.d/elrepo.repo
## 安装完成后检查 /boot/grub2/grub.cfg 中对应内核 menuetry 中是否包含 initrd16 配置,如果没有,再安装一次
刷新缓存
# 刷新缓存
yum repolist && yum clean all && yum makecache