在Windows11上安装WSLg(wsl2/ubuntu/linux子系统)

硬件开发评论431字数 2557阅读8分31秒阅读模式

什么是WSLg?

WSLg是Windows Subsystem for Linux GUI的缩写,该项目的目的是支持在Windows上以完全集成的桌面体验运行Linux GUI应用程序(X11和Wayland)。

WSLg为喜欢或需要在PC上运行Windows系统、但也需要能够在Linux环境中运行最佳或唯一工作的工具或应用程序的开发人员、科学家或爱好者提供了一种集成的体验。

虽然现在用户可以使用多系统来实现这一点,其中单独的 PC 专用于 Windows 和 Linux,虚拟机托管 Windows 或 Linux,或者在Windows上通过XServer显示远程linux程序,但是现在有了更集成、对用户更友好且高效的选择——WSLg。

WSLg 努力使 Linux GUI应用程序在 Windows 上使用起来感觉原生且自然。从集成到开始菜单中启动 到出现在任务栏中、alt+tab选项卡中,再到支持跨Windows和Linux应用程序的剪切/粘贴,WSLg 实现了利用 Windows 和 Linux 应用程序的无缝桌面体验和工作流。

安装WSLg:

先决条件:系统必须为Windows 11

我是在打开“适用于 linux 的 windows 子系统”和“虚拟机平台”后,直接在应用商店搜索“Windows Subsystem for Linux Preview”安装,然后搜索“Ubuntu”安装,选的不带版本号的版本,不带版本号的是滚动更新的,目前版本22.04.1 LTS。

具体请参考官方连接:

https://github.com/microsoft/wslg

https://learn.microsoft.com/zh-cn/windows/wsl/install

软件源更新

默认情况下 Ubuntu 的 apt 软件源是国外的,我们可以将它的默认下载地址切换到国内环境下,例如阿里云的镜像地址。

手动替换

Ubuntu 的软件源配置文件是 /etc/apt/sources.list。将系统自带的该文件做个备份,将该文件替换为下面内容,即可使用 TUNA 的软件源镜像。

相关命令:

# 备份👇
# sudo cp /etc/apt/sources.list /etc/apt/sources.list.bakup
# 修改👇
# sudo vim /etc/apt/sources.list
# 更新👇
# sudo apt-get update
# 如出现依赖问题,解决方式如下👇
# sudo apt-get -f install
# 升级👇 
# sudo apt-get upgrade

sources.list内容:

# 22.04 LTS

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse

命令替换

执行如下命令自动替换

sudo sed -i "s@http://.*archive.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list
sudo sed -i "s@http://.*security.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list

安装 zsh及oh-my-zsh

zsh 是 Z shell 的简称。用于交互式登录的 shell 及脚本编写的命令解释器,可以拓展一些功能丰富的第三方插件和主题,提高 shell 使用效率。

sudo apt install zsh #安装zsh

# sudo chsh -s /bin/zsh #将zsh设置成默认shell(不设置的话启动zsh只有直接zsh命令即可)

安装oh-my-zsh

Oh My Zsh 是基于 zsh 命令行的一个扩展工具集,提供了丰富的扩展功能。

sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

 


Warning: file_exists(): open_basedir restriction in effect. File(/www/wwwroot/www.yxjdzl.com/wp-content/uploads/2024/02) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2036

Warning: is_dir(): open_basedir restriction in effect. File(/www/wwwroot/www.yxjdzl.com/wp-content/uploads/2024) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2047

Warning: is_dir(): open_basedir restriction in effect. File(/www/wwwroot/www.yxjdzl.com/wp-content/uploads) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2047

Warning: is_dir(): open_basedir restriction in effect. File(/www/wwwroot/www.yxjdzl.com/wp-content) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2047

Warning: is_dir(): open_basedir restriction in effect. File(/www/wwwroot/www.yxjdzl.com) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2047

Warning: is_dir(): open_basedir restriction in effect. File(/www/wwwroot) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2047

Warning: is_dir(): open_basedir restriction in effect. File(/www) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2047

Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2047

Warning: is_dir(): open_basedir restriction in effect. File(/www/wwwroot/www.yxjdzl.com/wp-content/uploads/avatar) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-content/themes/begin/inc/avatar-cache.php on line 7

Warning: file_exists(): open_basedir restriction in effect. File(/www/wwwroot/www.yxjdzl.com/wp-content/uploads/avatar) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2036

Warning: is_dir(): open_basedir restriction in effect. File(/www/wwwroot/www.yxjdzl.com/wp-content/uploads) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2047

Warning: is_dir(): open_basedir restriction in effect. File(/www/wwwroot/www.yxjdzl.com/wp-content) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2047

Warning: is_dir(): open_basedir restriction in effect. File(/www/wwwroot/www.yxjdzl.com) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2047

Warning: is_dir(): open_basedir restriction in effect. File(/www/wwwroot) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2047

Warning: is_dir(): open_basedir restriction in effect. File(/www) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2047

Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-includes/functions.php on line 2047

Warning: is_file(): open_basedir restriction in effect. File(/www/wwwroot/www.yxjdzl.com/wp-content/uploads/avatar/b32f9e95aaf5f958e5327dc1538e4e1c96.png) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-content/themes/begin/inc/avatar-cache.php on line 21

Warning: is_file(): open_basedir restriction in effect. File(/www/wwwroot/www.yxjdzl.com/wp-content/uploads/avatar/b32f9e95aaf5f958e5327dc1538e4e1c-d.png) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-content/themes/begin/inc/avatar-cache.php on line 22

Warning: fopen(): open_basedir restriction in effect. File(/www/wwwroot/www.yxjdzl.com/wp-content/uploads/avatar/b32f9e95aaf5f958e5327dc1538e4e1c-d.png) is not within the allowed path(s): (/www/wwwroot/yxjdzl.com/:/tmp/) in /www/wwwroot/yxjdzl.com/wp-content/themes/begin/inc/avatar-cache.php on line 26

Warning: fopen(/www/wwwroot/www.yxjdzl.com/wp-content/uploads/avatar/b32f9e95aaf5f958e5327dc1538e4e1c-d.png): failed to open stream: Operation not permitted in /www/wwwroot/yxjdzl.com/wp-content/themes/begin/inc/avatar-cache.php on line 26

Warning: fclose() expects parameter 1 to be resource, bool given in /www/wwwroot/yxjdzl.com/wp-content/themes/begin/inc/avatar-cache.php on line 27
管理员
  • 本文由 发表于 2022年9月27日 13:55:29
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
自制美的变频空调检测仪二代 硬件开发

自制美的变频空调检测仪二代

检测仪简介 256*160大分辨率,适配外壳为125mm*80mm*32mm 支持5V i2c检测口和LNS检测口,修板子除通讯故障外均建议用i2c接口 自动判断当前插入的接口(5V i2c还是LNS...
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定