Win11 installs the Arch subsystem and configures the development environment
Updated win11, re-enabled the linux subsystem, and set up the basic development environment.
Win10 enables its subsystem Ubuntu and installs the graphical interface: https://myblog.wallleap.cn/
Mainly thinking that the win11 interface looks pretty good, and terminal
+ oh-my-zsh
/ oh-my-posh
looks very nice
1. Enable function
search and opencontrol panel
clickprogram
clickTurn Windows features on or off
Check the Using the Windows Subsystem for Linux
and other related virtual platforms (if there is no Hyper-V, just check the other ones), click OK
After a while, follow the prompts to restart the computer
For convenience, you can also use the command directly in powershell (run as administrator):
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
2. Set WSL2 as the default version
Download the upgrade package: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
After the download is complete, double-click to install
Enter the command in powershell: wsl --set-default-version 2
, set WSL2 as the default version
3. Install ArchWSL
Two installation methods are provided, we choose the simpler one:
Download Arch.appx/Arch.zip at yuk7/ArchWSL - releases
Unzip, double-click Arch.exe to install
EnterAfter prompting for input, it can be found and opened in the terminal
4. Set the root password
[root@PC-NAME]# passwd enter password twice here
5. Set the default user
You can only use the root user, but it is recommended to change the following
See ArchWiki's Sudo and User and groups pages.
[root@PC-NAME]# echo "%wheel ALL=(ALL) ALL" > /etc/sudoers.d/wheel (Set the sudoers file.) [root@PC-NAME]# useradd -m -G wheel -s /bin/bash {username} (Add user) [root@PC-NAME]# passwd {username} (Set default user password) [root@PC-NAME]# exit >Arch.exe config --default-user {username} (set default user)
{username}
Replace the above with the username you want to create, for exampletestuser
If the default user password is changed ( issue #7 ), please restart the computer or restart LxssManager with admin CMD.
To restart LxssManager
, run:
net stop lxssmanager && net start lxssmanager
6. Initialize the keyring
Please execute these commands to initialize the keyring. (This step is required to use Pacman)
[user@PC-NAME]$ sudo pacman-key --init [user@PC-NAME]$ sudo pacman-key --populate [user@PC-NAME]$ sudo pacman -Syy archlinux-keyring
7. Beautify the terminal
First install zsh from the official source
sudo pacman -S zsh
Install wget and git
sudo pacman -S wget
Get the oh-my-zsh installation script, if you can't get it after killing it, just copy the content of [tools/install.sh]( ohmyzsh/install.sh at master ยท ohmyzsh/ohmyzsh (github.com) ) and create a new one install.sh file, paste the content
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh
give file permission to run
chmod +x install.sh
run shell file
./install.sh
Set zsh as the default shell
sudo chsh -s /bin/zsh
The theme is in the directory by default ~/.oh-my-zsh/themes/
, you can choose the theme already there
Theme preview: External themes ohmyzsh/ohmyzsh Wiki (github.com)
You can try to download the theme yourself, take passion
as an example , go to the theme repository: ChesterYue/ohmyzsh-theme-passion
Download the passion.zsh-theme file and copy it to the theme directory
cp passion.zsh-theme ~/.oh-my-zsh/themes/
Modify the theme name in the configuration filepassion
vim ~/.zshrc
Appropriate fonts are required for complete display. It is recommended to use the FiraCode font family: https://wallleap.lanzoub.com/i43lX08fdnpa
Create a new terminal to see the theme effect
Download three commonly used plugins:
History command search (zsh-history-substring-search): https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/history-substring-search
Code highlighting (zsh-syntax-highlighting): https://github.com/zsh-users/zsh-syntax-highlighting
Command Prompt (zsh-autosuggestions): https://github.com/zsh-users/zsh-autosuggestions
Then modify the configuration file:
vim ~/.zshrc
modify the content
plugins=( git zsh-history-substring-search zsh-syntax-highlighting zsh-autosuggestions )
source it to make the changes take effect
source ~/.zshrc
file exchange
Under win, you can win+ renter \\wsl$
Enter , and then map Arch to a drive letter
You can enter the /mnt
directory , and all drive letters under win are under this
8. Configure the development environment
The WSL used is already Linux, but it is not easy to reuse. You can choose Docker to configure a unified development environment
(1) Download Docker Desktop
Go directly to the official website Docker Desktop - Docker to download the software for your own platform
After the installation is complete, run the software, find Docker Engine in the settings, copy the code and replace the code in the box
{ "registry-mirrors": [ "https://registry.docker-cn.com", "http://hub-mirror.c.163.com", "https://docker.mirrors.ustc.edu.cn", "https://aa25jngun.mirror.aliyuncs.com" ], "insecure-registries": [], "debug": false, "experimental": false, "features": { "buildkit": true }, "builder": { "gc": { "enabled": true, "defaultKeepStorage": "20GB" } } }
Check the use WSL2 environment in the settings, the default check does not need to be managed
(2) Get the image
For the front-end development environment, I think FrankFang is very well configured and can be used directly. The warehouse address is: FrankFang/oh-my-env-1 (github.com)
Download the above file locally:
git clone https://github.com/FrankFang/oh-my-env-1.git oh-my-env
Run the command:
docker network create network1
Open VSCode
Install Remote - Container plugin
Open the oh-my-env directory
Type Ctrl + Shift + P, then Reopen, enter, wait
After the previous step is started, create a new terminal
(3) Instructions for use
Run
nvm use system
andnode --version
get node runtime environmentrun
rvm use 3
andruby --version
get the ruby runtimeThe general code is placed in the
~/repos
directoryIf file communication is required, you can create a new directory
oh-my-env
undertemp
, and then copy the files to this directory.
0 Comments