https://blog.csdn.net/m0_61060696/article/details/138199101

安装aarch64运行库
直接执行以下命令进行安装:

sudo apt-get install libasound2:arm64 libc6:arm64 libglib2.0-0:arm64 libgstreamer-plugins-base1.0-0:arm64 libgstreamer1.0-0:arm64 libldap-2.4-2:arm64 libpcap0.8:arm64 libvkd3d1:arm64 libx11-6:arm64 libxext6:arm64 libasound2-plugins:arm64 ocl-icd-libopencl1:arm64 libncurses6:arm64 libncurses5:arm64 libcap2-bin:arm64 libdbus-1-3:arm64 libfontconfig1:arm64 libfreetype6:arm64 libglu1-mesa:arm64 libglu1:arm64 libgnutls30:arm64 libgssapi-krb5-2:arm64 libkrb5-3:arm64 libodbc1:arm64 libosmesa6:arm64 libsdl2-2.0-0:arm64 libv4l-0:arm64 libxcomposite1:arm64 libxcursor1:arm64 libxfixes3:arm64 libxi6:arm64 libxinerama1:arm64 libxrandr2:arm64 libxrender1:arm64 libxxf86vm1 libc6:arm64

本机测试未出现依赖冲突。

2.2 安装armhf运行库
2.2.1 添加32位armhf架构支持
输入以下命令添加armhf架构:

sudo dpkg --add-architecture armhf

输入以下命令更新apt缓存:

sudo apt update

2.2.2 检查运行库依赖
输入以下命令查看运行库是否存在依赖冲突:

sudo apt-get install libasound2:armhf libc6:armhf libglib2.0-0:armhf libgstreamer-plugins-base1.0-0:armhf libgstreamer1.0-0:armhf libldap-2.4-2:armhf libpcap0.8:armhf libvkd3d1:armhf libx11-6:armhf libxext6:armhf libasound2-plugins:armhf ocl-icd-libopencl1:armhf libncurses6:armhf libncurses5:armhf libcap2-bin:armhf libdbus-1-3:armhf libfontconfig1:armhf libfreetype6:armhf libglu1-mesa:armhf libglu1:armhf libgnutls30:armhf libgssapi-krb5-2:armhf libkrb5-3:armhf libodbc1:armhf libosmesa6:armhf libsdl2-2.0-0:armhf libv4l-0:armhf libxcomposite1:armhf libxcursor1:armhf libxfixes3:armhf libxi6:armhf libxinerama1:armhf libxrandr2:armhf libxrender1:armhf libxxf86vm1 libc6:armhf

安装Box64
输入以下命令安装最新版的box64,也可以通过源码编译安装:

sudo wget https://cdn05042023.gitlink.org.cn/shenmo7192/box64-debs/raw/branch/master/box64-CN.list -O /etc/apt/sources.list.d/box64.list
wget -qO- https://cdn05042023.gitlink.org.cn/shenmo7192/box64-debs/raw/branch/master/KEY.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/box64-debs-archive-keyring.gpg 
sudo apt update
sudo apt install box64 -y

这里也提供32位的Box86安装方法,如有需要可以输入以下命令安装最新版的Box86,也可以通过源码编译安装:

sudo wget https://itai-nelken.github.io/weekly-box86-debs/debian/box86.list -O /etc/apt/sources.list.d/box86.list
wget -qO- https://itai-nelken.github.io/weekly-box86-debs/debian/KEY.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/box86-debs-archive-keyring.gpg
sudo apt update && sudo apt install box86 -y

如果无法添加源,也可以直接在下载页面下载最新的.deb安装包,然后通过dpkg -i安装。

四、安装Wine
注意:这里需要安装X64版本的Wine64和X86版本的Wine,不能安装Arm版本的Wine64,Arm版的Wine64只能安装Arm版的Windows软件
将以下shell脚本保存至本地,根据需要修改branch分支信息和version版本信息,然后sudo bash执行以下shell脚本安装Wine64:

    # NOTE: Can only run on aarch64 (since box64 can only run on aarch64)
    # box64 runs wine-amd64, box86 runs wine-i386.

    ### User-defined Wine version variables ################
    # - Replace the variables below with your system's info.
    # - Note that we need the amd64 version for Box64 even though we're installing it on our ARM processor.
    # - Note that we need the i386 version for Box86 even though we're installing it on our ARM processor.
    # - Wine download links from WineHQ: https://dl.winehq.org/wine-builds/

    branch="staging" #example: devel, staging, or stable (wine-staging 4.5+ requires libfaudio0:i386)
    version="9.7" #example: "7.1"
    id="ubuntu" #example: debian, ubuntu
    dist="focal" #example (for debian): bullseye, buster, jessie, wheezy, ${VERSION_CODENAME}, etc 
    tag="-1" #example: -1 (some wine .deb files have -1 tag on the end and some don't)

  ########################################################

    # Clean up any old wine instances
    wineserver -k # stop any old wine installations from running
    rm -rf ~/.cache/wine # remove any old wine-mono/wine-gecko install files
    rm -rf ~/.local/share/applications/wine # remove any old program shortcuts

    # Backup any old wine installs
    rm -rf ~/wine-old 2>/dev/null; mv ~/wine ~/wine-old 2>/dev/null
    rm -rf ~/.wine-old 2>/dev/null; mv ~/.wine ~/.wine-old 2>/dev/null
    sudo mv /usr/local/bin/wine /usr/local/bin/wine-old 2>/dev/null
    sudo mv /usr/local/bin/wine64 /usr/local/bin/wine-old 2>/dev/null
    sudo mv /usr/local/bin/wineboot /usr/local/bin/wineboot-old 2>/dev/null
    sudo mv /usr/local/bin/winecfg /usr/local/bin/winecfg-old 2>/dev/null
    sudo mv /usr/local/bin/wineserver /usr/local/bin/wineserver-old 2>/dev/null

    # Wine download links from WineHQ: https://dl.winehq.org/wine-builds/
    # LNKA="https://dl.winehq.org/wine-builds/${id}/dists/${dist}/main/binary-amd64/" #amd64-wine links
    LNKA="https://mirrors.tuna.tsinghua.edu.cn/wine-builds/${id}/dists/${dist}/main/binary-amd64/" #amd64-wine links
    DEB_A1="wine-${branch}-amd64_${version}~${dist}${tag}_amd64.deb" #wine64 main bin
    DEB_A2="wine-${branch}_${version}~${dist}${tag}_amd64.deb" #wine64 support files (required for wine64 / can work alongside wine_i386 main bin)
        #DEB_A3="winehq-${branch}_${version}~${dist}${tag}_amd64.deb" #shortcuts & docs
    # LNKB="https://dl.winehq.org/wine-builds/${id}/dists/${dist}/main/binary-i386/" #i386-wine links
    LNKB="https://mirrors.tuna.tsinghua.edu.cn/wine-builds/${id}/dists/${dist}/main/binary-i386/" #i386-wine links
    DEB_B1="wine-${branch}-i386_${version}~${dist}${tag}_i386.deb" #wine_i386 main bin
    DEB_B2="wine-${branch}_${version}~${dist}${tag}_i386.deb" #wine_i386 support files (required for wine_i386 if no wine64 / CONFLICTS WITH wine64 support files)
    #DEB_B3="winehq-${branch}_${version}~${dist}${tag}_i386.deb" #shortcuts & docs

    # Install amd64-wine (64-bit) alongside i386-wine (32-bit)
    echo -e "Downloading wine . . ."
    wget -q ${LNKA}${DEB_A1} 
    #echo ${LNKA}${DEB_A1} 
    wget -q ${LNKA}${DEB_A2} 
    wget -q ${LNKB}${DEB_B1} 
    #wget -q ${LNKB}${DEB_B2} # 32-bits wine
    echo -e "Extracting wine . . ."
    dpkg-deb -x ${DEB_A1} wine-installer
    dpkg-deb -x ${DEB_A2} wine-installer
    dpkg-deb -x ${DEB_B1} wine-installer
    #dpkg-deb -x ${DEB_B2} wine-installer # 32-bits wine
    echo -e "Installing wine . . ."
    mv wine-installer/opt/wine* /home/${SUDO_USER}/wine

安装完成后,执行以下命令创建软链接并添加执行权限:

# Install symlinks
sudo ln -s ~/wine/bin/wine /usr/local/bin/wine
sudo ln -s ~/wine/bin/wine64 /usr/local/bin/wine64
sudo ln -s ~/wine/bin/wineboot /usr/local/bin/wineboot
sudo ln -s ~/wine/bin/winecfg /usr/local/bin/winecfg
sudo ln -s ~/wine/bin/wineserver /usr/local/bin/wineserver
sudo chmod +x /usr/local/bin/wine /usr/local/bin/wine64 /usr/local/bin/wineboot /usr/local/bin/winecfg /usr/local/bin/wineserver

五、初始化wine配置
执行以下命令对wine进行初始化,可能出现一些错误提示,会影响特定Windows软件运行,暂时不用理会:

wine64 wineboot
文档更新时间: 2024-09-03 06:24   作者:月影鹏鹏