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

相关推荐
lzx_0021 小时前
Linux 进程(三) 从进程状态到僵尸进程、孤儿进程
linux·服务器
FlightYe2 小时前
音视频修炼之容器与协议(四):RTSP详解
android·linux·ffmpeg·音视频·dash
刘马想放假3 小时前
CANviz 使用指南|Linux 安装、DBC 解码、实时曲线与 J1939 实战
linux·python·websocket
kloc5 小时前
聊天室项目入口网关子服务的实现
linux·c++
GeW5 小时前
深圳APEC峰会倒计时:数据库与Linux运维的"隐形考场"
linux
梦到啥说啥6 小时前
Linux网络编程:UDP网络协议
linux·网络协议·udp
无足鸟ICT7 小时前
【RHCA+】ipcrm命令(删除IPC资源)
linux
星恒随风8 小时前
MySQL 从零入门(四):表的增删改查与基础查询详解
linux·服务器·数据库·笔记·mysql
Zucker n10 小时前
文献发现、课题组织与证据可追溯的论文阅读。
论文阅读·windows·ubuntu
陈希12311 小时前
Linux 网络诊断工具实战:ping、curl、tcpdump、mtr、dig 用法详解
linux·网络·tcpdump