基于wsl (wslg)在Windows中运行linux开发环境

基于wsl (wslg)Windows中运行linux开发环境

相比虚拟机

  • 速度快很多
  • host机无缝集成,体验很棒
  • 既保留了linux的开发环境,同时使用了windows的操作体验
  • 详细x11GUI模式体验好很多

1. 系统基础

Wslg目前在windows11中已经包含

如下是windows11下的一个版本

 

 

 

2. 软件安装

windows store中安装ubuntu,选择目前的最新版Ubuntu-22.04版本

 

 

 

安装后开始菜单如下,直接点击即启动

 

 

 

查看运行的状态

 

 

 

 

2.1. Ubuntu22.04中的GUI程序安装

Ubuntu22.04WSLg资料

https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-11-with-gui-support#5-install-and-use-a-gui-package

2.1.1. xwindow和中文安装

# xwindow

apt install x11-apps

xeyes

xcalc

其中xeyes的执行效果如下

注意状态栏的图标,右下角的那个小企鹅表示使用了wslg

 

 

 

 

资源管理器的安装和命令

apt-get install nautilus

nautilus

 

# 中文安装

apt-get install -y language-pack-zh-hans fonts-droid-fallback ttf-wqy-zenhei ttf-wqy-microhei fonts-arphic-ukai fonts-arphic-uming

 

cat >> /etc/environment <<EOF

LANG="zh_CN.UTF-8"

LANGUAGE="zh_CN:zh:en_US:en"

EOF

 

mkdir -p /var/lib/locales/supported.d/

cat > /var/lib/locales/supported.d/local <<EOF

en_US.UTF-8 UTF-8

zh_CN.UTF-8 UTF-8

zh_CN.GBK GBK

zh_CN GB2312

EOF

locale-gen

2.1.2. chrome安装

# chrome

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

apt --fix-broken install -y ./google-chrome-stable_current_amd64.deb

google-chrome --no-sandbox

 

2.2. jetbrains-toolbox安装

这个是jetbrains的综合工具箱,有了这个安装jetbrains的软件非常的方便

#

wget https://download.jetbrains.com.cn/toolbox/jetbrains-toolbox-1.26.5.13419.tar.gz

tar -xvzf ./jetbrains-toolbox-1.26.5.13419.tar.gz

3. 开发IDE的启动

/home/wsl/jetbrains-toolbox-1.26.5.13419/jetbrains-toolbox

 

 

 

通过toolbox,可以进行

  • jetbrains的各种开发工具的安装
  • Jetbrains 在线space的同步
  • 等等

 

4. docker desktop的集成

windows主机上安装的docker desktop如下

将安装的wsl机器勾选同步

 

 

 

此时在linux机器中可以直接使用hostdocker服务,类似如下

 

 

 

 

posted @ 2022-11-19 21:31  2012  阅读(485)  评论(0编辑  收藏  举报