Wine 9.0 – 在 Linux 上运行 Windows 应用程序和游戏

Wine是一個開源且免費的應用程式,適用於Linux,允許用戶在類Unix/Linux作業系統上運行基於Windows的軟件和遊戲。

最近,Wine團隊自豪地宣布了穩定版本9.0的發布,現在可以作為源代碼和二進制包下載,支持各種發行版,包括Linux、Windows和Mac。

此版本反映了一年的辛勤工作和超過7,000個更改,其中包括許多改進,主要亮點包括新的WoW64架構和實驗性的Wayland驅動程序。

在本文中,我們將展示如何在Wine 9.0版本中安裝基於RHEL的發行版,例如CentOS StreamRocky LinuxAlmaLinux,使用源代碼(對專家而言比較困難)以及在Fedora Linux上使用官方wine存儲庫。

步驟1:安裝依賴包

要開始安裝過程,您需要安裝必要的開發工具和庫,包括GCC、libX11-devel、freetype-devel、zlib-devel和libxcb-devel。

yum -y groupinstall 'Development Tools'
yum install gcc libX11-devel freetype-devel zlib-devel libxcb-devel libxslt-devel

Fedora用戶,命令稍有不同:

dnf -y groupinstall 'Development Tools'
dnf -y install gcc libX11-devel freetype-devel zlib-devel libxcb-devel libxslt-

步驟2:下載 Wine 源代碼

接下來,您需要使用wget 命令/tmp目錄下以普通用戶身份下載 Wine 源代碼。

cd /tmp
wget http://dl.winehq.org/wine/source/9.0/wine-9.0.tar.xz

下載源代碼後,使用以下tar 命令將其解壓縮到/tmp目錄下。

tar -xvf wine-9.0.tar.xz -C /tmp/

步驟4:從源代碼安裝 Wine

解壓縮源代碼後,您需要以普通用戶身份從源代碼編譯 Wine。

Note: The installer might take up to 20-30 minutes and in the middle, it will ask you to enter the root password.
---------- On 64-bit Systems ---------- 
cd wine-9.0/
./configure --enable-win64
make
sudo make install

---------- On 32-bit Systems ---------- 
cd wine-9.0/
./configure
make
sudo make install	

在 Fedora Linux 上使用 Wine 存儲庫安裝 Wine

對於 Fedora 用戶,您可以使用以下命令從官方 Wine 存儲庫安裝Wine

---------- On Fedora 39 ---------- 
dnf config-manager --add-repo https://dl.winehq.org/wine-builds/fedora/39/winehq.repo
dnf install winehq-stable

---------- On Fedora 38 ---------- 
dnf config-manager --add-repo https://dl.winehq.org/wine-builds/fedora/38/winehq.repo
dnf install winehq-stable

配置和運行 Wine

安裝完成後,從GNOME桌面運行“winecfg”配置工具,以查看支持的配置。如果您沒有任何桌面,可以使用以下命令作為 root 用戶安裝它。

dnf groupinstall workstation 
OR
yum groupinstall "GNOME Desktop"

安裝X Window System後,以普通用戶身份運行命令以查看 wine 配置。

winecfg 
Winecfg Configuration

要運行Wine,您必須指定可執行程序的完整路徑或程序名,如下例所示。

--------- On 32-bit Systems ---------
wine notepad
wine c:\\windows\\notepad.exe
--------- On 64-bit Systems ---------
wine64 notepad
wine64 c:\\windows\\notepad.exe
Wine Running Windows Programs on Linux

酒不完美,因為在使用 Wine 時,我們看到了許多程式崩潰。我認為 Wine 團隊將很快在他們即將推出的版本中修復所有錯誤。同時,請使用以下表格分享您的意見。

Source:
https://www.tecmint.com/install-wine-in-rhel-centos-and-fedora/