- A+
有些系统里原始的wine版本有一点低,想更好的使用体验我们需要升级自己的wine,这里就是讲解一下这一步的东西,
一种安装:
$ sudo apt-get install software-properties-common$ wine --version$ sudo add-apt-repository ppa:ubuntu-wine/ppa$ sudo apt-get update$ sudo apt-get install wine1.8$ sudo apt-get install winetricks$ winecfg
# deb cdrom:[Ubuntu 14.04.1 LTS _Trusty Tahr_ - Release amd64 (20140722.2)]/ trusty main restricted# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to# newer versions of the distribution.deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricteddeb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted## Major bug fix updates produced after the final release of the## distribution.deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricteddeb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu## team. Also, please note that software in universe WILL NOT receive any## review or updates from the Ubuntu security team.deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty universedeb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty universedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates universedeb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates universe## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu## team, and may not be under a free licence. Please satisfy yourself as to## your rights to use the software. Also, please note that software in## multiverse WILL NOT receive any review or updates from the Ubuntu## security team.deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty multiversedeb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty multiversedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates multiversedeb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates multiverse## N.B. software from this repository may not have been tested as## extensively as that contained in the main release, although it includes## newer versions of some applications which may provide useful features.## Also, please note that software in backports WILL NOT receive any review## or updates from the Ubuntu security team.deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiversedeb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiversedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricteddeb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricteddeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security universedeb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security universedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security multiversedeb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security multiverse## Uncomment the following two lines to add software from Canonical's## 'partner' repository.## This software is not part of Ubuntu, but is offered by Canonical and the## respective vendors as a service to Ubuntu users.# deb http://archive.canonical.com/ubuntu trusty partner# deb-src http://archive.canonical.com/ubuntu trusty partner## This software is not part of Ubuntu, but is offered by third-party## developers who want to ship their latest software.deb http://extras.ubuntu.com/ubuntu trusty maindeb-src http://extras.ubuntu.com/ubuntu trusty main
安装源:(2.0.2版)
dpkg --print-foreign-architectures
sudo dpkg --add-architecture i386wget -nc https://dl.winehq.org/wine-builds/Release.key
sudo apt-key add Release.key
sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/sudo add-apt-repository ppa:wine/wine-buildssudo apt-get update (apt-get install apt-transport-https)
sudo apt-get dist-upgrade
安装wine:
Stable branch :sudo apt-get install --install-recommends winehq-stable#稳定版Staging branch :sudo apt-get install --install-recommends winehq-staging#开发板
配置:
winecfg #简单配置
winetricks #配置 ( sudo apt-get install winetricks)
cd /usr/bin/ wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks chmod a+x /usr/bin/winetricks
管理命令:
wine配置:winecfg
wine配置:winetricks
wine文件管理器:winefile
wine注册表编辑器:wine regedit
wine控制面板:wine control
如何卸载windows程序:wine uninstaller
卸载wine:
1).卸载wine主程序,在终端里输入:sudo apt-get remove --purge wine2).然后删除wine的目录文件:rm -r ~/.wine3).卸载残留不用的软件包:sudo apt-get autoremove
中文问题:
运行
$wine regedit
找到HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes,只要删除MS Shell Dlg和MS Shell Dlg2即可。
主要原因为tahoma字体在Linux下无法显示中文。
这个方案是把桌面系统都变中文:
在 Ubuntu 下修改
/etc/default/locale
文件即可。原版:LANG="en_US.UTF-8"不用在
/etc/default/locale
里设置
在终端里,执行LC_ALL=zh_CN.utf8 wine xxx.exe
,只在运行时有效
首先说一下wine对注册表的处理。wine把基本的注册表内容存储在.wine目录下,名为system.reg和user.reg。虽然可以直接修改其中内容,但是并不代表下次启动wine时这些更改一定会生效,原因在于wine在启动时会根据启动环境自动修改注册表中的一些内容(比如语言、区域、字体等),并且在关闭时将它们写会.reg文件。所以捏,有时候辛辛苦苦改完了,下次启动又恢复原样(利用regedit.exe修改也是如此)。这时候就需要借助其他方法进行修改。
然后是wine虚拟环境下的区域设置,这个与wine运行时的环境变量有关。有关注册表键值为:
[HKEY_CURRENT_USER\Control Panel\International]
"Locale"="00000804"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language]
"InstallLanguage"="00000804"
"Default"="00000804"
其中“00000804”是“中文(中国)”的代号。若使用命令
env LANG=zh_CN.UTF-8 wine EXE文件
运行程序,则wine会自动修改注册表中的这些键值。该设置适用于程序中的中文变成方块“□”的情形。
其次是wine的字体设置。有关注册表键值为:
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]
"Arial Baltic,186"="Arial,186"
"Arial CE,238"="Arial,238"
"Arial CYR,204"="Arial,204"
"Arial Greek,161"="Arial,161"
"Arial TUR,162"="Arial,162"
"Courier New Baltic,186"="Courier New,186"
"Courier New CE,238"="Courier New,238"
"Courier New CYR,204"="Courier New,204"
"Courier New Greek,161"="Courier New,161"
"Courier New TUR,162"="Courier New,162"
"Helv"="MS Sans Serif"
"Helvetica"="Arial"
"MS Shell Dlg"="Tahoma"
"MS Shell Dlg 2"="Tahoma"
"Times"="Times New Roman"
"Times New Roman Baltic,186"="Times New Roman,186"
"Times New Roman CE,238"="Times New Roman,238"
"Times New Roman CYR,204"="Times New Roman,204"
"Times New Roman Greek,161"="Times New Roman,161"
"Times New Roman TUR,162"="Times New Roman,162"
"Tms Rmn"="Times New Roman"
以上为wine1.9默认配置。但是在显示中文时,这些字体都不含中文字形,因而系统会默认改用后备(fallback)字体,也就是Droid Sans Fallback Full(不同系统可能有所差异)。此字体在处理中文时可能出现一些奇怪的问题:比如在腾讯QQ中,部分以中文开头的文本会显示为方块“□”,但若字符串中含有英文/数字,则英文/数字之后的中文又不受影响。个人推测原因是字符串处理函数对ANSI与UNICODE的兼容性不佳,导致字首中文被解析为无法显示的字符编码。
解决方法是使用文泉驿字体,只需要修改“MS Shell Dlg”一项为文泉驿字体的名称即可。然而问题在于:
1、wine在启动时,会根据区域设置修改“MS Shell Dlg”和“Tms Rmn”两项。如果区域设置为中文,则会做以下替换:
"MS Shell Dlg"="SimSun"
"Tms Rmn"="NSimSun"
而wine一般不会自带“SimSun”即宋体字库(“NSimSun”为新宋体);
2、一般文泉驿字体的名称为中文(“文泉驿微米黑”,可以在“[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts]”里看到),但是wine对于这种情况并不认可,即便设置了也仍然会使用后备字体。
因此,需要做以下调整:
1、在Fonts中添加一项
"WenQuanYi"="Z:\\usr\\share\\fonts\\truetype\\wqy\\wqy-microhei.ttc"
其中等号右侧为字体绝对路径,应当根据具体系统进行修改(注意使用双斜杠转义)。
2、在FontSubstitutes中添加三项:
"MS Shell Dlg"="WenQuanYi"
"SimSun"="WenQuanYi"
"Tahoma"="WenQuanYi"
也可以将原先的中文名称改为英文名称(比如“WenQuanYi_Micro_Hei”,最好不含空格),然后在FontSubstitutes中将上述三项改为该英文名称。当然,如果你愿意**违法**使用微软的有版权字体(比如直接复制Windows下的SimSun.ttc到.wine/driver_c/Windows/Fonts),方法也同上。
Wine原生支持中文
在wine1.4版本以后,官方修改了中日韩字体的渲染方式 ,默认只需要系统安装了”WenQuanYi Micro Hei”字体,大多数中日韩语言的unicode程序都能正常显示。 在2012年Red Hat提交的CJK字体补丁[1]。
不再需要修改注册表”FontSubstitutes”和”MS Shell Dlg 2″键值,也不需要复制字体到~/.wine/drive_c/windows/fonts/目录中。
目前,最新版16.04系统中wine程序可以正常输入汉字。 旧版本系统中,有时出现Fcitx输入法无法光标跟随的问题。 fcitx输入法在wine程序中不能输入,可以向~/.bashrc中添加以下代码
export XMODIFIERS="@im=fcitx"export GTK_IM_MODULE="fcitx"export QT_IM_MODULE="fcitx"
