Using Debian is fine when you are looking for stability and don’t necessarily need the latest version of each application or service. But if for some reason, you want to install a more recent one, it’s not really intuitive. In this tutorial, I will explain how to install the latest version of GNOME, but it works the same way for any package.
The latest version of GNOME is not available in the default repository, only in the unstable one. To install it on Debian, the apt command can be used only once the unstable repository has been added in the “sources.list” file.
Don’t worry, I’ll give you all the commands to safely add it to your system. We’ll configure it to only use the unstable repository for GNOME packages or when explicitly requested in the apt command.
Prerequisite: Do your system updates
As before any new project or service installation, the Debian system needs to be updated first. This will avoid any issues later on, especially with package versions unavailable.
- Open a terminal.
- Either use root or sudo, depending on your system settings.
You can generally switch to root with this command:
Or if you only have the sudo privilege, add the prefix “sudo” to each command I give in this tutorial:
- Sync the repository packages versions with:
- Upgrade the packages that need an update:
It will require more or less time depending on how often you usually do it. Once done, you can move to the next step.
Note: if you are trying to follow this tutorial on a minimal Debian installation (without any desktop interface), the easiest way would be to use “tasksel” first to install the current GNOME version, and then continue this procedure to update it. There are many requirements for GNOME and “tasksel” will install all of them for you:
Add the unstable repository to your sources.list
What “unstable” really mean?
The current version of GNOME on Debian 11 at the time of writing is 3.38, which is almost 2 years old:
Since then, many other versions have been released, the latest one is Gnome 43 at the time of writing.
Hopefully, GNOME 43 is available in the Debian repository, but only on the “unstable” server. As you may already know, a new version for any package moves this way:
experimental => unstable => testing => stable
So, unstable is not necessarily something you would use on a server or on a critical setup. But we are talking of a big project (GNOME) that has been around for at least 6 months, so most bugs are already fixed, and most distributions are using it by default, so it’s not really risky if you are mainly using your Debian PC for desktop usage.
Add the unstable repository to your packages sources
Anyway, here is how to add the unstable repository on Debian:
- Open the sources.list file with your favorite text editor, for example:
nano /etc/apt/sources.listRemember to use sudo or an administrator terminal for doing this.
- Add these lines at the end of the file:
deb http://deb.debian.org/debian/ unstable main contrib
deb-src http://deb.debian.org/debian/ unstable main contrib
- It should look something like:
- Save and exit (with nano: CTRL+O, CTRL+X).
Don’t do the system updates for now, or it will update everything from the unstable repository.
Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember and a free downloadable cheat sheet so you can have the commands at your fingertips.
Adjust the preferences
By default, apt will check the latest version available on all the servers configured in sources.list, and download the most recent one for each package on the system. We don’t want that, we only want to use the unstable repository for GNOME.
To fix this, you can configure the apt behavior by editing one file:
- Open the apt preferences file:
nano /etc/apt/preferencesIf the file doesn’t exist, we’ll create it.
- Paste these lines in it:
Pin: release a=bullseye
Pin: release a=unstable
As you can see, with set a priority for each repository.
As 500 is higher than 100, apt will use the bullseye repository first, and the unstable one only if there is the package you want to install is not available in the main one. This way, you won’t receive all the updates from the unstable server with the next command.
- Your file should look like this:
- You can now sync the repositories again with:
We are now ready to use apt and tell it to get the packages from the unstable servers when specified in the command.
Install the latest GNOME version on Debian
After setting up the unstable repository in the sources.list file and preferences file, apt can be used to install the latest GNOME version on Debian. The exact command to do this is:
apt -t unstable install gnome-session gnome-shell gnome-backgrounds gnome-applets gnome-control-center mutter gjs
The “-t unstable” parameter tells apt to use the unstable repository to get these packages. This way, we’ll get the latest version. You can also use it with the search option to see which version would be installed, for example:
As you can see, gnome-session-bin version is 3.38 by default and 43.0 in the unstable repository. That’s why we use the unstable server for this installation.
The command may take a while to complete, as there are a lot of packages to download and install. Be patient. During the installation, you may be prompted to answer a few questions, press “q” to exit the update notes, and you can accept to restart all services if there is nothing critical on your system:
Once the installation is completed, you need to restart your system to start Debian with the latest GNOME version. You may also need to update other packages, depending on the ones you use. Use the same command as previously to install them from the unstable repository. For example:
apt -t unstable install gnome-tweaks
That’s it, GNOME is now installed on my Debian 11 system, you can use screenfetch to check the exact version:
If you are looking for exclusive tutorials, I post a new course each month, available for premium members only. Join the community to get access to all of them right now!
Keep GNOME up-to-date
To install the latest GNOME version, we had to get the packages from the unstable repository, by explicitly adding the “-t” parameter to the “apt install” command. The issue with this is that your system updates will never get the new versions from the unstable servers unless you run the same command again regularly.
This is not optimal. You can edit your preferences file to tell apt to upgrade the packages we installed from the unstable server only. For example, you can use something like:
Package: * Pin: release a=bullseye Pin-Priority: 500 Package: * Pin: release a=unstable Pin-Priority: 100 Package: gnome-session Pin: release a=unstable Pin-Priority: 1000 Package: gnome-backgrounds Pin: release a=unstable Pin-Priority: 1000 Package: gnome-applets Pin: release a=unstable Pin-Priority: 1000 Package: gnome-control-center Pin: release a=unstable Pin-Priority: 1000 Package: mutter Pin: release a=unstable Pin-Priority: 1000 Package: gjs Pin: release a=unstable Pin-Priority: 1000
You set a higher priority for the package we installed manually, telling apt to use the unstable repository for these packages when it checks for new versions. This way, when you do your regular “apt update/upgrade”, GNOME will also be updated with the new fixes and features updates.
- Open the preferences file:
- Paste the lines given above.
Feel free to add any package you installed manually from the unstable server. Add a new paragraph for each of them, as in my example.
- Save and exit (CTRL+O, CTRL+X).
- Update your repository list with:
That’s it, you can now use the latest GNOME version on your Debian system (which is GNOME 41 at the time of writing). I hope this article was useful, and remember that you can do the same thing for any application:
- Use the search command to see which version is available in each repository.
- If you are confident to try the latest version, add the “-t unstable” parameter to your apt command.
Just remember to also update the related package (in my PHP example, updating packages like php-curl or php-gd if you use them is probably a good idea to avoid any issue).
Overwhelmed with Linux commands?
My e-book, “Master Linux Commands”, is your essential guide to mastering the terminal. Get practical tips, real-world examples, and a bonus cheat sheet to keep by your side.
Grab your copy now.
If you just want to hang out with me and other Linux fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.
Need help building something with Python?
Python is a great language to get started with programming on any Linux computer.
Learn the essentials, step-by-step, without losing time understanding useless concepts.
Get the e-book now.