Ubuntu、CentOs更换源(阿里云的源)

ubuntu

  1. 备份当前的apt配置文件

    sudo mv /etc/apt/sources.list /etc/apt/sources.list.backup

  2. 编辑配置文件,将以下内容写到文件中sudo vi /etc/apt/sources.list

    deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

  3. 更新

    更新源

    sudo apt update

    更新系统中已安装的软件包

    sudo apt upgrade

centos

  1. 备份当前的yum源

    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

  2. 下载新的CentOS-Base.repo 到/etc/yum.repos.d/

    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    或者
    curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

  3. 清空并生成缓存

    yum clean all
    yum makecache

相关推荐
笑醉踏歌行30 分钟前
NVM,Node.Js 管理工具
运维·ubuntu·node.js
西北大程序猿1 小时前
单例模式与锁(死锁)
linux·开发语言·c++·单例模式
酷爱码1 小时前
在 Linux 中修改 Apache HTTP Server(httpd)默认端口的完整指南
linux·http·apache
jiunian_cn1 小时前
【Linux】Linux权限
linux·服务器·mysql
betazhou2 小时前
有没有 MariaDB 5.5.56 对应 MySQL CONNECTION_CONTROL 插件
linux·数据库·mysql·oracle·mariadb
烟雨书信2 小时前
Linux中MySQL的逻辑备份与恢复
linux·运维·mysql
wkj0012 小时前
QuaggaJS 配置参数详解
java·linux·服务器·javascript·quaggajs
CRMEB定制开发3 小时前
CRMEB 中 PHP 快递查询扩展实现:涵盖一号通、阿里云、腾讯云
阿里云·php·腾讯云·商城系统·商城源码
藥瓿亭3 小时前
K8S认证|CKS题库+答案| 5.日志审计
linux·运维·docker·云原生·容器·kubernetes·cka
coder_lorraine3 小时前
【Linux系列】Linux用户大揭秘:从“公寓住户”到“社区管理员”的奇幻之旅
linux