Windows is notoriously hard to use on the command line, Linux is notoriously lousy on desktop apps, and the MacBook is the big winner. After a year of using a MacBook, I couldn’t stand the low specs and closure, and decided to restart Windows. Considering that there are not many common commands in my work, and I can find alternative tools under Windows, I resolutely chose Windows. However, when I went to configure the development environment in the company today, I had a lot of difficulties, such as libpng-dev is not supported. I wanted to wait until WSL2 came out to play (because I tried WSL before and didn’t have a good impression), but I will start work tomorrow, so I decided to give WSL another chance. As far as the results go, it smells good! The configuration process is as follows:

HERE–>>Bigwigs can read official documents

1. Enable WSL, install Ubuntu, and install VS Code

There are too many tutorials on these three steps, so I won’t write them. Don’t remember Baidu. Enable subsystem

2. Configure Ubuntu

2.1 Replacing software Sources

Why replace the software source? Because the default software source of Ubuntu is in a foreign country, the access speed in China is slow. If you don’t mind, you can not replace it.

# Back up the original software source
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
# Replace the software source
sudo sed -i 's/security.ubuntu/mirrors.aliyun/g' /etc/apt/sources.list
sudo sed -i 's/archive.ubuntu/mirrors.aliyun/g' /etc/apt/sources.list
Update the software source database
sudo apt update
Update the system (this depends on network conditions)
sudo apt upgrade
Copy the code

Common commands used by Ubuntu management software

apt install <package name> Install software
apt search <package name> # Search for software
apt show <package name> Display software information
apt --help
Copy the code

2.2 Installing the Compilation Tool

Recommended steps (install all common build tools)

sudo apt install build-essential autoconf libpng-dev # include GCC, g++, make, etc
Copy the code

2.3 Installing ZSH and OH-my-Zsh

Because it’s actually more comfortable than bash.

ZSH: github.com/zsh-users/z… oh-my-zsh: ohmyz.sh/

sudo apt install zsh # installation ZSH
Oh - my - ZSH # installation
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" 
Copy the code

A previous article introduced juejin.cn/post/684490…

2.4 installation node

Install the NVM. NVM is a nodeJS version management tool, as well as N, depending on your personal preference. I like NVM.

NVM: github.com/nvm-sh/nvm n: Own baidu bar, I don’t like to use.

The curl - o - https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bashCopy the code

Or (either the top one or the bottom one, whatever you want to do)

Wget - qO - https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bashCopy the code

Once the installation is complete, install Node (if NVM doesn’t work, you can open the terminal again for beginners, feel free to use it)

NVM install 10.17.0# Why this version? Because this version is the highest supported by our company's project, you are free
Check whether the installation is successful
node -v
Copy the code

2.5 the git configuration

If you have previously installed Git on Windows, you are advised to execute the following command because the newlines of Windows and Linux files are different.

git config --global core.autocrlf false
Copy the code

3 Create a new project

Just to make it easier to understand, I’m going to create a new project. Here is the command to create a new Vue project:

npm install -g @vue/cli # installation vue - cli
cd ~ Go to your home directory. If you have another directory where you are ready to put code, go to that directory
vue create vuetest # create project
Copy the code

4 VS Code Configuration

4.1 Open VS Code and install remote-WSL

Click on the desktop icon or VS Code in the Start menu to install remote-WSL

4.2 On the Ubuntu command line, go to the project you just created

Go to the project directory and open it with code

cd ~/vuetest Enter the project directory
code . # Open the project with VS Code
Copy the code

If code. Does not respond, go back to the first step of installing VS Code and consider whether VS Code has been added to the PATH. Or watch code.visualstudio.com/docs/remote here…

If it works, take a look at the magic bottom left corner

Click on the logo for more operations. It’s so comfortable, it’s like opening a local folder.

Open source, save money, ditch the Macbook, and look forward to Windows 2 and Windows Terminal.


Novice recommended reading: Linux Permission: linux.cn/article-110… Linux file system: linux.cn/article-979… Linux ultra basic command: www.runoob.com/linux/linux… Linux command queries: man.linuxde.net/ vim basis: www.runoob.com/linux/linux…

vimtutor # This is a self-contained tutorial
Copy the code