【学习】Ubuntu 20.04更换下载源

一、环境

ubuntu: 20.04

二、问题

在重装完ubuntu后,想着更新一下软件,发现sudo apt-get update简直慢的离谱

0AgzMd.png

这感觉一天都更新不完

三、解决

解决办法类似maven:换下载源(最好装了vmtools)

修改root默认密码

bigdataforubuntu@bigdataforubuntu:~/桌面$ sudo passwd root
[sudo] bigdataforubuntu 的密码: 
新的 密码: 
重新输入新的 密码: 
passwd:已成功更新密码

切换到root用户

bigdataforubuntu@bigdataforubuntu:~/桌面$ su root
密码: 
root@bigdataforubuntu:/home/bigdataforubuntu/桌面# 

使用gedit打开sources.list(因为vim初始版本不够或者未安装)

root@bigdataforubuntu:/home/bigdataforubuntu/桌面# gedit '/etc/apt/sources.list'

将下面这段复制到最后

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src 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-backports main restricted universe multiverse

保存并退出

之后移除锁,并更新软件源

root@bigdataforubuntu:/home/bigdataforubuntu/桌面# sudo rm /var/lib/apt/lists/lock
root@bigdataforubuntu:/home/bigdataforubuntu/桌面# sudo apt-get update

更新软件

sudo apt-get dist-upgrade
sudo apt-get upgrade
posted @ 2022-01-18 19:38  小拳头呀  阅读(557)  评论(0编辑  收藏  举报