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

相关推荐
Serverless社区2 小时前
【本不该故障系列】告别资源“不确定性”,SAE如何破解刚性交付核心困境
阿里云·云原生·serverless
zzzsde3 小时前
【Linux】基础开发工具(2):vim补充说明&&gcc/g++编译器
linux·运维·服务器
q***65693 小时前
使用Canal将MySQL数据同步到ES(Linux)
linux·mysql·elasticsearch
2301_807583233 小时前
了解python,并编写第一个程序,常见的bug
linux·python
杨德杰4 小时前
Ubuntu设置VNC远程桌面
linux·运维·ubuntu
toooooop84 小时前
CentOS 7 系统上安装 **Nginx + MySQL 5.7 + PHP 7.3 + Redis** 的完整步骤
redis·mysql·nginx·centos·php7
HIT_Weston4 小时前
43、【Ubuntu】【Gitlab】拉出内网 Web 服务:静态&动态服务
前端·ubuntu·gitlab
M***29914 小时前
在 Ubuntu 上安装 MySQL 的详细指南
mysql·ubuntu·adb
写代码的学渣5 小时前
Ubuntu/麒麟默认锁定root账户
linux·运维·ubuntu
wdfk_prog6 小时前
[Linux]学习笔记系列 -- [block]bfq-iosched
linux·笔记·学习