Ubuntu安装Deepin-wine、微信、企业微信
一键安装deepin-wine、 微信、企业微信
curl -s https://raw.githubusercontent.com/xmaples/scripts/main/shell/deepin-wine-wechat.sh | bash
Install Wine 6 on Ubuntu
sudo dpkg --add-architecture i386
sudo apt update
wget -qO- https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo apt-add-repository "deb http://dl.winehq.org/wine-builds/ubuntu/ $(lsb_release -cs) main"
sudo apt install --install-recommends winehq-stable
Install deepin-wine_2.18-22
mkdir -p /tmp/deepin-wine
cd /tmp/deepin-wine
echo '下载deepin-wine安装包'
wget https://packages.deepin.com/deepin/pool/non-free/d/deepin-wine/deepin-wine_2.18-22~rc0_all.deb
wget https://packages.deepin.com/deepin/pool/non-free/d/deepin-wine/deepin-wine32_2.18-22~rc0_i386.deb
wget https://packages.deepin.com/deepin/pool/non-free/d/deepin-wine/deepin-wine32-preloader_2.18-22~rc0_i386.deb
wget https://packages.deepin.com/deepin/pool/non-free/d/deepin-wine-helper/deepin-wine-helper_1.2deepin8_i386.deb
wget https://packages.deepin.com/deepin/pool/non-free/d/deepin-wine-plugin/deepin-wine-plugin_1.0deepin2_amd64.deb
wget https://packages.deepin.com/deepin/pool/non-free/d/deepin-wine-plugin-virtual/deepin-wine-plugin-virtual_1.0deepin3_all.deb
wget https://packages.deepin.com/deepin/pool/non-free/d/deepin-wine-uninstaller/deepin-wine-uninstaller_0.1deepin2_i386.deb
wget https://packages.deepin.com/deepin/pool/non-free/u/udis86/udis86_1.72-2_i386.deb
wget https://packages.deepin.com/deepin/pool/non-free/d/deepin-wine/deepin-fonts-wine_2.18-22~rc0_all.deb
wget https://packages.deepin.com/deepin/pool/non-free/d/deepin-wine/deepin-libwine_2.18-22~rc0_i386.deb
wget https://packages.deepin.com/deepin/pool/main/libj/libjpeg-turbo/libjpeg62-turbo_1.5.1-2_amd64.deb
wget https://packages.deepin.com/deepin/pool/main/libj/libjpeg-turbo/libjpeg62-turbo_1.5.1-2_i386.deb
#echo '添加32位支持'
sudo dpkg --add-architecture i386
echo '刷新apt缓存信息'
sudo apt-get update
echo '开始安装'
sudo dpkg -i *.deb
echo '安装依赖'
sudo apt install -fy
References:
安装微信、企业微信 Install deepin-wechat, weixin-work
mkdir -p /tmp/deepin-wine/wechat
cd /tmp/deepin-wine/wechat
echo '下载微信安装包'
wget https://packages.deepin.com/deepin/pool/non-free/d/deepin.com.wechat/deepin.com.wechat_2.6.8.65deepin0_i386.deb
wget https://packages.deepin.com/deepin/pool/non-free/d/deepin.com.weixin.work/deepin.com.weixin.work_2.8.10.2010deepin0_i386.deb
echo '安装'
sudo dpkg -i deepin.com.wechat_2.6.8.65deepin0_i386.deb
sudo dpkg -i deepin.com.weixin.work_2.8.10.2010deepin0_i386.deb
echo '安装完成'
requirement of deepin-wine >= 2.18_19 for deepin.com.wechat_2.6.8.
environment variable WINEPREFIX
can be set to the absolute path of the root directory path of a custom wine container for wine related commands.
e.g.
env WINEPREFIX="/home/xxx/.wine-2" wineserver -k
env WINEPREFIX="/home/xxx/.wine-3" winetricks corefonts
# install winetricks
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
# chmod a+x winetricks # make it executable
# mv winetricks /usr/local/bin # move it into $PATH
# install core fonts
winetricks corefonts
# ./winetricks ... # without moving it into $PATH
# sh winetricks ... # without making executable nor moving
# config deepin-wine
deepin-wine winecfg
在Wine中用Deepin/Ubuntu本地相应程序打开文件
基本原理是修改windows注册表将所有文件扩展名的对应到一个自定义处理程序脚本,脚本中调用linux程序来使用相应程序打开文件。
- 创建可执行文件
.wine/drive_c/linuxnativeopen.exe
(文件路径可自定义但需在wine容器系统中且后续步骤需对应该路径),并注入脚本代码(见后附)。
vim .wine/drive_c/linuxnativeopen.exe # then typing the content, see appendix
chmod +x .wine/drive_c/linuxnativeopen.exe # make it executable
- 编写一个windows registry(.reg)文件,在wine容器内注册表中注册文件类型的处理程序。
vim .wine/drive_c/linuxnative.reg # 将.reg文件放到wine容器系统中
wine regedit .wine/drive_c/linuxnative.reg
Appendix 附文件内容:
文件处理程序linuxnativeopen.exe
#!/bin/bash
LINUX_PATH=$(winepath "$@" 2> /dev/null) #如果是自定义了wine容器根目录,则需加上相应的WINEPREFIX环境变量
/usr/bin/xdg-open "$LINUX_PATH"
注册表脚本linuxnative.reg
REGEDIT4
[HKEY_CLASSES_ROOT\.txt]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.csv]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.tsv]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.rtf]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.odt]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.pdf]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.tif]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.doc]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.docx]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.xls]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.xlsx]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.ppt]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.pptx]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.jpg]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.jpeg]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\.png]
@="linuxnative"
"Content Type"="application/linuxnative"
[HKEY_CLASSES_ROOT\linuxnative]
[HKEY_CLASSES_ROOT\linuxnative\shell]
[HKEY_CLASSES_ROOT\linuxnative\shell\open]
[HKEY_CLASSES_ROOT\linuxnative\shell\open\command]
@="c:\\linuxnativeopen.exe \"%1\""
FAQ
(wine5)
微信不能显示中文?
1、是否缺少中文字体?
通过winetricks安装
或手动安装
安装中文字体:
(1)复制字体文件到.wine/drive_c/Windows/Fonts/目录。
(2)在注册表中注册。(可从windows系统中注册表导出 HKLM/Software/Microsoft/Windows NT/Fonts为.reg文件,然后用wine regedit /path/to/file.reg)
2、是否设置wine的中文环境?
如果在英文环境中运行wine,则会导致显示中文乱码,可在运行命令前LANG环境变量指定到中文,如
(1)通过find找到微信的.desktop启动文件,find ~/.local -iname '*wechat*.desktop'
,一般在~/.local/share/applications/wine/Programs/Wechat.desktop.
(2)对Exe命令增加LANG等环境变量,如Exec=env LANG=zh_CN.UTF-8 XMODIFIERS="@im=fcitx" GTK_IM_MODULE="fcitx" QT_IM_MODULE="fcitx" WINEPREFIX=....
或直接修改/opt/deepinwine/tools/run.sh
中WINECMD,添加语言环境变量。
wine微信输入框不显示已输入文字(不论中英文)但实际可发送消息?
已执行命令winetricks riched20
,无报错,没有提示下载InstMsiW.exe或W2KSP4_EN.EXE失败,仅提示已安装riched20。输出如下
------------------------------------------------------
You are using a 64-bit WINEPREFIX. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
Executing w_do_call riched20
riched20 already installed, skipping
解决方案:
强制重新安装riched20,winetricks --force riched20
,会自动试图下载InstMsiW.exe及W2KSP4_EN.EXE,一般都会下载失败,故手动从网上下载此二文件,然后存放路径为~/.cache/winetricks/msls31/InstMsiW.exe
及~/.cache/winetricks/win2ksp4/W2KSP4_EN.EXE
,之后强制重新安装winetricks --force riched20
。
InstMsiW.exe及W2KSP4_EN.EXE的参考下载网址:https://saimei.ftp.acc.umu.se/mirror/archive/ftp.sunet.se/pub/security/vendor/microsoft/win2000/Service_Packs/usa/W2KSP4_EN.EXE
https://chuangtzu.ftp.acc.umu.se/mirror/archive/ftp.sunet.se/pub/security/vendor/microsoft/win2000/Service_Packs/usa/W2KSP4_EN.EXE
https://whp-aus2.cold.extweb.hp.com/pub/softlib/software/msi/InstMsiW.exe
P> NSIS error launching installer
S: try to place the .exe file under wine container path, e.g. ~/.wine/drive_c/, and then install it by a dos-style path, e.g. wine C:\\APP.exe
for a installer file located at ~/.wine/drivce_c/APP.exe
.
使用经历:
wine 微信问题:
一段时候后再次打开微信,在中文输入法下打出的是英文,转到terminal或其他程序编辑正常输入中文后回到企业微信可以输入中文,回到微信可以输入中文