WSL2-ubuntu18.04配置笔记2:WSL2 ubuntu18.04 换源

WSL2 ubuntu18.04配置-2 换源

1. 设置root的密码

passwd root

在输入两次密码后完成root密码的设置

Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

以下操作都是在root用户下操作的,非root需要使用sudo

2. 换源

这里参考换源看这篇就够了
由于不同版本的ubuntu版本名称不一样,所以源地址也会有差别,作者提供了一个小脚本用来一键完成换源
作者的脚本是托管在gitte上的,因此直接将18.04的源复制过来使用
首先备份,然后更改

cd /etc/apt
cp source.list source.list.bk
vi source.list

将source.list中的内容更换为以下内容

# source && source code
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

# Advance distribution source, Not recommended
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

# source && source code
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

更新

apt-get update

3. 记录一些apt-get常用的命令

sudo apt-get update  更新源
sudo apt-get install package 安装包
sudo apt-get remove package 删除包
sudo apt-cache search package 搜索软件包
sudo apt-cache show package  获取包的相关信息,如说明、大小、版本等
sudo apt-get install package --reinstall  重新安装包
sudo apt-get -f install  修复安装
sudo apt-get remove package --purge 删除包,包括配置文件等
sudo apt-get build-dep package 安装相关的编译环境
sudo apt-get upgrade 更新已安装的包
sudo apt-get dist-upgrade 升级系统
sudo apt-cache depends package 了解使用该包依赖那些包
sudo apt-cache rdepends package 查看该包被哪些包依赖
sudo apt-get source package  下载该包的源代码
sudo apt-get clean && sudo apt-get autoclean 清理无用的包
sudo apt-get check 检查是否有损坏的依赖
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要安装WSL2上的Ubuntu 18.04,可以按照以下步骤进行操作: Step1: 首先,导出WSL1中的Ubuntu 18.04安装包到一个.tar文件中,可以使用以下命令导出: wsl --export Ubuntu-18.04 d://wslubuntu//ubuntu-18.04.tar Step2: 注销WSL1中的Ubuntu 18.04虚拟机,使用以下命令: wsl --unregister Ubuntu-18.04 Step3: 导入WSL2中的Ubuntu 18.04安装包,指定安装路径和版本,使用以下命令导入: wsl --import Ubuntu-18.04 d://wslubuntu F://ubuntu1804new.tar --version 2 此时,Ubuntu 18.04已经成功安装在WSL2中。 另外,如果你想要更改Ubuntu 18.04虚拟机的默认登录用户名为"jarvis",可以使用以下命令: ubuntu1804 config --default-user jarvis 这样就完成了在WSL2上安装Ubuntu 18.04并更改默认登录用户名的过程。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [安装WSL2+Ubuntu18.04(慢慢更新记录)](https://blog.csdn.net/shi1804134022/article/details/128633049)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [WSL2-ubuntu1804安装以及一些个人使用调整](https://blog.csdn.net/fur_pikachu/article/details/127953683)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值