Wine (简体中文)

From ArchWiki

Jump to: navigation, search


i18n
English
简体中文
Image:Tango-preferences-desktop-locale.png This page was marked to be translated.
If you understand both "original" and "target" languages of this page, please help complete the translation.

Contents

关于

Wine 是一个在Unix上X上的Windows API开源方案. is a translation layer (a program loader) capable of running Windows applications on GNU/Linux and other POSIX compatible operating systems. Windows programs running in Wine act as native programs would, running without the performance or memory usage penalties of an emulator, with a similar look and feel to other applications on your desktop.

安装

i686

Wine在官方的[extra]源中可以获得:

只需要

pacman -Sy wine

Wine就安装好了.

x86_64

There's as of writing no x86_64 version of wine available, but that should be the case soon because the devs already have a hello world running. If you don't bother stuffing your PC with i686 libraries and binarys, then use one of the bin32-wine packages in the AUR: bin32-wine and bin32-wine-suse.

Important: If you have a nvidia-graphicscard, you'll need to do

pacman -S lib32-nvidia-utils

to use 3D-allocation! Or look here for other than the newest lib32-nvidia-utils version, if you use the nvidia-96xx driver version for example.

配置

运行下面命令创建配置文件

 winecfg

检查上面的设置,然后点 确认 来保存。Wine的配置文件保存在

 ~/.wine

默认 C:\> 会映射到

 ~/.wine/drive_c

好了! 这就是一个基础的配置。你可以运行windows程序了:

 wine /path/to/something.exe

If you're having trouble getting DirectX apps to run properly, try adding the -opengl flag:

 wine /path/to/3d_game.exe -opengl

声音

默认情况下声音问题会在运行程序时体现出来。确保winecfg中只有一个声音设备被选中。ALSA应该可以使用(should work out of the box)但是仍然在某些游戏中出问题或者运行缓慢, 这里有一个关于这个问题的补丁:

http://kcat.strangesoft.net/wine_thread_prio.diff \

但是通过使用OSS并选择: winecfg -> Sound -> Hw acceleration -> Emulation 也可以修补这个声音问题。倘若你使用的是 alsa oss emulation 内核模块。(注意:使用 aoss 实用程序并不能解决这个问题;你必须载入 snd-pcm-oss 模块。)

字体

如果wine程序不能显示清晰的文字字体, 你可能没有安装微软Truetype字体。幸运的是Arch有这个包。

pacman -Sy ttf-ms-fonts

运行上述命令后, 杀死所有wine服务进程并运行winecfg;现在字体应该变的清晰。

如果你想安装其他TTF字体,你应该安装到$C_DRIVE/windows/fonts/ (其中的 $C_DRIVE 通常是 ~/.wine/drive_c)来让wine能够识别.

If the fonts look somehow smeared, enter the .wine directory and create a file fontrender.txt with the content:

[HKEY_CURRENT_USER\Software\Wine\X11 Driver]
"ClientSideWithRender"="N"

Add the key to your wine configuration by executing the following command:

regedit fontrender.txt

开启字体平滑(抗锯齿)

Template:注意


Create a file with a .reg (example: aa.reg) with the following content :

REGEDIT4

[HKEY_CURRENT_USER\Control Panel\Desktop]
"FontSmoothing"="2"
"FontSmoothingType"=dword:00000002
"FontSmoothingGamma"=dword:00000578
"FontSmoothingOrientation"=dword:00000001

run

regedit 

and choose

File -> Import registry file... 

and select your .reg file. Anti-aliasing fonts will be after the conclusion of regedit, and run wine applications again.

程序子菜单(Sub-Menu)

After installation, there will likely be no menu in your Desktop Manager. After installing a program using Wine, it will create a menu with your installed programs in it automatically. If you wish to add on to the menu to create a Ubuntu-like Wine sub-menu, then follow these instructions:

创建菜单项(Create Menu Entries)

First, install a Windows program using Wine to create the base menu. After the base menu is created, you can start to add the menu entries. In GNOME, right-click on the desktop and select "Create Launcher...". The steps might be different for KDE/Xfce. Make three launchers using these settings:

Type: Application
Name: Configuration
Command: winecfg
Comment: Configure the general settings for Wine
Type: Application
Name: Uninstall Programs
Command: wine uninstaller
Comment: Uninstall Windows programs under Wine properly
Type: Application
Name: Browse C:\ Drive
Command: wine winebrowser c:\\
Comment: Browse the files in the virtual Wine C:\ drive

Now that you have these three launchers on your desktop, it is time to put them into the menu. But, first you should change the launchers to dynamically change icons when a new icon set is installed. To do this, open the launchers that you just made in your favorite text editor. Change the following settings to these new values:


Configuration launcher:

Icon[en_US]=wine-winecfg
Icon=wine-winecfg

Uninstall Programs launcher:

Icon[en_US]=wine-uninstaller
Icon=wine-uninstaller

Browse C:\ Drive launcher:

Icon[en_US]=wine-winefile
Icon=wine-winefile

If these settings produce a ugly/non-existent icon, it means that there are no icons for these launchers in the icon set that you have enabled. You should replace the icon setting with the explicit location of the icon that you want. Clicking the icon in the launcher's properties menu will have the same effect. A great icon set that supports these shortcuts is GNOME-colors.

Now that you have the launchers fully configured, 'now' it is time to put them in the menu. Plop them into "~/.local/share/applications/wine/" using a terminal or file browser.

Wait a second, they aren't in the menu yet! There is one last step. Copy the following text into a text file named "wine-utilities.menu".

<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd">
<Menu>
  <Name>Applications</Name>
  <Menu>
    <Name>wine-wine</Name>
    <Directory>wine-wine.directory</Directory>
    <Include>
	<Filename>wine-Configuration.desktop</Filename>
    </Include>
    <Include>
	<Filename>wine-Browse C:\ Drive.desktop</Filename>
    </Include>
    <Include>
	<Filename>wine-Uninstall Programs.desktop</Filename>
    </Include>
  </Menu>
</Menu>

Now, just move the newly made file to the "~/.config/menus/applications-merged/" folder. Go check in the menu and there should be the minty fresh options waiting to be used!

KDE 4 菜单修复[1]

Wine菜单项可能会出现在 "Lost & Found" 中而不是 KDE4 的Wine菜单中。This is because kde-applications.menu is missing the MergeDir option.

Edit /etc/xdg/menus/kde-applications.menu

At the end of the file add <MergeDir>applications-merged</MergeDir> after <DefaultMergeDirs/>, it should look like this:

        <Include>
                <And>
                        <Category>KDE</Category>
                        <Category>Core</Category>
                </And>
        </Include>
        <DefaultMergeDirs/>
        <MergeDir>applications-merged</MergeDir>
        <MergeFile>applications-kmenuedit.menu</MergeFile>
</Menu>

Alternatively you can create a symlink to a folder that KDE does see:

ln -s ~/.config/menus/applications-merged ~/.config/menus/kde-applications-merged

This has the added bonus that an update to KDE won't change it, but is per user instead of system wide.

使用wine来执行Win16/Win32二进制程序

你可以通过手动运行wine执行二进制程序

wine programsname.exe

也可以告诉 Kernel 使用 wine 作为 Win16/Win32 二进制文件的解释器。首先挂载 binfmt_misc 文件系统:

mount -t binfmt_misc none /proc/sys/fs/binfmt_misc

或者在你的 /etc/fstab 里添加下面一行:

none  /proc/sys/fs/binfmt_misc binfmt_misc defaults 0 0

然后告诉内核如何解释Win16 和 Win32二进制程序:

echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register

可以把下面这行添加到/etc/rc.local让设置在每次启动时自动生效。这时,你可能希望免于切换 runlevels 时错误信息的打扰:

{ echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register; } 2>/dev/null

现在你可以尝试一下:

chmod 755 exefile.exe
./exefile.exe

你甚至可以删除.exe后缀, 因为内核不是通过后缀判断文件类型的.

Wine配置程序

这些工具能在典型的windows程序安装中帮助你。大多数情况下这些应该作为最后办法,因为他们会严重修改你的wine配置。


WineTricks

Winetricks is a quick (slightly dirty) script that will allow you to install base requirements needed to run some windows programs. Installable components include DirectX 9.x, msxml (office 2007 / IE requirement), visual runtimes and many more.

To install simply:

pacman -S winetricks

You can now start winetricks (as a normal user!) with:

winetricks


WineTools助手

(目前有一些过时了,但仍有效)

Winetools 是一个程序(确切地说实际上是一个脚本),能够帮助安装Wine的某些核心组件,这些组件是安装其他程序时必须得。注意这个助手不是Wine必备的,但是如果你想使Internet Explorer顺利运行,它能帮不少忙。

WineTools Site

记住,微软要求你必须拥有IE6的授权许可来安装 DCOM98 或是 Internet Explorer 6。如果你已经拥有了一份Windows的拷贝,那就没什么需要准备了。尽管我保证即便你没有授权许可也没人来逮捕你。

现在从 AUR: http://aur.archlinux.org/packages.php?ID=8913 中抓取 PKGBUILD

并按你的意愿构建软件包(and build the package as you would any PKGBUILD) (如果你不知道怎么做,参阅ABS (简体中文))

Sidenet Wine 设置工具

wine-config

  • Download the latest version
  • unpack it
  • READ THE README
  • execute
./setup
  • Follow the instructions

请注意: 像 网站这里所声明一样, 你只能被允许安装DCOM98如果你持有的是有效的Windows98授权许可。


Wine-doors

Wine-doors

Wine-doors is a WineTools replacement. It features a GNOME GUI and works like a package manager. Works fine in 64bit. You can find it in the AUR.

easywine

国内的一个wine助手程序, 具体情况请添加到这里 网站[www.linuxgame.org]

Archlinux上运行Win16 / Win32二进制程序的其他选择

  • Cedega - 针对游戏玩家
  • CVSCedega - cedega 的 CVS source 版
  • Codeweavers - Codeweavers' Crossover Office; 针对办公一族

外部资源

Personal tools