1

WSL 备忘录

 2 months ago
source link: https://www.liesauer.net/blog/post/899.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

经常需要捣鼓东西,所以老是要import一个纯净Ubuntu系统,记录一些经常需要用到的初始化命令,懒得记或者上网查。

顺便分享两个自己做的Ubuntu系统(仅适用于WSL/WSL2)

链接:https://pan.baidu.com/s/1No0Vxok2LKltlAutkPfihw
提取码:onku



  1. wsl --import distro path\to\distro path\to\snapshot.tar --version 2


  1. wsl --export distro path\to\snapshot.tar

修改root密码



  1. sudo passwd


  1. adduser username

添加sudoer



  1. adduser username sudo

开启systemd



  1. sudo nano /etc/wsl.conf

添加以下内容



  1. [boot]
  2. systemd=true

修改系统名



  1. sudo nano /etc/wsl.conf

添加以下内容



  1. [network]
  2. hostname=XXXXX

默认登录用户



  1. sudo nano /etc/wsl.conf

添加以下内容



  1. [user]
  2. default=username

默认登录路径



  1. nano ~/.bashrc

添加以下内容



  1. cd ~

apt镜像源

能不用就不用,除非完全下不动,国产源经常更新不及时、缺东西,安装东西时会报一堆摸不着头脑的依赖问题,网上给的换一个安装工具的解决方案没有用的!!!亲身经历!!!

加入docker组



  1. sudo usermod -aG docker username

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK