Wine(Wine Is Not an Emulator, Wine不是模拟器) 是一个在 Linux、macOS 和 BSD 等类 Unix 操作系统上运行 Windows 应用程序的兼容层。
介绍
Wine 的核心原理
- 兼容层而非模拟器:Wine 不像虚拟机那样模拟整个 Windows 操作系统。相反,它提供了一个兼容层,将 Windows 应用程序的系统调用(API)转换为与 POSIX 标准兼容的系统调用。这意味着 Wine 直接在你的 Linux 系统上运行 Windows 程序,而不需要额外的虚拟化开销。
- 替代的 Windows 运行库:Wine 还提供了 Windows 系统运行库(如 DLL 文件)的替代品,以及一些系统组件(如 Internet Explorer、注册表、Windows Installer)的替代品。
- Winelib:Wine 也提供程序运行库(Winelib),帮助程序设计师将 Windows 程序移植到类 Unix 系统。
Wine 的优势
- 直接运行 Windows 应用:允许用户在 Linux 上运行许多 Windows 应用程序和游戏,而无需安装完整的 Windows 操作系统。
- 性能较好:由于不是模拟器,Wine 通常比虚拟机有更好的性能表现,尤其是在运行对性能要求较高的游戏和应用程序时。
- 节省资源:不需要额外的 Windows 许可证,也减少了虚拟机所需的系统资源。
Wine 的兼容性
- Wine 的兼容性因应用程序而异。有些 Windows 程序可以在 Wine 上完美运行,有些可能存在一些小问题,而有些则可能无法运行。
- WineHQ 网站提供了庞大的应用程序数据库,用户可以在其中查找特定 Windows 应用程序在 Wine 上的兼容性评级和用户报告。
- 随着 Wine 的不断发展,对 64 位 Windows 应用程序的支持也越来越稳定。
Wine 的辅助工具
- Winetricks:这是一个脚本,用于帮助用户安装和配置 Wine,并安装一些 Windows 应用程序所需的额外组件(如字体、运行时库等)。
- PlayOnLinux/PlayOnMac:这些工具提供了图形界面,简化了在 Wine 上安装和管理 Windows 应用程序的过程,尤其对于游戏有很好的支持。
- Lutris:这是一个开源游戏管理器,支持 Wine,可以帮助用户更轻松地安装和运行各种游戏。
- Proton (Steam Deck 使用):Valve Software 基于 Wine 开发了 Proton,用于在 Steam Deck 和 Linux 上运行 Windows 游戏,显著提升了游戏兼容性。
安装
以常见的 Ubuntu/Debian 为例安装 WineHQ 的官方仓库:
- 添加 WineHQ 仓库 (推荐):- sudo dpkg --add-architecture i386
sudo mkdir -pm755 /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/$(lsb_release -cs)/winehq-$(lsb_release -cs).list
sudo apt update
 
建议配置国内源镜像:https://mirrors.tuna.tsinghua.edu.cn/help/wine-builds/
- 安装 Wine:- sudo apt install --install-recommends winehq-stable
 
- winehq-devel或- winehq-staging版本,它们可能包含最新功能但稳定性可能稍差。
- 配置 Wine:第一次运行- winecfg时,它会创建 Wine 的配置文件目录 (- ~/.wine)。你可以在- winecfg界面中设置 Windows 版本等参数。
- 运行 Windows 应用程序:直接双击- .exe文件,或者在终端中使用- wine <应用程序路径.exe>命令来运行 Windows 应用程序
使用
wine xx.exe
wine iexplore.exe "https://example.com"
扩展
F&Q
/opt/longene/qq/longene_gtk: error while loading shared
终端输入 qq,运行,我遇到了错误提示:
* Seems the first time to run. Here we go!
/opt/longene/qq/longene_gtk: error while loading shared
libraries: libgtk-x11-2.0.so.0:
cannot open shared object file: No such file or
directory
需要安装:
sudo apt-get install libgtk2.0-0:i386
err:winediag:ntlm_check_version ntlm_auth was not found. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution. 018c:err:ntlm:ntlm_LsaApInitializePackage no NTLM support, expect problems
apt-get install winbind
ntlm_auth --version