Proton / Wine 基础
在 Linux 上运行 Windows 游戏和应用,离不开 Wine 和 Proton 兼容层。本文介绍它们的工作原理和使用方法。
什么是 Wine
Wine(Wine Is Not an Emulator)是一个兼容层,它将 Windows API 调用翻译为 Linux 系统调用,让 Windows 程序可以在 Linux 上运行。Wine 不是模拟器,而是直接翻译 API,因此性能损失很小。
安装 Wine
# 启用 32 位架构
sudo dpkg --add-architecture i386
sudo apt update
# 添加 WineHQ 仓库
sudo mkdir -pm755 /etc/apt/keyrings
wget -O- https://dl.winehq.org/wine-builds/winehq.key | sudo gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key
wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/$(lsb_release -cs)/winehq-$(lsb_release -cs).sources
# 安装稳定版
sudo apt update
sudo apt install --install-recommends winehq-stable -y验证安装:
wine --versionWine 基本用法
# 运行 Windows 程序
wine program.exe
# 配置 Wine(图形界面)
winecfg
# 运行 Wine 自带工具
wine regedit # 注册表编辑器
wine taskmgr # 任务管理器
wine explorer # 文件管理器
wine control # 控制面板Wine 前缀(WINEPREFIX)
Wine 前缀是一个独立的 Windows 环境,可以为不同程序创建隔离的环境:
# 创建新的 Wine 前缀
WINEPREFIX=~/wine-myapp wineboot
# 在指定前缀中运行程序
WINEPREFIX=~/wine-myapp wine myapp.exe
# 配置指定前缀
WINEPREFIX=~/wine-myapp winecfg
# 创建 32 位前缀
WINEARCH=win32 WINEPREFIX=~/wine32 wineboot安装 Winetricks
Winetricks 可以方便地在 Wine 中安装常用组件和运行库:
sudo apt install winetricks -y
# 安装常用运行库
winetricks vcrun2022 dotnet48 cjkfonts
winetricks d3dx9 d3dcompiler_47
winetricks dxvk
# 使用图形界面
winetricks --gui什么是 Proton
Proton 是 Valve 基于 Wine 开发的兼容层,专为游戏优化。它集成了:
- Wine - Windows API 翻译
- DXVK - DirectX 9/10/11 到 Vulkan 的转换
- VKD3D-Proton - DirectX 12 到 Vulkan 的转换
- 各种游戏专用补丁和优化
Proton 集成在 Steam 中,无需单独安装。在 Steam 设置的兼容性页面启用即可。
Proton-GE(GloriousEggroll)
Proton-GE 是社区维护的 Proton 增强版,包含额外的补丁和修复:
通过 ProtonUp-Qt 安装(推荐)
# 安装 ProtonUp-Qt
flatpak install flathub net.davidotek.pupgui2 -y
# 启动
flatpak run net.davidotek.pupgui2在 ProtonUp-Qt 中:
- 选择 Steam 安装目录
- 点击 Add version
- 选择 Proton-GE 并安装最新版
手动安装 Proton-GE
# 创建目录
mkdir -p ~/.steam/root/compatibilitytools.d
# 自动获取并安装最新版 GE-Proton(避免硬编码版本号)
TAG=$(curl -s https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest | grep -oP '"tag_name": "\K[^"]+')
wget "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/${TAG}/${TAG}.tar.gz"
# 解压到 Steam 目录
tar -xzf "${TAG}.tar.gz" -C ~/.steam/root/compatibilitytools.d/
# 清理
rm "${TAG}.tar.gz"重启 Steam 后,在游戏属性中选择 Proton-GE 版本。
为单个游戏指定 Proton 版本
右键点击游戏 > 属性 > 兼容性 > 勾选 强制使用特定兼容工具 > 选择版本。
Lutris
Lutris 是一个开源的游戏管理平台,支持管理来自不同来源的游戏:Steam、GOG、Epic、Battle.net 等。
安装 Lutris
sudo apt install lutris -y使用 Lutris
启动 Lutris:
lutrisLutris 的主要功能:
- 安装脚本:社区维护的游戏安装脚本,一键配置各种游戏
- Wine 管理:内置多个 Wine 版本,自动选择最佳版本
- 运行器:支持多种游戏运行器(Wine、DOSBox、ScummVM、RetroArch 等)
通过 Lutris 安装游戏
- 访问 https://lutris.net 搜索游戏
- 点击 Install 按钮
- Lutris 会自动打开并执行安装脚本
或者手动添加游戏:
- 点击 + 按钮
- 选择运行器(Wine/Linux/Steam 等)
- 配置游戏路径和参数
Bottles
Bottles 是另一个优秀的 Wine 前缀管理工具:
flatpak install flathub com.usebottles.bottles -y
flatpak run com.usebottles.bottlesBottles 提供:
- 预配置的 Wine 环境(Gaming、Application、Custom)
- 依赖管理器
- 版本管理
- 简洁的图形界面
Heroic Games Launcher
用于运行 Epic Games Store 和 GOG 游戏:
flatpak install flathub com.heroicgameslauncher.hgl -yDXVK 和 VKD3D-Proton
DXVK
DXVK 将 DirectX 9/10/11 转换为 Vulkan,是 Proton 的核心组件之一:
# 在 Wine 中手动安装 DXVK
winetricks dxvkVKD3D-Proton
VKD3D-Proton 将 DirectX 12 转换为 Vulkan:
# 安装 vkd3d-proton
winetricks vkd3d常见问题排查
查看 Proton 日志
# 启用 Proton 日志
PROTON_LOG=1 %command%
# 日志位置
ls ~/steam-*.log常用环境变量
# 启用 DXVK HUD(显示 DXVK 信息)
DXVK_HUD=fps,devinfo %command%
# 强制使用特定 DXVK 版本
DXVK_CONFIG_FILE=~/dxvk.conf %command%
# 启用 Fsync(较旧的同步原语,需要内核支持)
WINEFSYNC=1 %command%
# 启用 Esync
WINEESYNC=1 %command%Ubuntu 26.04(Linux 7.0 内核)的招牌特性是 NTSYNC——一种比 Esync/Fsync 更高效的 Windows 同步原语内核实现,可显著改善 Proton 游戏表现。较新的 Proton / GE-Proton 会自动检测并优先使用 NTSYNC,通常无需手动设置环境变量。详见在 Ubuntu 26.04 上游戏。
掌握 Wine 和 Proton 的基础知识后,你就可以在 Ubuntu 26.04 上运行绝大多数 Windows 游戏了。