运行:
bash setup.sh 2>&1 | tee /tmp/setup.log
debug 模式运行:
DEBUG=true bash setup.sh 2>&1 | tee /tmp/setup.log
前提:已安装 wsl2
参考:how-to-add-second-wsl2-ubuntu-distro-fresh-install
- 下载 ubuntu 20.04
- 解压下载的
Ubuntu_2004.2020.424.0_x64.appx
powershell
进入解压后的目录执行命令
# <Distribution Name>: 实例名字,需与已有实例不同
# <Install Folder>:实例安装的文件夹
# wsl --import <Distribution Name> <Install Folder> install.tar.gz
$FolderToCreate="C:\ubuntu-20.04-1"
if (!(Test-Path $FolderToCreate -PathType Container)) {
New-Item -ItemType Directory -Force -Path $FolderToCreate
}
wsl --import Ubuntu-20.04-1 $FolderToCreate install.tar.gz
# 进入实例
wsl -d Ubuntu-20.04-1
- 创建的实例默认用户为
root
,实例中创建个人用户ilyydy
并修改为默认用户
# 设定 root 密码
passwd
NEW_USER=ilyydy
adduser "${NEW_USER}"
adduser ${NEW_USER} sudo
tee /etc/wsl.conf <<_EOF
[user]
default=${NEW_USER}
_EOF
powershell
中重启实例使修改生效
wsl --terminate Ubuntu-20.04-1
wsl -d Ubuntu-20.04-1
- windows terminal 配置实例
- Ubuntu 主题
{
"background": "#300A24",
"black": "#2E3436",
"blue": "#3465A4",
"brightBlack": "#555753",
"brightBlue": "#729FCF",
"brightCyan": "#34E2E2",
"brightGreen": "#8AE234",
"brightPurple": "#AD7FA8",
"brightRed": "#EF2929",
"brightWhite": "#EEEEEC",
"brightYellow": "#FCE94F",
"cursorColor": "#FFFFFF",
"cyan": "#06989A",
"foreground": "#EEEEEC",
"green": "#4E9A06",
"name": "Ubuntu",
"purple": "#75507B",
"red": "#CC0000",
"selectionBackground": "#FFFFFF",
"white": "#D3D7CF",
"yellow": "#C4A000"
}
- 设置启动目录
//wsl$/Ubuntu-20.04-1/home/ilyydy
- vscode
- git
- firefox
- windows terminal
- postman
- Another Redis Desktop Manager
- dbeaver
- idea
- docker desktop
- 配置阿里源
https://3xr1v0un.mirror.aliyuncs.com
- 配置阿里源
- anki
- Everything
- 7-zip
- ascadia-code
- GifCam
- git-lfs