【工具】win10 安装 ubuntu 子系统(WSL) 并安装图形化界面

前言

因为项目需要在 ubuntu 上使用 ecplise,尝试在 WIN 10 安装 ubuntu

正文

第一步 安装 ubuntu

  1. 在win10应用商店搜索 ubuntu,我选择 ubuntu 20.04 LTS,公司网速快也等了几分钟,网速慢的可以自己找安装包安装。
    在这里插入图片描述2. 查看安装

第二步 安装图形化界面

2.1 开源软件 VcXsrv

2.1.1 下载安装包

点击 下载链接 进行下载。
在这里插入图片描述
下载完成后,默认配置就行,next -> install -> close

在这里插入图片描述

2.1.2 使用

在这里插入图片描述按自己需求随便选一个,一般默认就行。继续 下一步
在这里插入图片描述在这里插入图片描述在这里插入图片描述

点击 完成,启动。然后黑屏了,别关闭,记住下一步…

附:换源

执行 sudo vi /etc/apt/sources.list 并在文件最开始添加如下信息

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

执行:

sudo apt update
sudo apt upgrade
sudo apt autoremove

2.2 ubuntu 配置

2.2.1 Ubuntu内安装桌面环境

sudo apt-get install ubuntu-desktop unity compizconfig-settings-manager

执行:
在这里插入图片描述
如果出现上述 ERROR: Package *** has no installation candidate,没有执行 update。

sudo apt-get update

执行:
在这里插入图片描述
重新执行安装桌面环境:在这里插入图片描述在这里插入图片描述键入 y/Y,继续。
时间略久,网不好的同学换一下源。
在这里插入图片描述OK

2.2.2 配置显示

export  DISPLAY=localhost:0

这个 0 就是对应 2.1.2 节的 display numer,如果之前配置为默认值 -1 是自动匹配的。

sudo ccsm

执行:
在这里插入图片描述

同时 VcXsrv 弹出界面如下:
在这里插入图片描述
弹出的警告窗口

  • Show … 取消勾选
  • Show …,点击 OK,点击 close,继续黑屏

2.2.4 开启桌面

sudo compiz

整理成一键启动脚本:

>> vi disklink.sh

	#! /bin/bash
	export  DISPLAY=localhost:0
	sudo compiz

>> chmod a+x disklink.sh  
>> ./disklink.sh

注意事项

VcXsrvu 一直黑屏问题:

  • 先开启 VcXsrv,后启动 Ubuntu 服务。

总结

这真是个坑啊,不建议!图形化界面体验贼差,不如虚拟机省时省事。
在这里插入图片描述

参考文献

[1].https://blog.csdn.net/daybreak222/article/details/87968078
[2].https://zhuanlan.zhihu.com/p/34884285

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章