最近开始使用Ubuntu了,常规操作,还是换源
感觉用啥都要换源😤

自动修改脚本

wget https://gitee.com/VioletFreesia/scripts/raw/master/freesia.py
sudo python3 freesia.py -r changeSource
  • 测试
apt update
apt upgrade

手动修改

备份源列表文件

  • 切换为管理员
    su
    
    输入密码后,如果认证失败说明root密码未初始化使用下面命令初始化
    sudo passwd
    
    按照提示输入新的root密码
  • 备份
    cp /etc/apt/sources.list /etc/apt/sources.list.bak
    

修改源

  • 查看Ubuntu发行版本名

    lsb_release -a
    
    # 得到结果
    # No LSB modules are available.
    # Distributor ID:	Ubuntu
    # Description:	Ubuntu 20.04 LTS
    # Release:	20.04
    # Codename:	focal  ---记住这个名字
    
  • 修改文件

    vim /etc/apt/sources.list
    
    # 注释或者删除掉里面的所有内容
    
  • 添加以下内容**需要将所有focal替换为你之前记住的那个名字**

    #  阿里源
    deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
    
  • 测试

    apt update
    apt upgrade
    
  • 速度嗖嗖的🚀🚀