Skip to content

Instantly share code, notes, and snippets.

@aucker
Last active July 17, 2022 13:13
Show Gist options
  • Save aucker/ed9f71882eb693ab7cb484b877c687cd to your computer and use it in GitHub Desktop.
Save aucker/ed9f71882eb693ab7cb484b877c687cd to your computer and use it in GitHub Desktop.
Configure WSL(ubuntu20.04)

Use Ubuntu WSL instead of XFCE Manjaro:baby:

I have some labs to do so I need a Linux enviroment. However, the XFCE Manjaro has some bugs:

  • The bustub make file can not run on manjaro/arch linux
  • The XFCE crashes sometimes
  • The window manager is so poor

So I choose the Ubuntu 20.04 WSL on Windows10.

Without expectation, there are some things I need to configure.

add a user[optional]

When I install ubuntu, error occurs, so I just have a root user, that sucks. I refer this.

I need a personal user aucker, run the command:

adduser aucker
usermod -aG sudo aucker

change the default start up to aucker

I refer this method, in powershell:

ubuntu.exe config --default-user root

Then restart ubuntu, things will be fine. image

build-essential

After install the Ubuntu from Microsoft Store, use update and upgrade.

Then install some useful softwares

sudo apt install build-essential
sudo apt install ranger

MySQL1 ps:root1523

To install MySQL on WSL2, refer to official Microsoft Docs.:nerd_face:

There are several errors I encoutered when installing MySQL:

Just in my proxy Gist

ZSH

After finished the installation of zsh, change to zsh:

chsh -s $(which zsh)

Do not use sudo!!! After this command, you need to log out and relog in ubuntu. Then, install oh-my-zsh. This plugin sh file use curl, so I need configure the .curlrc file. Create .curlrc file.

proxy="http://xxx.xxx.xxx.xxx:port"

refer the proxy section.

After the configuration of proxy, I can use curl, git, etc. Then run the following command in shell.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Then zsh configuration is finished.

VS Code

In VS Code, install Remote Development extension. Then in WSL, run code ., normally, it will install code on terminal. image image

Then you can use VS Code in Ubuntu. Besides, you can also use file explorer. run explorer.exe . in WSL, you can get this: image

Of course you can use \\wsl$ in the File explorer address bar, then you can go there directly. image

Note: when you get errors like command not found or zsh: input/output xxx, try to restart your WSL:

wsl --shutdown 

Perhaps this will help.

Maybe Useful References

Reference

Footnotes

  1. How to install MySQL on Ubuntu 20.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment