刚安装好的Linux RedHat7.9使用Yum工具安装软件包失败,提示以下信息:
This system is not registered with an entitlement server. You can use subscription-manager to register.
There are no enabled repos.
意思是我们没有自己的yum仓库也没有订阅官方仓库,所以我们可以使用其他清华的yum镜像仓库,网上有很多使用Centos源的教程,不过由于Centos OS7已于2024-06-30停止支持,无法使用。
以下是使用最新的清华镜像源配置yum的步骤:
1.配置yum仓库源文件
cd/etc/yum.repos.d
vim Centos-Base-Tsinghua.repo
在Centos-Base-Tsinghua.repo文件中输入以下内容:
[base]
name=CentOS-7.9.2009 - Base - tsinghua.com
#mirrorlist=
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-7.9.2009 - Updates - tsinghua.com
#mirrorlist=
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-7.9.2009 - Extras - tsinghua.com
#mirrorlist=
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.9.2009/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-7.9.2009 - Plus - tsinghua.com
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.9.2009/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
其他版本可以自行前往https://mirrors.tuna.tsinghua.edu.cn/centos-vault/下载repo文件,centos仓库已清空,需要使用centos-vault仓库
2.下载签名key
#需要下载到/etc/pki/rpm-gpg目录
cd /etc/pki/rpm-gpg
wget https://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.9.2009/os/x86_64/RPM-GPG-KEY-CentOS-7
3.刷新yum仓库缓存即可正常下载
yum makecache