2021-07-01

WSL2安装Ubuntu18.04的图形界面和VSCode

1. 图形界面安装

1.1. Windows下的VcXsrv安装

图形界面软件VcXsrv安装在Windows平台下,它运行时会启动 Xserver 服务用于监听WSL的端口,WSL 启动程序后把界面数据发送给Xserver,Xserver接收到数据进行绘制,于是在 Win 下看到图形界面。
安装网址:https://sourceforge.net/projects/vcxsrv/,直接下载安装

1.1. Linux下的xfce4安装

直接上官网,里面有详细的英文教程,可以将网页翻译成中文,没啥影响
网址:https://autoize.com/xfce4-desktop-environment-and-x-server-for-ubuntu-on-wsl-2/

2. Linux下的VSCode安装

2.1 VSCode下载

官网下载.db格式的安装包:https://code.visualstudio.com/Download,下载完成后放在linux上。
2021-07-01
Tips:可以使用MabaXterm将文件从windows拖拽到Linux,这个工具很强大。
2021-07-01

2.2 VSCode安装

1.sudo dpkg -i 安装包名称.deb
2.此时会报错:

To use Visual Studio Code with the Windows Subsystem for Linux, please install Visual Studio Code in Windows and uninstall the Linux version in WSL. You can then use the `code` command in a WSL terminal just as you would in a normal command prompt.
Do you want to continue anyway? [y/N] y
To no longer see this prompt, start Visual Studio Code with the environment variable DONT_PROMPT_WSL_INSTALL defined.
You are trying to start Visual Studio Code as a super user which isn't recommended. If this was intended, please specify an alternate user data directory using the `--user-data-dir` argument.

3.好像是权限不够,使用命令code --user-data-dir="/usr/share/code/",添加软件的安装路径就能打开了。

TIps:使用whereis code命令查看VSCode软件安装目录,我的安装目录在/usr/share/code/

上一篇:WSL安装ubuntu搭建vue开发环境(一):Ubuntu安装


下一篇:WSL安装ubuntu搭建vue开发环境(二):vue环境安装