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

Vue computed properties

Table of contents 1. Basic Examples 2. Computed p...

Implementation of form submission in html

Form submission code 1. Source code analysis <...

An article tells you how to implement Vue front-end paging and back-end paging

Table of contents 1: Front-end handwritten paging...

A brief discussion on Mysql specified order sorting query

Recently, I have been working on a large-screen d...

The pitfall of MySQL numeric type auto-increment

When designing table structures, numeric types ar...

A brief analysis of the use of the HTML webpack plugin

Using the html-webpack-plugin plug-in to start th...

Detailed explanation of the middleman mode of Angular components

Table of contents 1. Middleman Model 2. Examples ...

Robots.txt detailed introduction

Basic introduction to robots.txt Robots.txt is a p...

How to use MySQL limit and solve the problem of large paging

Preface In daily development, when we use MySQL t...

Analysis of the project process in idea packaging and uploading to cloud service

one. First of all, you have to package it in idea...

Historical Linux image processing and repair solutions

The ECS cloud server created by the historical Li...

Detailed explanation of MySQL master-slave replication and read-write separation

Table of contents Preface 1. Overview 2. Read-wri...

How to create your own image using Dockerfile

1. Create an empty directory $ cd /home/xm6f/dev ...

What is MIME TYPE? MIME-Types type collection

What is MIME TYPE? 1. First, we need to understand...

js implements form validation function

This article example shares the specific code of ...