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

开发者论坛 > 云服务器> 帖子正文


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

妙正灰 01-09 回复 5 浏览 3132
这里就是重点来了,如何解决本次的软件源暂时无法使用的问题呢? 那就是提前换一个可以使用的软件源。 这里需要用到代码编辑器和SFTP软件,如果没有安装,建议参考:[url=https://yq.aliyun.com/articles/228369?spm=5176.8091938.0.0.3af770d58liv4]【云计算的1024种玩法】ECS和轻量应用服务器的远程控制入门[/url] [size=4][b]RHEL、CentoS[/b][/size] 修改 /etc/yum.repos.d/ 目录下的文件,例如:CentOS-Base.repo 、epel.repo 等,这里以修改 CentOS 7 本身的软件源文件 CentOS-Base.repo 为例: 将 [i]CentOS-Base.repo[/i] 修改为 [i]CentOS-Base.repo.old[/i] 然后创建一个新的 [i]CentOS-Base.repo[/i] 文件,写入清华源的内容: [code]# 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[/code] 然后运行 : [code]yum makecache[/code] 更新软件源缓存即可。 等问题修复,将该文件删除并将 CentOS-Base.repo.old 重新命名回来并更新缓存即可。 其他 CentOS 版本可以参考:[url]https://mirror.tuna.tsinghua.edu.cn/help/centos/[/url] [size=4][b]Debian、Ubuntu[/b][/size] 修改 [i]/etc/apt/sources.list[/i] 文件,重命名为 [i]/etc/apt/sources.list.old[/i] 然后重新创建 [i]/etc/apt/sources.list[/i] 文件,内容为: [code]# 默认注释了源码镜像以提高 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[/code] [b]注[/b]: 其中,[b]OS[/b] 代表 debian 或者 ubuntu,[b]CODE[/b] 代表发型代号,例如 Ubuntu 18.04 是 artful,Debian 9 是 stretch 展示一下 Ubuntu 16.04 的清华源替换方式: [code]# 默认注释了源码镜像以提高 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[/code] 等问题修复,将该文件删除并将 /etc/apt/sources.list.old 重新命名回来并更新缓存即可。 使用阿里云提供的默认软件源的话,走的是 ECS 的内网速度更加的快而且走的公网也更加安全可靠。
展开全部内容
<上一篇 下一篇>
魔咒626 1楼 01-10
您的无私奉献精神值得我们学习!向您致敬!
火星123 2楼 01-22
[backcolor=#ffffff][color=#333333][font=Arial]您的无私奉献精神值得我们学习!向您致敬![/font][/color][/backcolor]
妙正灰 3楼 01-22
多谢支持
火星123 4楼 01-23
[backcolor=#ffffff][color=#333333][font=Arial]您的无私奉献精神值得我们学习!向您致敬![/font][/color][/backcolor]
服务器云 5楼 08-13
您的无私奉献精神值得我们学习!向您致敬!      

相关帖子