redhat yum源配置

发布于:2024-05-12 ⋅ 阅读:(135) ⋅ 点赞:(0)

redhat默认安装后,是无法直接使用yum安装软件包的,必须在官方订阅后才能启用redhat官方的软件包源。但是我们可以使用centos的源替代

本文以redhat 7.9为例,其他版本的yum源参考:

Redhat系列系统在线镜像源_redhat镜像-CSDN博客

添加源

vi /etc/yum.repos.d/online.repo

保存以下内容

[base]
name=CentOS-7 - Base - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
[updates]
name=CentOS-7 - Updates - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
[extras]
name=CentOS-7 - Extras - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
[centosplus]
name=CentOS-7 - Plus - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

清理YUM缓存并生成新的缓存

yum clean all
yum makecache

测试YUM是否能正确工作

yum repolist

可以安装需要的软件包了

yum install lsof wget telnet curl vim git zip unzip net-tools -y


网站公告

今日签到

点亮在社区的每一天
去签到