1.启用“Windows Subsystem for Linux”
右击“开始菜单”,点击“Windows PowerShell (管理员)”,以管理员身份运行 PowerShell,依次执行以下命令:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
后,重启电脑。
2.打开“Microsoft Store”,搜索并安装Ubuntu 18.04
等待自动下载安装完成,在开始菜单可以看到它
3.设置用户密码
4.换源
使用编辑器
sudo vim /etc/apt/sources.list
按"i",编辑。加入"#"注释原本的内容。
ubuntu 18.04(bionic) 配置如下:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
# deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src 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-backports main restricted universe multiverse
按"Esc"退出编辑,输入":wq"保存并退出 。
最后更新源和软件:
sudo apt-get update
sudo apt-get upgrade
5. 安装VcXsrv(开始弄图形界面)
VcXsrv是一个免费开源的软件,下载地址为https://sourceforge.net/projects/vcxsrv/
下载后安装,打开XLaunch,选择:“one large window”,Display number设置成0,其它默认即可,一路下一步。
6. Ubuntu内安装桌面环境
三个包
sudo apt-get install ubuntu-desktop unity compizconfig-settings-manager
然后配置显示方式:
# export DISPLAY=localhost:0
export DISPLAY=主机的ip:0
#执行下面这条命令之前,确保你上一步的XLaunch是开着的并且配置好了
ccsm
在XLaunch中,即会弹出ccsm的配置界面,按照网上推荐的方法点如下选项:
然后close即可
7.开启桌面
sudo compiz
每次重启电脑之后,想继续看到桌面的话,直接打开配置好的XLaunch还是不够的,每次还需要输入如下两条命令:
# export DISPLAY=localhost:0
export DISPLAY=主机的ip:0
sudo compiz
参考引用:
Windows Subsystem for Linux(WSL)的安装、美化和增强 - 知乎
Win10安装Ubuntu子系统及图形化界面详细教程_leisp的博客-优快云博客_ubuntu子系统 图形界面
ubuntu镜像-ubuntu下载地址-ubuntu安装教程-阿里巴巴开源镜像站
感谢。