- Install and configure Ubuntu WSL
- Install application
- Docker in Windows without Docker Desktop
- Docker/Kubernetes Clients
- Git tricks
- Enable WSL2 as Administrator via Power Shell (information is from link1, link2):
then restart and call after
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2
- Update WSL from console opened as Administrator
wsl --update
and restart then usingwsl --shutdown
.If you have problem with self-update, try to use WSL kernel installer or check another tips from this article
- Install Ubuntu
- from Microsoft Windows Store or
- via cli
- wsl -l --online
- wsl --install -d
Then check WSL version for installed Ubuntu distribution
wsl --list --verbose
. It must be 2. If distribution is not default it can be run sowsl -d <Distro>
- NOTE: You can install not only Ubuntu, but other Linux family OS:
- Set up default username with a password
Installing, this may take a few minutes... Please create a default UNIX user account. The username does not need to match your Windows username. For more information visit: https://aka.ms/wslusers Enter new UNIX username: gorshkov New password: *** Retype new password: *** passwd: password updated successfully Installation successful! To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Fri Nov 5 00:28:25 +04 2021 System load: 0.52 Processes: 7 Usage of /home: unknown Users logged in: 0 Memory usage: 53% IPv4 address for eth3: 10.236.151.120 Swap usage: 0% IPv4 address for wifi0: 192.168.1.7 1 update can be applied immediately. To see these additional updates run: apt list --upgradable The list of available updates is more than a week old. To check for new updates run: sudo apt update This message is shown once a day. To disable it please create the /home/gorshkov/.hushlogin file.
- Update all packages
sudo apt update sudo apt upgrade
- Optionally upgrade Ubuntu release. It takes usually 1-2 hours
and check
sudo LANG=C do-release-upgrade
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 21.04 Release: 21.04 Codename: hirsute
In you have a problem like
Command terminated with exit status 1
check this tip
- In order to run in current folder use command
ubuntu.exe run .
It can be usefull to add run icons to Total Commander
- Edit
/etc/wsl.conf
(see documents)then call[wsl2] localhostForwarding=true [interop] appendWindowsPath=false # To avoid collisions. Any necessary paths can be set manually [automount] options="metadata" # To avoid this error https://askubuntu.com/questions/1115564/wsl-ubuntu-distro-how-to-solve-operation-not-permitted-on-cloning-repository # [user] # default=user # can be important to change default user
wsl --shutdown
- Implementation
- WSLG it should be the fastest solution but only on windows 11 (check if you have win11)
- GWSL: the simpliest solution for windows 10
- Run GWSL and click on icon in the status bar
- Choose
GWSL Distro Tools
in opened menu - Tick Display/Audio auto exporting to set environment variables DISPLAY/PULSE_SERVER in WSL (see
~/.bashrc
) - To make GWSL start on Windows startup use receipt
- VcXsrv Windows X Server: classic, that is used by other solutions under hood, as well as in GWSL
- Run VcXsrv and follow the suggestions
- Add to
~/.bashrc
this lineexport DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
- How to check
sudo apt install x11-apps
xeyes
- Mount flash drive
mountdrv() {
sudo mkdir -p /mnt/$1
sudo mount -t drvfs $1: /mnt/$1 -o uid=$(id -u $USER),gid=$(id -g $USER),metadata
}
set containerName=centos7
set tar="c:/WSLs/%containerName%.tar"
set DIR=c:/WSLs
set DIR_CENTOS=%DIR%/Centos
mkdir "%DIR_CENTOS%"
wsl --terminate centos7
wsl --unregister centos7
rmdir /S /Q c:\WSLs\Centos
docker run -d -t --rm --name %containerName% -it centos:7 /bin/bash
docker export %containerName% -o %tar%
wsl --import %containerName% "%DIR_CENTOS%" "%tar%"