Java小强个人技术博客站点    手机版
当前位置: 首页 >> 服务器 >> 适用Linux的Windows子系统

适用Linux的Windows子系统

18820 服务器 | 2022-6-21

适用于 Linux 的 Windows 子系统可让开发人员按原样运行 GNU/Linux 环境 - 包括大多数命令行工具、实用工具和应用程序 - 且不会产生传统虚拟机或双启动设置开销。

您可以:

在 Microsoft Store 中选择你偏好的 GNU/Linux 分发版。

运行常用的命令行软件工具(例如 grep、sed、awk)或其他 ELF-64 二进制文件。

运行 Bash shell 脚本和 GNU/Linux 命令行应用程序,包括:

工具:vim、emacs、tmux

语言:NodeJS、Javascript、Python、Ruby、C/C++、C# 与 F#、Rust、Go 等

服务:SSHD、MySQL、Apache、lighttpd、MongoDB、PostgreSQL。

使用自己的 GNU/Linux 分发包管理器安装其他软件。

使用类似于 Unix 的命令行 shell 调用 Windows 应用程序。

在 Windows 上调用 GNU/Linux 应用程序。

windows linux lts.jpg


必须运行 Windows 10 版本 2004 及更高版本(内部版本 19041 及更高版本)或 Windows 11。

若要检查 Windows 版本及内部版本号,选择 Windows 徽标键 + R,然后键入“winver”,选择“确定” 。 可通过选择“开始”>“设置”>“Windows 更新”>“检查更新”来更新到最新的 Windows 版本。


安装


linux lts.jpg


安装后需要重启电脑。

打开Microsoft Strore搜索lts,选择Ubuntu最新版本。


linux lts ubuntu.jpg


一次打开要设置一个用户和用户密码


Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: cui
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Tue Jun 21 11:09:12 CST 2022

  System load:    0.52      Processes:              7
  Usage of /home: unknown   Users logged in:        0
  Memory usage:   25%       IPv4 address for eth0:  172.28.160.1
  Swap usage:     0%        IPv4 address for wifi0: 10.119.161.182

1 update can be applied immediately.
To see these additional updates run: apt list --upgradable


The list of available updates is more than a week old.
To check for new updates run: sudo apt update


This message is shown once a day. To disable it please create the
/home/cui/.hushlogin file.


安装后,修改root密码


cui@cuisuqiang:~$ sudo passwd root
[sudo] password for cui:
New password:
Retype new password:
passwd: password updated successfully


lts下的Windows盘在哪里

Windows电脑上各个逻辑分区位置都在 /mnt 下挂载


更换软件源

由于Ubuntu默认的软件源在国外,有时候后可能会造成下载软件卡顿,这里我们更换为国内的阿里云源,其他国内源亦可。

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

替换为

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse


更新升级软件

在Ubuntu命令行中依次执行如下命令:

# 更新软件源
sudo apt-get update -y
# 升级所有软件
sudo apt-get upgrade -y


如何重置该系统


linux lts 设置.jpg

清除数据

linux lts clear.jpg


END

推荐您阅读更多有关于“ linux Windows ubuntu 子系统 ”的文章

上一篇:冒充京东金融的电信诈骗经历 下一篇:SpringBoot集成Kafka之SASL_SSL

猜你喜欢

发表评论: