Yanyg - Software Engineer

Linux Debian下安装微信

目录

腾讯直到现在都不发布LINUX版本的APP,简直了。本文描述使用WINE安装微信的过程。

1 install

1.1 wine

微信需要32位平台。安装32位的wine:

~$ sudo dpkg --add-architecture i386
~$ sudo apt-get update
~$ sudo apt-get install wine32 wine

1.2 download windows wechat

从官网下载windows安装包:https://weixin.qq.com/

~$ WINEARCH=win32 WINEPREFIX=/home/yanyg/.wine32/ wine ~/Downloads/WeChatSetup.exe

安装完毕退出。安装后会有一个Desktop快捷方式:

$ cat ~/Desktop/WeChat.desktop
[Desktop Entry]
Name=WeChat
Exec=env WINEPREFIX="/home/yanyg/.wine32" WINEARCH=win32 wine-stable C:\\\\windows\\\\command\\\\start.exe /Unix /home/yanyg/.wine32/dosdevices/c:/users/Public/Desktop/WeChat.lnk
Type=Application
StartupNotify=true
Path=/home/yanyg/.wine32/dosdevices/c:/WeChat
Icon=2D85_WeChat.0
StartupWMClass=wechat.exe

一般在终端启动程序,参考上面的内容,写一个脚本启动微信:

#! /bin/bash

(
    LC_ALL=zh_CN.UTF-8 Exec=env WINEARCH=win32 \
          WINEPREFIX="/home/yanyg/.wine32" \
          /usr/bin/wine explorer /desktop=wechat \
          "/home/yanyg/.wine32/dosdevices/c:/WeChat"
) >/tmp/wechat.log 2>&1 &

上面文件保存为wechat并加可执行权限,放在PATH路径里。例如:

[yanyg@t440{192.168.1.110} ~/Downloads ] <2020-11-14 20:50:14>
$ echo $PATH
/home/yanyg/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
[yanyg@t440{192.168.1.110} ~/Downloads ] <2020-11-14 20:50:17>
$ ls ~/bin/
e  wechat

1.3 winetricks riched20

wine内置的riched20在微信下无法看到输入内容。拷贝win7/win10下的测试无效。使用 winetricks 安装:

~$ sudo apt-get install winetricks

尝试安装,总报各种download失败错误:

~$ export WINEARCH=win32
~$ export WINEPREFIX=/home/yanyg/.wine32/
~$ winetricks riched20
...
Executing load_riched20
Executing cd /home/yanyg/.cache/winetricks/win2ksp4
Downloading https://ftp.gnome.org/mirror/archive/ftp.sunet.se/pub/security/vendor/microsoft/win2000/Service_Packs/usa/W2KSP4_EN.EXE to /home/yanyg/.cache/winetricks/win2ksp4
--2020-11-14 19:20:33--  https://ftp.gnome.org/mirror/archive/ftp.sunet.se/pub/security/vendor/microsoft/win2000/Service_Packs/usa/W2KSP4_EN.EXE
Resolving ftp.gnome.org (ftp.gnome.org)... 8.43.85.14, 8.43.85.29, 8.43.85.13, ...
Connecting to ftp.gnome.org (ftp.gnome.org)|8.43.85.14|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2020-11-14 19:20:35 ERROR 404: Not Found.

Executing cd /home/yanyg/.cache/winetricks/win2ksp4
Downloading https://web.archive.org/web/2000/https://ftp.gnome.org/mirror/archive/ftp.sunet.se/pub/security/vendor/microsoft/win2000/Service_Packs/usa/W2KSP4_EN.EXE to /home/yanyg/.cache/winetricks/w
in2ksp4
--2020-11-14 19:20:36--  https://web.archive.org/web/2000/https://ftp.gnome.org/mirror/archive/ftp.sunet.se/pub/security/vendor/microsoft/win2000/Service_Packs/usa/W2KSP4_EN.EXE
Resolving web.archive.org (web.archive.org)... 173.244.209.150, 2001::1f0d:5217
Connecting to web.archive.org (web.archive.org)|173.244.209.150|:443... failed: Connection timed out.
Connecting to web.archive.org (web.archive.org)|2001::1f0d:5217|:443... failed: Network is unreachable.
Retrying.x

要么 winetricks 维护链接有问题,要么是伟大的GFW误判了。想办法从其他地方下载拷贝过去:

~$ wget --continue --timeout=5 --tries=0 https://whp-aus2.cold.extweb.hp.com/pub/softlib/software/msi/InstMsiW.exe
~$ wget --continue --timeout=5 --tries=0 https://saimei.ftp.acc.umu.se/mirror/archive/ftp.sunet.se/pub/security/vendor/microsoft/win2000/Service_Packs/usa/W2KSP4_EN.EXE
~$ cp InstMsiW.exe ~/.cache/winetricks/msls31/
~$ cp W2KSP4_EN.EXE ~/.cache/winetricks/win2ksp4/

再执行安装:

$ winetricks riched20                                                                                                                                                                           [23/23]
------------------------------------------------------
Github down? version '' doesn't appear to be a valid version
------------------------------------------------------
Executing mkdir -p /home/yanyg
Using winetricks 20200412 - sha256sum: 40ff4c67804584b73d4d36153e1f64ca426d739f1790bd748f5ded0865e8cc7f with wine-4.0 (Debian 4.0-2) and WINEARCH=win32
Executing w_do_call riched20
Executing mkdir -p /home/yanyg
Executing load_riched20
Executing cabextract -q -d /home/yanyg/.wine32/dosdevices/c:/windows/temp -L -F i386/riched20.dl_ /home/yanyg/.cache/winetricks/win2ksp4/W2KSP4_EN.EXE
Executing cabextract -q --directory=/home/yanyg/.wine32/dosdevices/c:/windows/system32 /home/yanyg/.wine32/dosdevices/c:/windows/temp/i386/riched20.dl_
Using native,builtin override for following DLLs: riched20
Executing wine regedit C:\windows\Temp\override-dll.reg
Executing w_do_call msls31
Executing mkdir -p /home/yanyg
Executing load_msls31
Executing cabextract -q --directory=/home/yanyg/.wine32/dosdevices/c:/windows/temp /home/yanyg/.cache/winetricks/msls31/InstMsiW.exe
Executing cp -f /home/yanyg/.wine32/dosdevices/c:/windows/temp/msls31.dll /home/yanyg/.wine32/dosdevices/c:/windows/system32
You opted in, so reporting 'msls31 riched20 ' to the winetricks maintainer so he knows which winetricks verbs get used and which don't.  Use --optout to disabl
e future reports.

2 使用技巧

  • 设置窗口大小
/usr/bin/wine explorer /desktop=wechat,1600x900

3 others

4 Test

wechat-in-debian.jpg