在 Debian 中使用 APT 包管理工具通过 Ubuntu PPA 安装最新软件包
在 Debian 中使用 APT 包管理工具通过 Ubuntu PPA 安装最新软件包Neovim 0.10.0 在 24 年 5 月发布了. 考虑许久后笔者决定试着从 Vim 9 转向 Neovim. 此中遇到的第一个题目是, Debian 的默认源里只有 Neovim 0.7.7, 因此寻找下载最新软件包的方法, 并做下具体记录.
虽然本文初衷是笔者想要下载最新的 Neovim, 但此中步骤得当全部提供 PPA 的软件包.
什么是 PPA?
PPA 是 Personal Package Archive 的缩写, 是一种开辟者(团队)提供的发布软件版本的源. 通常 PPA 会提供比包管理器默认的源更新的版本, 而代价是丧失一部分体系稳定性.
PPA 与 Ubuntu 体系联系紧密,而 Debian 想要将 PPA 作为 APT 的源需要些许额外的步骤。
总体流程:
[*]检查并安装 APT 依赖
[*]添加 PPA 源
[*]导入 PPA Fingerprint(指纹)
[*]更新 APT 数据并安装最新的软件包
检查并安装 APT 依赖
[*]通过 APT 检查 build-essential 与 devscripts 包是否已安装
使用下述下令检查 build-essential 是否安装
apt list --installed | grep build-essential$ apt list --installed | grep build-essential
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
build-essential/stable,now 12.9 amd64 使用下述下令检查 devscripts 是否安装
apt list --installed | grep devscripts$ apt list --installed | grep devscripts
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
devscripts/stable,now 2.23.4+deb12u2 amd64 根据体系反馈,笔者已安装相应步伐。假如读者还未安装,请使用 APT 安装:
sudo apt-get install build-essential devscripts
[*]为 APT 包管理工具添加 PPA 源
[*]起首找到相应软件的 PPA 源,通常这个网址由开辟者提供。笔者在 Neovim/INSTALL.md 中找到了俩个 Neovim 开辟者提供的 PPA 源:
https://launchpad.net/~neovim-ppa/+archive/ubuntu/stable
https://launchpad.net/~neovim-ppa/+archive/ubuntu/unstable
[*]确认基于当前 Debian 版本的 Ubuntu 版本:
使用 lsb_release -a 来确认当前 Debian 版本$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm可见笔者使用的是 Debian 12 Bookworm。
[*]确认基于 Debian 版本的 Ubuntu LTS 版本:
通过搜索,笔者确认到基于 Debian 12 的 Ubuntu LTS 版本是 22.04 LTS Jammy Jellyfish (见文末 ref 2)
[*]在 Ubuntu PPA 网址上确认对应版本的源,见下图:(以此中一个 PPA 源举例)
https://img2024.cnblogs.com/blog/3292156/202412/3292156-20241210140917001-1540866637.png#pic_left
可见与 22.04 LTS Jammy Jellyfish 对应的 PPA 源为:deb https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu jammy main
deb-src https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu jammy main
[*]在 /etc/apt/sources.list.d/ 文件夹下新建一个 neovim.list 文件,并将上述找到的 PPA 源放入此中,以下为笔者创建的文件内容:# The stable version of Neovimdeb https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu jammy maindeb-src https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu jammy main# The unstable(latext) version of Neovimdeb https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu jammy main
deb-src https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu jammy main
[*]导入 PPA Fingerprint
[*]找到 PPA Fingerprint,通常由网址提供,见下图为例:
https://img2024.cnblogs.com/blog/3292156/202412/3292156-20241210142428224-1495861005.png#pic_left
[*]将提供的 Fingerprint 参加钥匙链
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FINGERPRINT$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 9DBB0BE9366964F134855E2255F96FCF8231B6DD
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.zlWaQV2Bs7/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 9DBB0BE9366964F134855E2255F96FCF8231B6DD
gpg: key 55F96FCF8231B6DD: public key "Launchpad PPA for Neovim PPA Team" imported
gpg: Total number processed: 1
gpg: imported: 1
[*]更新 APT 源,查看可下载的软件包,并指定最新版本下载
[*]使用 sudo apt-get update 进行更新$ sudo apt update
Ign:1 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm InRelease
Ign:2 https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu jammy InRelease
Hit:3 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm-updates InRelease
Hit:4 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm-backports InRelease
Hit:5 https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security InRelease
Hit:1 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm InRelease
Hit:2 https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu jammy InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.这里出现了一个 Warning, 笔者在文末会将其处理。
[*]使用 apt policy PACKAGE 来检查可安装的软件包$ apt policy neovim
neovim:
Installed: (none)
Candidate: 0.10.0~ubuntu1+git202411301226-c33ec2d7ce-971e32c878-151a855c1b~ubuntu22.04.1
Version table:
0.10.0~ubuntu1+git202411301226-c33ec2d7ce-971e32c878-151a855c1b~ubuntu22.04.1 500
500 https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu jammy/main amd64 Packages
0.7.2-7 500
500 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm/main amd64 Packages
0.7.2-3~bpo22.04.1~ppa1 500
500 https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu jammy/main amd64 Packages
可见上述在不同的源中,可以安装不同版本的 Neovim。
当前 APT 会安装的版本会显示在 Candidate 那一行。
因此,只需使用 sudo apt-get install neovim, 就会自动下载来自 Ubuntu PPA 的最新版本。
假如想要安装其他版本,需要更改 APT 中源的优先级,请读者另行搜索。
[*]扫除 apt-key deprecation 告诫,请见 ref 3,答主给出了相称具体的步骤。
ref:
[*]LinuxConfig.org: Install Packages From An Ubuntu PPA On Debian Linux
[*]AskUbuntu.com: Debian version on which Ubuntu version is based on, by Jacob Vlijm
[*]AskUbuntu.com: fix apt-key deprecation warning, by Heynnema
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]