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

相关推荐
努力学习的小廉25 分钟前
深入了解linux网络—— 自定义协议(上)
linux·服务器·网络
uesowys1 小时前
阿里云通义万相视频生成大模型开发训练部署
阿里云·视频生成大模型
小白考证进阶中1 小时前
自学阿里云认证,能救一个是一个!
阿里云·云计算·阿里云acp·阿里云acp认证·阿里云acp考试·阿里云acp报名·阿里云acp备考
bcgbsh1 小时前
Linux开机启动脚本(cron 的 @reboot 特性)
linux·cron
听风吹雨yu1 小时前
RK3588从数据集到训练到部署YoloV8
linux·yolo·开源·rk3588·rknn
iconball2 小时前
个人用云计算学习笔记 --19 (MariaDB服务器)
linux·运维·笔记·学习·云计算
Lynnxiaowen2 小时前
今天我们开始学习python3编程之python基础
linux·运维·python·学习
Chandler242 小时前
一图掌握 操作系统 核心要点
linux·windows·后端·系统
dragoooon343 小时前
[Linux系统编程——Lesson6.进程切换与调度]
linux·运维·服务器
waves浪游3 小时前
Linux基本指令(下)
linux·运维·服务器