系统相关
首页 > 系统相关> > WSL2 安装ArchLinux

WSL2 安装ArchLinux

作者:互联网

安装ubuntu测试

从win10商店下载完直接运行一般会出错

The WSL optional component is not enabled. Please enable it and try again.
See https://aka.ms/wslinstall for details.
Error: 0x8007007e
Press any key to continue...

需要运行命令打开WSL的功能,以管理员身份打开powershell运行以下命令

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

安装完成后会提示重启,重启会更新一些组件延后正常打开就会安装了,安装提示输入用户名和密码就可以正常进入系统了。

PS:修改root用户的密码

sudo -s #切换到root用户
passwd  #设置密码

安装Windows Terminal和美化

使用WSL配合windows termianl使用更佳

从win10商店安装直接使用,通过win+r打开运行wt.exe就可以快捷打开

简单美化一下

打开设置,选择开启Json文件,其中是Terminal的配置文件

{
    "$schema": "https://aka.ms/terminal-profiles-schema",

    "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",

    // You can add more global application settings here.
    // To learn more about global settings, visit https://aka.ms/terminal-global-settings

    // If enabled, selections are automatically copied to your clipboard.
    "copyOnSelect": false,

    // If enabled, formatted data is also copied to your clipboard
    "copyFormatting": false,


    "profiles":
    {
        "defaults":
        {
            // Put settings here that you want to apply to all profiles.
        },
        "list":
        [
            {
                // Make changes here to the powershell.exe profile.
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
			   "useAcrylic" : true,
                "hidden": false
            },
            {
                // Make changes here to the cmd.exe profile.
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name": "命令提示符",
                "commandline": "cmd.exe",
			   "useAcrylic" : true,
                "hidden": false
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
                "hidden": false,
                "name": "Ubuntu-20.04",
                "source": "Windows.Terminal.Wsl"
            }
        ]
    },

    // Add custom color schemes to this array.
    // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
    "schemes": [],

    // Add custom actions and keybindings to this array.
    // To unbind a key combination from your defaults.json, set the command to "unbound".
    // To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
    "actions":
    [

        { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
        { "command": "paste", "keys": "ctrl+v" },

        { "command": "find", "keys": "ctrl+shift+f" },

        { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
    ]
}

其中profiles对应着每一个终端的配置,添加

"useAcrylic" : true

开启亚克力特效,还可以设置字体等(fontFace),方法类似

开启WSL2

以管理员身份打开Powershell,运行一下命令开启虚拟机平台可选功能

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

安装Linux内核更新包

设置WSL2为默认版本

wsl --set=default-version 2

尝试切换原来的为wsl的ubuntu为wsl2

wsl --set-version Ubuntu-20.04 2  #--set-version后跟开发版的名字再跟wsl版本

出现以下提示

正在进行转换,这可能需要几分钟时间...
有关与 WSL 2 的主要区别的信息,请访问 https://aka.ms/wsl2
转换完成。

查看,发现版本已经改变了

wsl -l -v

下载 yuk7/ArchWSL,下载最新的zip包,解压运行Arch.exe,会在目录下生成系统运行文件,Arch就可以使用了

标签:exe,false,Windows,WSL2,wsl,ArchLinux,https,aka,安装
来源: https://www.cnblogs.com/yunzimo/p/14993509.html