How to add Debian testing package


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.

# 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 bullseye main non-free contrib
deb-src bullseye main non-free contrib

# add testing version
deb testing main non-free contrib
deb-src testing main non-free contrib

deb bullseye-security main contrib non-free
deb-src bullseye-security main contrib non-free

# add testing version
deb testing-security main contrib non-free
deb-src testing-security main contrib non-free

# bullseye-updates, to get updates before a point release is made;
# see
deb bullseye-updates main contrib non-free
deb-src bullseye-updates main contrib non-free
deb testing-updates main contrib non-free
deb-src 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.

# 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