目录
1、启动Microsoft Store(微软商店)
2、免费获取Ubuntu
3、激活“适用于Linux的Windows子系统”
4、重启电脑以安装Ubuntu
5、设置Ubuntu网络
6、Ubuntu中安装网络管理工具
7、变更Ubuntu管理员密码
8、利用Xshell连接Ubuntu子系统
9、在Windows 10中控制Ubuntu子系统的重启
10、将默认登录用户设为root用户
1、启动Microsoft Store(微软商店) 点击左下角的Win键,搜索字母M找到“Microsoft Store”,或者在任务栏的搜索框中输入“Microsoft Store”,然后点击进入。
2、免费获取Ubuntu
在应用商店中搜索“Linux”,然后下载Ubuntu20.04。
3、激活“适用于Linux的Windows子系统”


4、重启电脑以安装Ubuntu
安装前需要登录微软账户,登录后即可进行安装。

安装完成后,可在开始菜单中看到已安装的应用。
5、设置Ubuntu网络
apt-get update
由于Windows中已经占用了22端口,为避免冲突,需要修改Ubuntu中的ssh端口。
cp /etc/ssh/ssh_config /etc/ssh/ssh_config.init cp /etc/ssh/sshd_config /etc/ssh/sshd_config.init
vim /etc/ssh/sshd_config
添加以下配置,修改ssh连接端口为23,并且允许root用户登录。
Port 23 PermitRootLogin yes PasswordAuthentication yes #StrictModes no #UsePrivilegeSeparation yes
生成ssh公钥和密钥,提示输入密码时可直接回车。
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
或者执行命令
ssh-keygen -A
ssh开机自启
systemctl enable ssh
启动ssh服务
service ssh --full-restart
/etc/init.d/ssh start
查看系统版本
cat /proc/version
uname -a
lsb_release -a
6、Ubuntu中安装网络管理工具
apt install net-tools
ifconfig
这里有两个网络分别是 172.16.0.125 和 192.168.124.12,都可以使用ssh连接工具连接。
7、变更Ubuntu管理员密码
输入passwd root命令,然后连续输入两次密码即可修改root用户的密码。
sudo passwd root

su root
8、利用Xshell连接Ubuntu子系统 Win10配置XShell:https://www.php.cn/link/baf24e5f9fc18cf58172d1ba745f0f7a
可以看到,Ubuntu的两个网络地址都可以使用ssh正常连接使用。
9、在Windows 10中控制Ubuntu子系统的重启 WSL子系统是基于LxssManager服务运行的。
Ubuntu子系统并不能像正常Linux系统使用shutdown和reboot命令。
因此需要以管理员身份使用LxssManager命令重启WSL子系统。
net stop LxssManager
net start LxssManager
10、将默认登录用户设为root用户
这里使用了一个非常简单的方法,直接删除第一次登录时创建的用户。
userdel com
删除之后重新打开Ubuntu,系统便默认使用root账户登录了。
以上就是Win10安装Ubuntu20.04LTS子系统的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号