windows10子系统--ubuntu安装桌面

从Win10 1607更新版开始,Windows10已经原生支持Linux了,在控制面板的“启用或关闭Windows功能”中即可看到“适用于Linux的Windows子系统(WSL)”项。开启后就可以在不需要虚拟机的情况下运行Linux

安装环境和子系统

开启功能

打开Windows10设置,点击"更新和安全",点击"开发者选项",选中开发者模式
 title=
然后回到设置主页,点击"应用",滑倒最底,点击"程序和功能",再打开左边"启用或关闭Windows功能"选项,往下翻,找到"适用于Linux的Windows子系统"选项,在方块中打勾。保存重启

下载系统文件

登录Microsoft账户,点开win10自带应用商店,搜索"Ubuntu",点击"获取这些应用",点击"Ubuntu"进入说明界面后,在点击获取。
 title=
完成后点击"启动",打开后会自动开始安装。
 title=
出现Enter new UNIX username输入用户名,直接回车默认root账户,系统默认root账户时,执行sudo xxx命令时不需要输入sudo
回车后输入账户密码,密码需要输入两遍输入时,都不会在命令框中显示,需要脑补。
后车后会出现绿色的输入框,证明安装成功,如图:

二、ubuntu系统设置和安装图形化

1.Ubuntu更新源
2.Ubuntu4.安装完后默认使用国外源,这会使下载文件出现网络特别慢或者连接失败,避免这类事,我们就需要更换为国内的源.
国内ubuntu源

#阿里源
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

首先我们需要备份当前源,以免出错,输入

cp /etc/apt/sources.list /etc/apt/sources.list.bak

然后打开这台电脑在路径栏中输入:(注意:我的Windows用户名是yangchengcaizi,此处需要替换为你的电脑用户名)

C:\Users\你的电脑用户名\AppData\Local\Packages
将隐藏的文件设置打开,在"Packages"文件夹中寻找带有Ubuntu文字的文件夹

进入packages文件夹之后再打开LocalState进入rootfs,此目录为Ubuntu系统目录
在Ubuntu系统目录中打开etc中的apt文件夹,打开"sources.list"文件,你可以使用电脑自带的笔记本打开,也可以用Notepad++打开
复制你找到的Ubuntu专用源,删除你的文件已有源,将我提供的源复制到里面,保存
然后更新Ubuntu软件库,输入:

sudo apt-get update

2、安装图形化桌面及驱动

Linux的图像化界面如同一个模块,本文使用xfc4桌面。
bash shell内输入如下命令:

sudo apt-get install xorg   
sudo apt-get install xfce4 
sudo apt-get install xrdp   
sudo sed -i 's/port=3389/port=3390/g' /etc/xrdp/xrdp.ini
sudo echo xfce4-session >~/.xsession    
sudo service xrdp restart

运行上面的命令时,会询问是否继续,全部选择yes如果Windows提示防火墙,允许即可

全部执行完成后就可以使用远程工具连接了,win+R打开运行输入mstsc回车,ip输入127.0.0.1:3390回车链接
 title=

结束

公众号

评论区
头像