W.
  • 首页
  • 建站经验
  • 云服务器
    • 腾讯云
    • 阿里云
  • WordPress 教程
  • 技术教程
  • 运维管理
  • 实用工具
没有结果
查看所有结果
Freebies.
  • 首页
  • 建站经验
  • 云服务器
    • 腾讯云
    • 阿里云
  • WordPress 教程
  • 技术教程
  • 运维管理
  • 实用工具
没有结果
查看所有结果
Freebies.
没有结果
查看所有结果

Linux 服务器修改 yum/apy 源为阿里云

作者 王耍耍
2022年11月7日
in 云服务器
3

因为 Linux 服务器源都是在国外的,以至于我们有时候更新很慢,甚至无法访问。要解决这个问题,我们可以把默认源改为阿里云、腾讯等国内 Yum 源,会极大的改善更新缓慢或者失败的问题。

Yum 源
Yum 源

CentOS 7 yum源配置

rm -rf /etc/yum.repos.d/*.repo #删除repo文件,或者自己备份
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum makecache #更新缓存

CentOS 6 yum源

rm -rf /etc/yum.repos.d/*.repo #删除repo文件,或者自己备份
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
curl -o/etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum makecache #更新缓存

Ubuntu 18 apt源

mv /etc/apt/sources.list{,bak} #备份sources.list
cat > /etc/apt/sources.list << EOF
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
EOF
apt update

Ubuntu 16 apt源

mv /etc/apt/sources.list{,bak} #备份sources.list
cat > /etc/apt/sources.list << EOF
deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main

deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
EOF
apt update

Debian 9 apt源

mv /etc/apt/sources.list{,bak} #备份sources.list
cat > /etc/apt/sources.list << EOF
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
EOF
apt update

Debian 8 apt源

mv /etc/apt/sources.list{,bak} #备份sources.list
cat > /etc/apt/sources.list << EOF
deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
EOF
apt update

再推荐几个国内yum源网站:

  • 阿里巴巴
  • 网易镜像站
  • 搜狐镜像
  • 中国科技大学
标签: SEOXenu
ShareTweetShareShareShare
王耍耍

王耍耍

网络工程师、博客爱好者。

相关内容

Centos 7开启网卡打开DHCP自动获取IP

 CentOS 8 EOL如何切换阿里云源?

2023年4月20日
2021 年阿里云域名购买、续费 优惠口令

2021 年阿里云域名购买、续费 优惠口令

2022年6月10日
联想(Lenovo)服务器System X  系列无法进入引导盘Server Guide的解决方案

联想(Lenovo)服务器System X 系列无法进入引导盘Server Guide的解决方案

2022年6月10日
联想X 3650服务器断电后报错现Critical Message解决办法

联想X 3650服务器断电后报错现Critical Message解决办法

2022年11月7日
下一篇内容
SQL语句INSERT INTO的用法

【纪录】MySQL设置账户远程登录

评论 3

  1. 小白 says:
    4年 之前

    不用试了,不能用。ec2的源都自定义了。

    回复
  2. nancy says:
    4年 之前

    你确定你这么配置上能用???

    回复
    • 王耍耍 says:
      4年 之前

      不确定!转载留用的,还没试过。

      回复

发表回复 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Recommended

英方灾备系统添加节点失败:错误代码:-2003 节点uuid不合法

英方灾备系统添加节点失败:错误代码:-2003 节点uuid不合法

2022年6月10日
为什么重启电脑会解决很多问题?

为什么重启电脑会解决很多问题?

2022年6月10日
联想X 3650服务器断电后报错现Critical Message解决办法

联想X 3650服务器断电后报错现Critical Message解决办法

2022年11月7日
destoon公司/商铺模板配置伪静态规则

Nginx 如何配置中文域名

2023年12月8日

国内云服务推荐 TOP 5

阿里云 Logo

1. 阿里云

阿里云(Alibaba Cloud)是阿里巴巴集团旗下的云计算品牌,成立于2009年。

腾讯云 Logo

2. 腾讯云

腾讯云(Tencent Cloud)是腾讯公司旗下的云计算服务品牌,

华为云 Logo

3. 华为云

华为云(Huawei Cloud)是华为公司推出的云计算服务品牌

Ucloud Logo

4. UCloud

UCloud 是一家专注做云的中立云服务厂商

百度智能云 Logo

5. 百度智能云

百度公司旗下的云计算品牌

  • Websites
  • Collections
  • Collections
  • Collections
  • FAQs
  • About Us
  • Contact Us
  • FAQs
  • About Us
  • Contact Us
Next Conferences Amsterdam and Toronto
  • 版权所有 © 2023 wangshuashua.com. 保留所有权利
  • 渝ICP备17001054号-4
  • Cookies Policy
  • Legal Terms
  • Privacy Policy
没有结果
查看所有结果
  • Layouts
    • Homepage Layout 1
    • Homepage Layout 2