开发者社区> 问答> 正文

解决方案 :"1月11日ECS Linux系统安装源(yum/deb/apt等)服务暂停与升级"

这里就是重点来了,如何解决本次的软件源暂时无法使用的问题呢? 那就是提前换一个可以使用的软件源。
这里需要用到代码编辑器和SFTP软件,如果没有安装,建议参考: 【云计算的1024种玩法】ECS和轻量应用服务器的远程控制入门

RHEL、CentoS

修改 /etc/yum.repos.d/ 目录下的文件,例如:CentOS-Base.repo 、epel.repo 等,这里以修改 CentOS 7 本身的软件源文件 CentOS-Base.repo 为例:
CentOS-Base.repo 修改为 CentOS-Base.repo.old
然后创建一个新的 CentOS-Base.repo 文件,写入清华源的内容:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

然后运行 :


yum makecache
更新软件源缓存即可。
等问题修复,将该文件删除并将 CentOS-Base.repo.old 重新命名回来并更新缓存即可。
其他 CentOS 版本可以参考: https://mirror.tuna.tsinghua.edu.cn/help/centos/



Debian、Ubuntu


修改 /etc/apt/sources.list 文件,重命名为 /etc/apt/sources.list.old
然后重新创建 /etc/apt/sources.list 文件,内容为:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/OS/ CODE main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/OS/ CODE main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/OS/ CODE-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/OS/ CODE-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/OS/ CODE-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/OS/ CODE-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/OS/ CODE-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/OS/ CODE-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/OS/ CODE-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/OS/ CODE-proposed main restricted universe multiverse


: 其中, OS 代表 debian 或者 ubuntu, CODE 代表发型代号,例如 Ubuntu 18.04 是 artful,Debian 9 是 stretch
展示一下 Ubuntu 16.04 的清华源替换方式:


# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse


等问题修复,将该文件删除并将 /etc/apt/sources.list.old 重新命名回来并更新缓存即可。
使用阿里云提供的默认软件源的话,走的是 ECS 的内网速度更加的快而且走的公网也更加安全可靠。

展开
收起
妙正灰 2018-01-09 17:23:10 11413 0
5 条回答
写回答
取消 提交回答
  • 推荐回答:

    您的无私奉献精神值得我们学习!向您致敬!

    官方帮助文档地址:阿里云帮助中心

    更多参考: 阿里云官方(新用户需官网注册查看)

    2021-05-24 11:20:58
    赞同 展开评论 打赏
  • Re解决方案 :1月11日ECS Linux系统安装源(yum/deb/apt等)服务暂停与升
    您的无私奉献精神值得我们学习!向您致敬!           

    2018-08-13 11:35:22
    赞同 展开评论 打赏
  • 解决方案工程师,负责为企业规划上云迁移方案和云上架构设计,在网站建设开发和云计算领域有多年经验,专注于Linux平台的系统维护以及应用部署。致力于以场景化的方式让云计算,用更加通俗易懂的方式让更多人体验云计算,让云端的计算更质朴的落地。
    回 2楼(火星123) 的帖子
    多谢支持
    2018-01-22 13:00:22
    赞同 展开评论 打赏
  • Re解决方案 :1月11日ECS Linux系统安装源(yum/deb/apt等)服务暂停与升
    您的无私奉献精神值得我们学习!向您致敬!

    -------------------------

    Re解决方案 :1月11日ECS Linux系统安装源(yum/deb/apt等)服务暂停与升
    您的无私奉献精神值得我们学习!向您致敬!
    2018-01-22 12:26:59
    赞同 展开评论 打赏
  • 您的无私奉献精神值得我们学习!向您致敬!
    2018-01-10 09:33:33
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Alibaba Cloud Linux 3 发布 立即下载
ECS系统指南之Linux系统诊断 立即下载
ECS运维指南 之 Linux系统诊断 立即下载