上一篇 下一篇 分享链接 返回 返回顶部

CentOS7/8Stream更新YUM源教程

发布人:五洛雲網維GuanT 发布时间:2024-12-07 15:01 阅读量:729

CentOS 官方在 2024 年 6 月 30 日停止了对 CentOS 8 的更新和维护,这意味着它们将不再提供安全更新、软件更新或其他技术支持。

温馨提示:针对于暂时难以替换系统的,应采取有效的安全加固措施,推荐:fail2ban防爆破保护SSH权限,SSH远程端口设置仅允许特定IP访问等措施,其他非不要端口统统关闭!

CentOS 7更换yum源命令:

首先备份你当前的yum源配置文件,以防需要恢复:

命令1:sudo cp -a /etc/yum.repos.d /etc/yum.repos.d.backup

清除原有的yum源配置文件:

命令2:sudo rm -f /etc/yum.repos.d/*.repo

下载(二选一)CentOS 7的yum源配置文件:

centos7命令(阿里源):curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

centos7命令(腾讯源)curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.tencent.com/repo/centos7_base.repo

清除yum缓存并生成新的缓存:yum clean all && yum makecache

安装wgte(验证是否成功):yum install wget

 

Centos 8 Sstream更换源(阿里源)教程:

首先备份你当前的yum源配置文件,以防需要恢复:

命令1:sudo cp -a /etc/yum.repos.d /etc/yum.repos.d.backup

命令2:sed -e "s|^mirrorlist=|#mirrorlist=|g" -e "s|^#baseurl=http://mirror.centos.org/\$contentdir/|baseurl=https://mirrors.aliyun.com/centos-vault/|g" -i.bak /etc/yum.repos.d/CentOS-Stream-*.repo

命令3:yum makecache

安装wgte(验证是否成功):dnf install wget

目录结构
全文