This is the 13th day of my participation in the August More Text Challenge
Preface
WSL (Windows Subsystem for Linux) is the Windows Subsystem for Linux.
Since Win10 has a Linux subsystem (WSL), I will directly put the computer on the VMware virtual machine software uninstall.
WSL experience is good, who uses who knows!!
Plus Windows Terminal, the latest Terminal, through some configuration can make the Terminal very easy to use and comfortable eye, more conducive to Linux programming.
This article contains a complete tutorial to use Linux under Win10, including installation and environment configuration.
The tutorial is detailed enough, xiaobai can understand, I hope to give a praise 😘 put a final result:
WSL installation
Win10 version needs to be above 1903, my version is 20H2.
You can open win + R to run, enter Winver to view the version number.
-
Open PowerShell as an administrator and type:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart Copy the code
-
After typing, restart your computer to complete the WSL installation and update to WSL 2.
-
After the restart, download the WSL2 Linux kernel update package for X64 computers and install it.
-
Set WSL 2 to the default version:
wsl --set-default-version 2 Copy the code
-
Download the Linux distribution from the Microsoft Store, in this case Ubuntu 20.04 LTS.
-
Open it after downloading. Wait for a while to open it for the first time. Then we set up the user name and password.
-
Once the username and password are created, the account will be the default user for the distribution and will be automatically logged in at startup. Is considered a Linux administrator, capable of running sudo administrative commands.
Attached are links to all distributions
- Ubuntu 18.04 LTS
- Ubuntu 20.04 LTS
- Packages Leap of 15.1
- SUSE Linux Enterprise Server 12 SP5
- SUSE Linux Enterprise Server 15 SP1
- Kali Linux
- Debian GNU/Linux
- Fedora Remix for WSL
- Pengwin
- Pengwin Enterprise
- Alpine WSL
Ubuntu configuration
-
To avoid entering a password every time sudo is required, configure visudo:
sudo visudo Copy the code
-
Add a line at the end of the file (change to your own user name), Ctrl + S to save, Ctrl + X to exit.
username ALL=(ALL) NOPASSWD: ALL Copy the code
Configure a domestic mirror source
To speed up the download of software
-
Back up the original source:
cd. /.. /.. /.. /.. /..Back to the root directory cd /etc/apt/ cp sources.list sources.list.bak If you cannot copy, go to superuser and try again sudo su Copy the code
-
Modify source contents:
sudo vim sources.list Copy the code
-
Delete all of them and modify them to the image of Ali Cloud:
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse Copy the code
-
Update software list:
sudo apt update sudo apt upgrade Copy the code
vim
In case someone won’t use it, briefly say how to write and save:
- According to the
I
Can edit, copy and paste good (old CV engineer). - Press Esc to exit the edit and enter
:wq
Save and exit vim.
Configuring the Python Environment
-
Installation:
sudo apt install python3 sudo apt install python3-pip Copy the code
-
Replace the PIP source:
cd ~ mkdir .pip Copy the code
-
Create and edit pip.conf:
sudo vim ~/.pip/pip.conf Copy the code
-
To:
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple/ [install] trusted-host = pypi.tuna.tsinghua.edu.cn Copy the code
-
Changing the default Python version to PYTHon3 is too cumbersome to type python3 each time:
Delete the original soft link, if not directly created sudo rm /usr/bin/python sudo rm /usr/bin/pip # Create a soft link sudo ln -s /usr/bin/python3 /usr/bin/python sudo ln -s /usr/bin/pip3 /usr/bin/pip Copy the code
-
Now type Python to enter the Python3 environment directly
In the next part, we will update how to create a perfect Terminal experience for Windows 10 by using Windows Terminal + Oh-my-zsh + p10K + zsh-plugins. If you are interested, click on it
Finally ask a thumbs up 👍👍 if there are any questions can comment to communicate with each other.
I am Mancuoj, more interesting articles: Mancuoj personal homepage – article – Nuggets (juejin. Cn)