How to install WSL2 Ubuntu20.04 on Windows 10 and set up the docker environment

How to install WSL2 Ubuntu20.04 on Windows 10 and set up the docker environment

Enable WSL

Make sure the system is Windows 10 2004 or later

Right-click "Menu" - "Settings" - "Apps" - "Programs and Features" - "Turn Windows features on or off"

Select "Windows Subsystem for Linux"

Restart system application settings

Install WSL2 Ubuntu 20.04

Enable WSL2

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

Open "Microsoft Store", search for Ubuntu 20.04, and click Install


After the download is complete, launch Ubuntu 20.04 LTS from the start menu


Update the software sources and update

sudo tee /etc/apt/sources.list << EOF
deb http://mirrors.163.com/ubuntu/ $(lsb_release -cs) main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ $(lsb_release -cs)-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ $(lsb_release -cs)-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ $(lsb_release -cs)-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ $(lsb_release -cs)-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ $(lsb_release -cs) main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ $(lsb_release -cs)-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ $(lsb_release -cs)-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed $(lsb_release -cs) restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports $(lsb_release -cs) restricted universe multiverse
EOF

sudo apt-get update
sudo apt-get upgrade -y

Install Docker

sudo apt-get install -y apt-transport-https \
            ca-certificates \
            curl \
            gnupg-agent \
            software-properties-common
curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu bionic stable"
# Currently there is no domestic Tsinghua docker source for 20.04, so temporarily use the 18.04 version sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo cp /mnt/c/Windows/Fonts /usr/share/fonts/chinese -r
cd /usr/share/fonts/chinese
sudo mkfontscale
sudo mkfontdir
fc-cache -fv
source /etc/profile
sudo chmod -R 755 *

Install zsh

sudo apt-get install zsh
sh -c "$(wget -O- https://gitee.com/kingscat/ohmyzsh/raw/master/tools/install.sh)"

This is the end of this article about how to install WSL2 Ubuntu20.04 on Windows 10 and set up a docker environment. For more information about installing WSL2 Ubuntu20 on Windows 10, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to install docker on ubuntu20.04 LTS
  • Tutorial on installing and using Docker on Ubuntu 16.04
  • Detailed tutorial on installing and using Docker on Ubuntu 16.04
  • Detailed process of installing and using Docker on Ubuntu 20.04 (installation package)

<<:  Vue implements zip file download

>>:  Summary of various common join table query examples in MySQL

Recommend

How to shrink the log file in MYSQL SERVER

The transaction log records the operations on the...

A brief discussion on the principle of shallow entry and deep exit of MySQL

Table of contents 1. Overview of the page 2. Infi...

SVG+CSS3 to achieve a dynamic wave effect

A vector wave <svg viewBox="0 0 560 20&qu...

How to purchase and initially build a server

I haven't worked with servers for a while. No...

Native js implementation of slider interval component

This article example shares the specific code of ...

A brief introduction to the usage of decimal type in MySQL

The floating-point types supported in MySQL are F...

Using CSS3 and JavaScript to develop web color picker example code

The web color picker function in this example use...

10 Tips for Mobile App User Interface Design

Tip 1: Stay focused The best mobile apps focus on...

How to set the width attribute to the style of the span tag

If you directly set the width attribute to the sty...

HTTP and HTTP Collaboration Web Server Access Flow Diagram

A web server can build multiple web sites with in...

A detailed tutorial on how to install Jenkins on Docker for beginners

Jenkins is an open source software project. It is...

Detailed explanation of this reference and custom properties in JavaScript

Table of contents 1. this keyword 2. Custom attri...