
00:00:00
外卖卷:非常划算 扫码领劵 省点小钱钱
https://github.com/wsldl-pg/CentWSL
https://github.com/mishamosher/CentOS-WSL
https://github.com/yosukes-dev/RHWSL
必须运行 Windows 10 版本 2004 及更高版本(内部版本 19041 及更高版本)或 Windows 11,检查 Windows 版本及内部版本号:按 Windows 徽标键 + R,然后键入“winver”,选择“确定”
需要在BIOS中开启虚拟化技术,检查是否启用虚拟化:同时按住 CTRL、Shift 和 ESC 键打开任务管理器,选择“性能”>“CPU”
启用 Windows 子系统:“控制面板”>“程序和功能”>“启用或关闭 Windows 功能”>勾选“适用于 Linux 的 Windows 子系统”
# 安装 WSL 命令
wsl --install
# 更新 WSL
wsl --update
# 检查正在运行的 WSL 版本
wsl -l -v
# 检查 WSL 状态
wsl --status
# 关闭
wsl --shutdownwsl --set-default-version <Version>
# 若要将默认版本设置为 WSL 1 或 WSL 2,将 <Version> 替换为 1 或 2。
# 例如 wsl --set-default-version 2wsl --set-default <DistributionName>
# 将 <DistributionName> 替换为要使用的 Linux 发行版的名称。
# 例如 wsl --set-default CentOS8wsl --setdefault <DistributionName>
# 将 <DistributionName> 替换为要使用的 Linux 发行版的名称。wsl --set-version <DistributionName> <Version>
# 若要指定运行 Linux 发行版的 WSL 版本
# 将 <DistributionName> 替换为 Linux 发行版的名称,并将 <Version> 替换为 1 或 2。
# 例如 wsl --set-version CentOS8 2 会将 CentOS8 发行版设置为使用 WSL 2<DistributionName> config --default-user <Username>
# 更改用于发行版登录的默认用户。 用户必须已经存在于发行版中才能成为默认用户。
# 例如 CentOS8 config --default-user root 会将 CentOS8 发行版的默认用户更改为“root”用户。# 关闭子系统
net stop LxssManager
# 终止子系统
wsl --terminate <DistributionName>
# 注销或卸载子系统
wsl --unregister <DistributionName>
# 导出系统镜像
wsl --export <DistributionName> <镜像存放路径>
# 将 <DistributionName> 替换为要使用的 Linux 发行版的名称。yum -y update #更新系统中已有的软件包
yum -y install gcc gcc-c++ make wget #安装gcc、gcc+、wget等
yum -y install openssh-clients openssh-server #安装ssh相关
yum -y install vim #安装vim编辑器
yum -y install tar #安装压缩解压缩工具
yum -y install net-tools #安装网络工具
yum -y install ncurses #字符终端处理库# 进入配置文件夹
mv /etc/yum.repos.d/ /etc/yum.repos.d_bak && mkdir /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
# 如果你没有安装wget,也可以用下面命令
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
# 运行 dnf makecache 生成缓存
dnf makecache
评论