开始安装
在自带的MicrosoftStore搜索Linux,选择自己想要的系统,
这里我选的Ubuntu,直接搜Ubuntu也可,安装完成后启动,如果有如下提示
当然也可能报错,无法启动。那就可能是没开启WindowsLinux子系统支持,打开程序和功能->启用或关闭Windows功能,找到适用于Linux的Windows子系统,勾选确定等待配置,重启,即可打开
切换root用户
一些要点
WSL是Windows的一个子服务,终端中无法重启Windows的服务,如果使用reboot命令,会报一个
System has not been booted with systemd as init system (PID 1). Can't operate.
的错误,如果有重启的需要可以以管理员身份运行PowerShell,输入
Get-Service LxssManager | Restart-Service
LxssManager就是Linux服务,重启它即可
换源操作
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo chmod 777 /etc/apt/source.list
vi /etc/apt/source.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
安装图形化界面
apt-get install vnc4server
vnc4server
除此启动需要设置密码
编辑配置文件
vi /root/.vnc/xstartup
修改如下
#!/bin/sh
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
#这是gnome的配置
安装图形化界面gnome(这个很简洁),追求美观可以去找别的,界面如下