How to add Debian testing package

2022/10/10に公開約2,800字

Debian is Powerfull and Stable Distribution, but debian apt package is too old.

ex) npm, golang and etc...

If you know how to add debian testing package,

debian testing using latest package.

background knowledge

Debian testing is next Debian stable version.
When Debian 11 is stable, Debian 12 is testing.

debian is given a codename and supplied security-update when it becomes testing version.

When manipulating the repository, you can use either testing or codename.

The current Debian Testing codename is bookworm.

add sourcelist

add package sourcelist for debian testing.

/etc/apt/source.list
# deb cdrom:[Debian GNU/Linux 11.5.0 _Bullseye_ - Unofficial amd64 DVD Binary-1 with firmware 20220910-10:40]/ bullseye contrib main non-free

deb http://ftp.jaist.ac.jp/debian/ bullseye main non-free contrib
deb-src http://ftp.jaist.ac.jp/debian/ bullseye main non-free contrib

# add testing version
deb http://ftp.jaist.ac.jp/debian/ testing main non-free contrib
deb-src http://ftp.jaist.ac.jp/debian/ testing main non-free contrib

deb http://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src http://security.debian.org/debian-security bullseye-security main contrib non-free

# add testing version
deb http://security.debian.org/debian-security testing-security main contrib non-free
deb-src http://security.debian.org/debian-security testing-security main contrib non-free

# bullseye-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb http://ftp.jaist.ac.jp/debian/ bullseye-updates main contrib non-free
deb-src http://ftp.jaist.ac.jp/debian/ bullseye-updates main contrib non-free
deb http://ftp.jaist.ac.jp/debian/ testing-updates main contrib non-free
deb-src http://ftp.jaist.ac.jp/debian/ testing-updates main contrib non-free

"testing" also works as "bookworm".

add apt preference

apt preference decided to priority repository.

If you set Pin-Priority minus number, that repository will never to be used.

So you can use the minus number first, and raise the priority only for packages you want to use later.

/etc/apt/preferences.d/testing.pref
# generally, don't use testing package
Package: *
Pin: release a=testing
Pin-Priority: -1


Package: golang
Pin: release a=testing
Pin-Priority: 999

Package: npm
Pin: release a=testing
Pin-Priority: 999

If you using debian codename, "Pin: release a=testing" to "Pin: release n=bookworm".

Since packages with dependencies will also be updated by testing, the impact should be kept as small as possible.

let's install package you want to use

# update repository and package list.
sudo apt update

# install testing package.
# -t is repository detected.
sudo apt install -t testing golang
sudo apt install -t testing npm

Discussion

ログインするとコメントできます