win 11 安装ubuntu子系统,并在子系统中使用开发工具进行项目开发

一、安装子系统

        1.打开控制面板-->程序-->程序和功能,选择启动或关闭windows功能

2.勾选以下功能,安装完成之后,重启系统

3.安装wsl,

按 Win+X, 找到 Windows PowerShell (管理员),并复制执行命令:Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

之后再复制执行命令wsl --update

4.安装ubuntu

进入Microsoft Store 搜索ubuntu ,安装ubuntu 18,安装完成之后启动,输入用户名和密码进入系统

二、安装ubuntu桌面,可以在windows上开发ubuntu桌面程序或打开ubuntu软件开发工具

1.更新源

        vim /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
 
清华源
 
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

更新

sudo apt-get update
sudo apt-get upgrade

2. 复制命令 sudo apt-get install xfce4 xfce4-terminal 即可,安装之后就可以在windows启动Ubuntu终端,同时也可以在wsl中进行界面开发

三、wsl相关操作

1.wsl 导入导出

导出:

        wsl --export Ubuntu-22.04 D:\Ubuntu.tar
        wsl --unregister Ubuntu-22.04

导入:
        wsl --import Ubuntu-22.04 D:\Ubuntu D:\Ubuntu.tar --version 2
        ubuntu.exe config --default-user aci

2.wsl卸载

        wslconfig /u Ubuntu-22.04

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值