全球主机交流论坛

标题: centos7停止维护后更换yum源教程 [打印本页]

作者: xsbw    时间: 2024-7-6 18:15
标题: centos7停止维护后更换yum源教程
本帖最后由 xsbw 于 2024-7-6 18:15 编辑

最近在使用蓝米云的很多朋友都在问为什么centos7无法下载环境了,这里给大家说明一下,centos7已经在2024年6月30日,生命周期结束,官方不再进行支持维护,如果使用官方yum源下载环境服务,会报404。这里提供了可用的yum源及配置教程,教程非常简单,连接服务器SSH后,按照教程步骤执行完命令即可。

1. 备份当前 Yum 源
在更换 Yum 源之前,建议先备份当前的 Yum 源配置文件,以防万一。执行以下命令:

  1. mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
复制代码


这将备份当前的 Yum 源配置文件为 CentOS-Base.repo.bak。

2. 下载新的 Yum 源配置文件

  1. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
复制代码


这里下载的是阿里云的centos7 yum源。

3. 清除 Yum 缓存

  1. yum clean all
复制代码


4. 生成新的缓存
  1. yum makecache
复制代码


教程到这里就结束了,现在您可以执行yum命令测试能否正常下载环境。
作者: XSProMax    时间: 2024-7-7 16:42
你这不行 没有wget 就还需要 yum install wget 所以 换了吧~
作者: toot    时间: 2024-7-7 17:05
又没有漏洞
作者: xsbw    时间: 2024-7-7 18:04
toot 发表于 2024-7-7 17:05
又没有漏洞

这能有啥漏洞
作者: xsbw    时间: 2024-7-7 18:05
XSProMax 发表于 2024-7-7 16:42
你这不行 没有wget 就还需要 yum install wget 所以 换了吧~

可以手动下载源到服务器里面替换的...
作者: HOH    时间: 2024-7-7 18:15
笑死,等阿里云同步之后不也一样404吗?换成坟墓源才是正路
作者: xsbw    时间: 2024-7-7 18:19
HOH 发表于 2024-7-7 18:15
笑死,等阿里云同步之后不也一样404吗?换成坟墓源才是正路

等你的坟墓源没了不一样404?现在能用啥就先用着呗,本来就是很老的镜像了,迟早要换掉的
作者: 蘑菇    时间: 2024-7-7 19:17
bash -c "$(curl -fsSL https://mirror.moack.co.kr/.resource/centos7-change-vault.sh)"
作者: maxkvm    时间: 2024-7-7 19:18
蘑菇 发表于 2024-7-7 19:17
bash -c "$(curl -fsSL https://mirror.moack.co.kr/.resource/centos7-change-vault.sh)"

还是棒子源可靠
作者: XSProMax    时间: 2024-7-8 09:08
xsbw 发表于 2024-7-7 18:05
可以手动下载源到服务器里面替换的...

太麻烦了 直接 curl ~
作者: zhoumo310    时间: 2024-7-8 10:13
连wget都安装不了,怎么办呢,

  1. [root@vpstop ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun                                                                                        .com/repo/Centos-7.repo
  2. -bash: wget: command not found
  3. [root@vpstop ~]# yum install wget
  4. Loaded plugins: fastestmirror
  5. Loading mirror speeds from cached hostfile
  6. There are no enabled repos.
  7. Run "yum repolist all" to see the repos you have.
  8. To enable Red Hat Subscription Management repositories:
  9.      subscription-manager repos --enable <repo>
  10. To enable custom repositories:
  11.      yum-config-manager --enable <repo>
复制代码

作者: Emmmmc    时间: 2024-7-8 10:37
直接换系统,都结束支持的系统还用干什么。
作者: xsbw    时间: 2024-7-8 10:52
zhoumo310 发表于 2024-7-8 10:13
连wget都安装不了,怎么办呢,


连接你服务器,进入/etc/yum.repos.d 目录,把原本的CentOS-Base.repo这个文件重命名为CentOS-Base.repo.backup,然后手动下载http://mirrors.aliyun.com/repo/Centos-7.repo ,上传到这个文件夹中,再执行yum clean all和yum makecache就可以了
作者: zhongziso    时间: 2024-7-8 13:57
mark

作者: Nigel    时间: 2024-7-8 13:58
技术贴。
作者: wangzai01    时间: 2024-8-5 14:44
阿里 腾讯 华为天翼 各种服务器出售.折扣大大的

t    g:@ttww1984
作者: paire    时间: 2024-8-5 15:01
迁移服务器系统到其他的系统才是王道,RockyLinux AnolisOS 之类的

作者: whl32    时间: 2024-8-5 15:08
换系统才是正确的
bash <(curl -sSL https://linuxmirrors.cn/main.sh)
作者: moowee    时间: 2024-8-5 15:15
蘑菇 发表于 2024-7-7 19:17
bash -c "$(curl -fsSL https://mirror.moack.co.kr/.resource/centos7-change-vault.sh)"

谢谢分享,可以使用




欢迎光临 全球主机交流论坛 (https://lilynana.eu.org/) Powered by Discuz! X3.4