ubuntu22.04 安装wine9.0 全网首发

wine官网推荐安装方式:https://gitlab.winehq.org/wine/wine/-/wikis/zh_CN/Debian-Ubuntu

博主按照这种方式是失败的,虽然开启了“低调上网”,貌似代理对于终端不起作用,后面会介绍替代方案,一样完美。

一、官网的安装方式(会报错)

首先,开启 32 位支持:

sudo dpkg --add-architecture i386

然后安装被用于签发安装包的密钥:

sudo mkdir -pm755 /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
  • 下载和安装 WineHQ 源文件:

    noble
    Ubuntu 24.04
    Linux Mint 22
    sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/noble/winehq-noble.sources
    jammy
    Ubuntu 22.04
    Linux Mint 21.x
    sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
    focal
    Ubuntu 20.04
    Linux Mint 20.x
    sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/focal/winehq-focal.sources
    trixie
    Debian Testing
    sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/debian/dists/trixie/winehq-trixie.sources
    bookworm
    Debian 12
    sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/debian/dists/bookworm/winehq-bookworm.sources
    bullseye
    Debian 11
    sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/debian/dists/bullseye/winehq-bullseye.sources
  • 更新软件仓库:

    sudo apt update

然后安装 以下其中一个安装包

稳定分支 sudo apt install --install-recommends winehq-stable
开发分支 sudo apt install --install-recommends winehq-devel
Staging 分支 sudo apt install --install-recommends winehq-staging

不出意外就出意外,有如下报错,或者卡其

二、替代方案

1.首先下载两个文件

a. winehq.key

b. winehq-jammy.sources

sudo mkdir -pm755 /etc/apt/keyrings

sudo cp winehq.key  /etc/apt/keyrings/winehq-archive.key

sudo cp winehq-jammy.sources /etc/apt/sources.list.d/

2. 尝试运行指令

sudo apt update

sudo apt install --install-recommends winehq-stable

会报错

无法访问,

我这里直接去官网把那几个文件下载下来:

可以看到是四个文件出错

Index of /wine-builds这个链接找到ubuntu->dists->jammy->main会看到下面

分析报错的代码:

忽略:1 https://dl.winehq.org/wine-builds/ubuntu jammy/main i386 wine-stable-i386 i386 9.0.0.0~jammy-1
忽略:2 https://dl.winehq.org/wine-builds/ubuntu jammy/main amd64 wine-stable-amd64 amd64 9.0.0.0~jammy-1
忽略:3 https://dl.winehq.org/wine-builds/ubuntu jammy/main amd64 wine-stable amd64 9.0.0.0~jammy-1
忽略:4 https://dl.winehq.org/wine-builds/ubuntu jammy/main amd64 winehq-stable amd64 9.0.0.0~jammy-1

有一个是i386的,另外两个是amd64,去这两个文件夹里面,先找到这几个对应的文件例如

wine-stable-i386 i386 9.0.0.0~jammy-1 搜索: wine-stable-i386_9

全部下载完之后如下图所示

直接安装这个四

sudo dpkg -i *.deb

不出意外就出现下面的报错:(不要慌张,接着看)

再次运行一下这个指令

sudo apt install --install-recommends winehq-stable

不出意外还是报错,(不要慌,快解决了)

运行指令,完美解决

sudo apt --fix-broken install

wine --version

上一篇:Linux安全命令(Linux Security Commands)


下一篇:JavaScript高级——ES6基础入门