Linux-Ubuntu系统换源

Ubuntu18.04换源

本次换源的系统为WSL2-Ubuntu18.04,更换源为阿里云的ubuntu18.04的软件源

对其他版本的Ubuntu还原只需要更改不同的配置文件即可,操作步骤完全一致。

不同的配置文件可从各个镜像源的官网中寻找对应版本的软件源配置文件

如果尚未安装vim且没有其他的文本编辑工具和方式的,这边建议先安装vim方便对文本的更改

sudo apt install vim

 
搜索阿里云镜像源配置文件内容。若需要更换其他镜像源,可自行搜索。

ubuntu镜像_ubuntu下载地址_ubuntu安装教程-阿里巴巴开源镜像站 (aliyun.com)
 
 
image-20230323202327896

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

image-20230323202254858
 
使用vim编辑工具打开sources.list文件

sudo vim sources.list

image-20230323202426335
 

通过键盘按键输入“i”进入文本编辑模式,即可输入内容。

可以将原先所有的内容删除,或者对未注释行进行注释。通过“#”即可注释内容

本次我采用注释的方式,将所有内容注释

image-20230323202619035

将内容注释完毕之后,在文本的后方粘贴刚才我们从阿里云镜像源中找到的Ubuntu18.04的软件软配置文件内容。

image-20230323202730984

随后,键盘输入一次“ESC”退出编辑模式,随后输入“:wq”表示保存退出,回车即可。

随后输入运行以下命令,更新软件源,命令运行完毕即可。

sudo apt update
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值