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 检查 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 [installed]
使用下述命令检查 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 [installed]
根据系统反馈,笔者已安装相应程序。如果读者还未安装,请使用 APT 安装:
sudo apt-get install build-essential devscripts
为 APT 包管理工具添加 PPA 源
https://launchpad.net/~neovim-ppa/+archive/ubuntu/stable
https://launchpad.net/~neovim-ppa/+archive/ubuntu/unstable
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。22.04 LTS Jammy Jellyfish
(见文末 ref 2)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 Neovim
deb https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu jammy main
deb-src https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu jammy main
# The unstable(latext) version of Neovim
deb https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu jammy main
deb-src https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu jammy main
导入 PPA 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:
参与评论
手机查看
返回顶部