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

相关推荐
DeeplyMind2 分钟前
ROCm rocr-libhsakmt性能跟踪与分析系列10-5:跟踪启动、数据采集与停止
linux·驱动开发
jerryinwuhan3 分钟前
linux_1219_1
linux
@小博的博客7 分钟前
Linux的工具第一篇:vim编辑器的使用详解
linux·编辑器·vim
咕噜企业分发小米7 分钟前
阿里云基因测序数据分析平台有哪些成功案例?
阿里云·数据分析·云计算
叮咚侠13 分钟前
Ubuntu 24.04.3 LTS如何扩容逻辑卷
linux·数据库·ubuntu
咕噜企业分发小米15 分钟前
阿里云与华为云在基因测序数据存储上哪个更好?
服务器·阿里云·腾讯云
路溪非溪20 分钟前
UBUS基本使用总结
linux·网络·arm开发·智能路由器
互联网哪些事情28 分钟前
Docker 容器化部署宝塔 Linux 面板
linux·docker·容器·宝塔云服务器
翼龙云_cloud30 分钟前
阿里云渠道商:阿里云GPU怎么搭建部署个人作品集博客?
运维·服务器·阿里云·云计算
小张帅三代34 分钟前
华为昇腾服务器ubuntu Anaconda安装PyTorch npu 版本 步骤
服务器·pytorch·ubuntu