Loading
CamelliaV の BLOG
0%
INITIALIZING
[2026.5.6]打通win与linux的互通桥梁
DOC_ID // 290ca1ONLINE

[2026.5.6]打通win与linux的互通桥梁

2026-5-6
UPDATED: 2026-6-5
技术分享
READ 3 MIN/COUNT 855
#开发
CamelliaV の BLOG
type
Post
status
Published
date
May 6, 2026
slug
win&linux
summary
在win上与linux上分别同时兼容两边
tags
开发
category
技术分享
titleIcon
password
icon
insider
🔑
在win上与linux上分别同时兼容两边

Win上兼容

兼容Linux程序 - 虚拟机方案 - vmware/wsl

wsl - hyper-v相关

  • 如果系统hyper-v关掉走vmware,如果hyper-v未关走wsl
  • 判断hyper-v是否关闭 - 使用hyper-v的项目包括:内存完整性 | 基于虚拟化的安全相关,只要有一项仍在启用,hyper-v就是开启的,就算在功能设置或者cmd里关闭都不会真关
notion image
  • 检查以下面板显示虚拟化安全
notion image
notion image
  • hyper-v开着有什么影响?- win会变成与wsl同级系统,在自动挂载情况下,/mnt下就是对应win磁盘,你可以在wsl里把win除了部分保护文件外所有内容删光,对于给AI full access带来相当大风险 | 内存IO时延增加,在最夸张的reddit部分帖里有出现近翻倍的情况,暂不清楚是否影响到游戏1%low帧,作为参考,在wsl上作redis-benchmark(以valkey9版本MSET项目结果为参考)wsl - 7w出头 且长尾十分严重,作为对比,arch - 9w 无长尾,分布较集中
notion image
  • 如何启用hyper-v与wsl特性? - 启用Hyper-V | 虚拟机平台
notion image
notion image

wsl - 配置与使用 - arch为例 - 含docker与AI相关

  • wsl微软商店可以安装,没有的话win地区设为美国,挂代理访问(TUN,或者fiddler强制代理商店)
  • wsl安装archlinux
  • 基本用户创建
notion image
  • 安装sudo
notion image
  • 安装基本包
notion image
  • 安装vi
notion image
  • visudo添加无密码版本提升权限(此处为按用户,也可以解除注释wheel分组,后续反正都要加进wheel分组里)
notion image
  • 测试用户sudo
notion image
  • 安装paru
notion image
notion image
  • 测试paru
notion image
  • 更改默认用户
notion image
notion image
notion image
  • 安装wget与vscode连通
notion image
  • 拷贝linux上配置(也可以rsync)
notion image
notion image
notion image
notion image
  • win上读写btrfs参考速度
notion image
  • 安装oh-my-zsh
notion image
notion image
  • 添加locale(解决编码问题,比如prompt_segment:5: character not in range报错)
notion image
notion image
notion image
notion image
notion image
  • 更换默认shell
notion image
  • 检查系统状态
notion image
  • 安装docker compose
notion image
  • 添加docker组
notion image
  • 添加wheel组的必要性
notion image
 
  • 新版本wsl2如果要使用docker的网络特性需要,自定义编译 WSL2 内核,启用 CONFIG_IP_NF_IPTABLESCONFIG_NFT_COMPAT 等选项
  • (wsl nat模式)如果不打算自编译内核,可以使用docker宿主模式,然后按虚拟机ip进行访问
notion image
notion image
notion image
notion image
  • 修改示例(docker compose)
  • 日用层面差异
场景
正常情况
当前情况
容器对外服务
-p 8080:80 端口可重映射
--network host,端口不能改
访问容器服务
localhost:8080
localhost:80(容器原端口)
docker compose
自动创建网络,ports 生效
需用 network_mode: "host",不能用 ports
容器间通信
通过 docker0 网桥
共享 localhost,用 127.0.0.1 通信
多容器端口
可任意映射,无冲突
需自行避免端口冲突

Linux上兼容

兼容win程序

兼容层方案 - wine/proton

容器方案 - winboat

虚拟机方案 - kvm/vmware

兼容其他发行版

容器方案 - distrobox

兼容层方案 - 星火商店(deb)

构建脚本方案 - aur

通用安装方式 - flatpak | appimage

挂载win文件系统

 
NAVIGATION // Related Articles
Loading...
© 2024-2026 CamelliaV