Ubuntu18.04换源
本次换源的系统为WSL2-Ubuntu18.04,更换源为阿里云的ubuntu18.04的软件源
对其他版本的Ubuntu还原只需要更改不同的配置文件即可,操作步骤完全一致。
不同的配置文件可从各个镜像源的官网中寻找对应版本的软件源配置文件
如果尚未安装vim且没有其他的文本编辑工具和方式的,这边建议先安装vim方便对文本的更改
sudo apt install vim
搜索阿里云镜像源配置文件内容。若需要更换其他镜像源,可自行搜索。
ubuntu镜像_ubuntu下载地址_ubuntu安装教程-阿里巴巴开源镜像站 (aliyun.com)
deb https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
# deb https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
图示内容即为我们所需的内容,其他源的内容也有相似的格式
Ubuntu18.04通过命令行进入目录/etc/apt/
cd /etc/apt
使用vim编辑工具打开sources.list文件
sudo vim sources.list
通过键盘按键输入“i”
进入文本编辑模式,即可输入内容。
可以将原先所有的内容删除,或者对未注释行进行注释。通过“#”
即可注释内容
本次我采用注释的方式,将所有内容注释
将内容注释完毕之后,在文本的后方粘贴刚才我们从阿里云镜像源中找到的Ubuntu18.04的软件软配置文件内容。
随后,键盘输入一次“ESC”
退出编辑模式,随后输入“:wq”
表示保存退出,回车即可。
随后输入运行以下命令,更新软件源,命令运行完毕即可。
sudo apt update