1. Who is this for?
2. Advantages and drawbacks of Debian
3. Installation
3.1 Checksum
3.2 Make a bootable USB-stick
3.3 Disk encryption
3.4 Desktop environments
3.5 Fix boot to black screen
4. Post install
4.1 Getting a functional system
4.1.1 Sources.list
4.1.2 Autoinstall firmware
4.1.3 Graphics
4.1.4 Install software
4.1.5 Containerized applications
4.2 Various tweaks
4.2.1 Add more users
4.2.2 Add a user to sudo
4.2.3 SSD optimization
4.2.4 Enable TRIM
4.2.5 Font Rendering
4.2.6 Improve your laptop’s battery life
4.2.7 Night Colors
4.2.8 Fix non-working plasmoids
4.2.9 Use Bluetooth loudspeakers with PulseAudio
4.3 Web browsing
4.3.1 Add GPU acceleration in Firefox
4.3.2 Addons
4.4 Add a printer
4.5 Advanced system tweaks
4.5.1 Swappiness
4.5.2 Cache Pressure
4.5.3 ZRam
4.5.4 Change GRUB timeout
4.5.5 Check for other operating systems
4.6 Security
4.6.1 Updates
4.6.2 Firewall
4.7 Backup
4.8 Upgrade to trixie
5. Useful external resources
1. Who is this for?
This guide is primarily intended for beginners, although it does assume some basic familiarity with GNU/Linux. You don't need prior experience with Debian to follow along. Additionally, this guide includes valuable tips for more experienced users who want to quickly configure a functional desktop environment.
My aim is for each step to benefit the majority of users in the intended audience. Please note that this guide is designed for Debian bookworm, and it may not be compatible with other Debian versions.
2. Advantages and drawbacks of Debian
Debian is an exceptional operating system, though not without its trade-offs.
Advantages
1. Debian is the second-oldest surviving distro, boasting a strong developer base, ensuring ongoing support and improvements.
2. Debian It supports all major desktop environments, giving users freedom in customizing their experience.
3. Debian's software is tested, stable, and backed by a vast repository, ideal for production systems.
4. Debian has a dedicated security team that actively monitors and addresses security vulnerabilities.
5. Debian excels in smooth, hassle-free upgrades between stable versions, reducing maintenance time.
Drawbacks (may) include
1. Debian prioritizes stability over the latest features, potentially disappointing users seeking cutting-edge software.
2. Debian's commitment to FOSS principles and systemd usage may not align with everyone's preferences.
3. The release cycle is relatively slow compared to many other GNU/Linux distributions.
4. Debian may have a steeper learning curve compared to some other distributions.
Note: Debian bookworm's installation images includes non-free firmware by default, addressing some of the limitations related to non-free software in previous versions. There is more info on this subject here: https://wiki.debian.org/Firmware
So is Debian for you? Debian is what you install if you just want your computer to work flawlessly for years and don't mind your software to be a couple of versions behind..
https://wiki.debian.org/WhyDebian
Why not just install Debian testing, you say? Debian testing is, well, you probably guessed it, the testing branch. It is not a rolling release version of Debian, but a testing environment meant to support the next stable release.
3. Installation
A Debian installation on incompatible hardware is a nightmare, while running it on compatible hardware is a breeze, so you may want to check it your system is compatible by running a LiveDVD from here: https://get.debian.org/images/release/c ... so-hybrid/
Generally, I have never had a problem with all-Intel hardware that is at least a couple of years old.
If everything works, I prefer to use the netinstall: https://cdimage.debian.org/debian-cd/cu ... 64/iso-cd/ This image should work for the vast majority of computers.
3.1 Checksum
Make sure that the checksum for your downloaded image is correct. If not, you may encounter issues during installation.
In order to check a downloaded iso from the command line interface, one can issue the following command (as regular user):
Code: Select all
sha512sum debian-12.1.0-amd64-netinst.iso
3.2 Make a bootable USB-stick
If you have a USB stick with enough space and a previous GNU/Linux-install, you can plug the USB stick into your computer and type the following command (as root or sudo) to list your devices:
Code: Select all
fdisk -l
Code: Select all
Disk /dev/sdb: 7.5 GiB, 8053063680 bytes, 15728640 sectors
Disk model: ProductCode
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 15726591 15724544 7.5G 7 HPFS/NTFS/exFAT
In order to make a bootable iso, I can just copy the iso to the unit:
Code: Select all
root@debian:/home/hallvor# cp debian-12.1.0-amd64-netinst.iso /dev/sdb
Code: Select all
root@debian:/home/hallvor# sync
Bookworm's comprehensive installation guide can be found here: https://www.debian.org/releases/stable/installmanual
Here is a video of an actual installation: https://www.youtube.com/watch?v=rf3EN7e-34g
3.3 Disk encryption
For any portable device, I strongly recommend selecting LUKS disk encryption in the installer. Overwriting the entire disk can be skipped. This will allow for a faster installation and reduced wear on storage media. However, it may also leave remnants of previous data on the drive, potentially introducing security and privacy risks.
3.4 Desktop environments
It is a good idea to do a little research before deciding for a desktop environment. Here is a comparison from 2023: https://itsfoss.com/best-linux-desktop-environments/
If you want a solid desktop environment for an older computer, the Trinity Desktop Environment (TDE) is a good option: https://wiki.trinitydesktop.org/Debian_ ... structions
3.5 Fix boot to black screen
When the installation is finished, you may be unfortunate enough to boot to a black screen, you may want to pass the nomodeset option on the kernel command line to boot into "fallback graphics" mode.
Once in the GRUB menu, use the arrow keys to select the Debian entry you want to boot into. (Do not press enter.)
Press the "e" key to edit the GRUB command line, and then look for a line start starts with "linux" or "linuxefi". The line will usually end with "quiet" and "splash", like this
Code: Select all
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Code: Select all
GRUB_CMDLINE_LINUX_DEFAULT="nomodeset quiet splash"
You should now be able to boot into your desktop and install a graphics driver. Please note that this is a temporary way to boot to the desktop and not a permanent solution.
If you for some reason need to use nomodeset on a permanent basis, just
Code: Select all
# nano /etc/default/grub
Finally update GRUB with the following command:
Code: Select all
# update-grub
4. Post install
Please don't blindly copy and paste the commands below. It is probably a good idea to think twice.
The commands are divided in two categories:
$ means that the command should be issued as regular user
# means that the command should be issued as root or with sudo. (If you created a root password during install, sudo will not work out of the box.)
You switch from your regular user to root with su -:
Code: Select all
su -
4.1 Getting a functional system
Debian's main source of software is determined by sources.list. It is a configuration file determining what and from where software can be fetched. Non-free firmware should be included for your hardware when needed, so not all steps below may be necessary.
4.1.1 Sources.list
You can edit sources.list by issuing the following command:
Code: Select all
# nano /etc/apt/sources.list
Code: Select all
#deb cdrom://[Debian GNU/Linux 12.0.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20230610-10:23] bookworm Release
Code: Select all
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
#deb-src http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
#deb-src http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
#deb-src http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
Save and exit with Ctrl-x, and then y to confirm.
Update your sources.list and apply updates
Code: Select all
# apt update && apt upgrade
4.1.2 Autoinstall firmware
Firmware should be automatically loaded for your system, but if you suspect anything is missing when you run
Code: Select all
# dmesg | grep -i firmware
Code: Select all
# apt install isenkram-cli
Code: Select all
# isenkram-autoinstall-firmware
4.1.3 Graphics
Intel GPUs don't need any extras to work, but Nvidia and AMD/ATI may need some extra firmware. This may already be installed on your computer automatically during install.
NVIDIA
For support of GeForce 600 series and newer GPUs (supported devices). For older devices, you must use nouveau, which should be already installed and in use.
Code: Select all
# apt install linux-headers-amd64 && apt install nvidia-driver firmware-misc-nonfree
AMD/ATI
AMD/ATI is generally easier to deal with than Nvidia. Please read this: https://wiki.debian.org/AtiHowTo
4.1.4 Install additional applications
No package manager is needed to install applications. You can easily search for and install applications using apt.
Code: Select all
# apt search nameofpackage
Code: Select all
# apt install nameofpackage
You can also install package managers like Discover (KDE) or Synaptic, if they are not already installed.
4.1.5 Packages from outside the repository
A word of caution. Never ever install packages from distros like Ubuntu or its PPAs. Never ever install packages from Debian Testing or Debian Sid. You will probably end up breaking your install:https://wiki.debian.org/DontBreakDebian
If you need more recent software, use backports (but keep in mind that this is not as well tested as the software in the respository): https://backports.debian.org/Instructions/
If it is not found in backports, you can try containerized applications. If you still can't find what you are looking for, ask in the forum for a solution. A little word of advice: Your question may have been answered before, so please use a search engine and use the forum search before asking.
If you are new to GNU/Linux and would like to find native counterparts to your trusty Windows-applications, you may want to read this: https://www.linuxalt.com/
4.1.5 Containerized applications
Flatpaks, Appimages and Snaps and are containerized applications, which means that they are bundled with all the necessary dependencies, libraries, and runtime environments needed to run the application. This helps in avoiding compatibility issues and conflicts with system libraries. The tradeoff is increased disk space usage, higher CPU and RAM usage and less tested software. For these reasons I suggest only using these as a last resort.
AppImages
Setting up and using AppImages is very straightforward. Just download the AppImage, make it executable and click on it.
Get AppImages here: https://www.appimagehub.com/
Once you have downloaded an AppImage, make it executable with chmod, for instance
Code: Select all
$ chmod +x Firefox.AppImage
Flatpaks
Code: Select all
# apt install flatpak
Gnome users can install flatpak support with a plugin
Code: Select all
# apt install gnome-software-plugin-flatpak
Add the Flatpak repository
Code: Select all
# flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
You can install flatpaks through the command line interface or through a web browser.
To install a newer version of Gimp, you can issue the following command:
Code: Select all
# flatpak install org.gimp.GIMP
To update all flatpaks on your system
Code: Select all
# flatpak update
List all flatpaks on your system
Code: Select all
# flatpak list
To remove a flatpak, for instance
Code: Select all
# flatpak remove org.gimp.GIMP
Snap
Install Snap
Code: Select all
# apt install snapd
Code: Select all
# systemctl enable snapd && systemctl start snapd
Check that Snap is running and working
Code: Select all
# snap version
To search for snaps, type for instance:
Code: Select all
# snap find vlc
Code: Select all
# snap install vlc
To list your Snaps:
Code: Select all
# snap list
Code: Select all
# snap remove vlc
4.2 Various tweaks
Below are some common tweaks you may find useful.
4.2.1 Add more users
If multiple users will use the same computer, it is highly recommended to create separate user accounts. Each user can then seamlessly share the same computer with different customization.
You can add new user in KDE in Systemsettings → Manage users → Add user
It is of course also possible to create a new user account from the command line with the following syntax: adduser nameofuser. Issue the following command to add hallvor as user:
Code: Select all
# adduser hallvor
If you want to delete this user completely, just type (as root)
Code: Select all
# deluser --remove-home hallvor
If you set a root password during install and still would like to use sudo, you can add yourself to sudo using adduser <username> sudo. In my case that is:
Code: Select all
# adduser hallvor sudo
Code: Select all
$ id hallvor
Add noatime: If you use an SSD, there are certain things to optimize the performance:
Code: Select all
# nano etc/fstab
Code: Select all
/dev/mapper/debian--thinkpad--vg-root / ext4 errors=remount-ro,noatime 0 1
Save and exit.
4.2.4 Enable TRIM
Fstrim is used on a mounted filesystem to discard/trim blocks which are not in use by the filesystem.
Code: Select all
# systemctl enable fstrim.timer
# systemctl start fstrim.timer
Code: Select all
# systemctl list-timers --all
Further SSD optimization is found here: https://wiki.debian.org/SSDOptimization
4.2.5 Font rendering
One of the first things I do is altering the font rendering. First we’ll install liberation fonts. These are metrically identical to Microsoft fonts, so they should yield the same result.
Code: Select all
# apt install fonts-liberation2
Code: Select all
# apt install ttf-mscorefonts-installer
GNOME fonts can also be adjusted in the GUI.
If you are not running a desktop environment with GUI options, you can use the following command:
Code: Select all
# dpkg-reconfigure fontconfig fontconfig-config
4.2.6 Improve your laptop’s battery life
This is very straight forward. TLP will have good default settings, so no tweaking should be necessary. If you already have laptop-mode-tools installed, TLP will conflict with it, so you must not have both installed at the same time.
Run the following command to remove laptop-mode-tools if installed and install TLP:
Code: Select all
# apt remove laptop-mode-tools && apt install tlp tlp-rdw
Code: Select all
# tlp-stat -s
Code: Select all
# apt install laptop-mode-tools
http://forums.debian.net/viewtopic.php?f=16&t=140768
KDE allows configuring battery charging thresholds directly in System Settings if your hardware allows it.
Reboot when done.
4.2.7Night colors
Night colours are nice if you can’t resist using the computer at night:
KDE:
Open system settings and search for night colours. Tick the checkbox, adjust the settings to your liking and enable.
Gnome:
GNOME should have a native blue light filter called Night Light. It should be found here: Open Settings > Display > Night Light tab > Turn on Night Light
Redshift is a good option for everyone else:
Code: Select all
# apt install redshift redshift-gtk
4.2.8 Fix non-working plasmoids in KDE
On a new installation, KDE may complain about a missing file when adding some plasmoids. To avoid it, run the following command (as root):
Code: Select all
# apt install qml-module-qtquick-xmllistmodel
4.2.9 Use Bluetooth loudspeakers with PulseAudio
In order to play music over Bluetooth with PulseAudio, you need the Bluetooth module for PulseAudio sound server:
Code: Select all
# apt install pulseaudio-module-bluetooth
4.3 Web browsing
Hardware acceleration and addons are are important in web browsing because they enhance functionality and performance.
4.3.1 Add GPU acceleration in Firefox
Note: These steps will make Firefox use GPU acceleration to render web pages and video. This should result in lower CPU usage and smoother scrolling. GPU acceleration may not be compatible with your graphics card, and it may not offer a noticeable improvement on older hardware.
The best way to enable hardware acceleration in Firefox is to set these flags below in about:config
media.ffmpeg.vaapi.enabled true
media.ffvpx.enabled false
Set the environment variable needed:
For X11:
gfx.x11-egl.force-enabled true
Restart Firefox.
For Wayland:
NOTE: This may not be an optimal solution. Please see below: viewtopic.php?p=790303#p790303
Type in your terminal
Code: Select all
echo "export MOZ_ENABLE_WAYLAND=1" >> ~/.profile
Check that it works:
Type "about:support" in the address bar and press Enter.
Scroll down to the "Graphics" section.
Look for the "Compositing" field, which should show "WebRender" if GPU acceleration is enabled.
Also, check the "GPU Accelerated Windows" field, which should show "1/1 Direct3D 12 (OMTC)" if GPU acceleration is enabled.
https://wiki.debian.org/Firefox
4.3.2 Useful browser addons
I highly recommend the following browser addons to block ads and trackers:
Ublock Origin: https://ublockorigin.com/
Privacy Badger: https://privacybadger.org/
4.4 Add a printer
We'll use CUPS (Common UNIX Printing System) to set up printing. Most modern printers are compatible with Debian, but make sure that your printer is supported before purchasing one.
Make sure cups is installed
Code: Select all
# apt install cups
Code: Select all
# systemctl start cups
# systemctl enable cups
Click on the "Administration" tab, then click "Add Printer."
You may be prompted to enter your root password.
Follow the on-screen instructions to add your printer.
If your printer is connected locally via USB, it should be automatically detected.
If your printer is on the network, you'll need to specify its IP address or hostname.
If your printer is not automatically detected, you might need to install additional drivers manually. Refer to the manufacturer's website for Linux drivers.
After adding the printer, you can configure various settings, including the printer's name, description, default paper size, and print quality.
To ensure that the printer is set up correctly, you can print a test page from the CUPS web interface. Go to the "Printers" tab, select your printer, and click "Maintenance" > "Print Test Page."
4.5 Advanced system tweaks
Please don't change these values unless you know what you are doing. The default values are fine for most systems.
4.5.1 Swappiness
Swappiness determins how aggressively the Linux kernel swaps data out of RAM to the swap space. Keeping this number low is a good idea for a desktop system with ample RAM. Only adjust these values if you know what you are doing; the default values will be fine for most systems.
In order keep more data in RAM (and write less to disk), we will change the swappiness value to 10.
You can test a new value with this command:
Code: Select all
# sysctl vm.swappiness=10
Code: Select all
# nano /etc/sysctl.conf
Code: Select all
vm.swappiness=10
4.5.2 Cache pressure
Cache pressure determines how aggressively the kernel reclaims memory from the page cache. Lower values than 100 (maximum) make the kernel more reluctant to free up these cached objects, which can be beneficial for desktop systems with sufficient RAM to keep frequently used files cached in memory.
Do not set the cache pressure to 0, or you will risk running out of memory.
Issue the following command if you want to test a cache pressure of 75.
Code: Select all
# sysctl vm.vfs_cache_pressure=75
Code: Select all
# nano /etc/sysctl.conf
Code: Select all
vm.vfs_cache_pressure=75
4.5.3 Zram
Zram (also known as zswap or zcache) is a feature in Linux that allows you to create a compressed block device in RAM, which can help improve system performance by reducing the need to swap data to slower storage devices like hard drives or SSDs. Zram comes with tradeoffs of its own. You swap less with Zram, but you also use more CPU.
Keep in mind that you should keep cache pressure high if you are short on RAM.
If you have plenty of RAM, there is probably not much point using it.
You can install Zram with the following command:
Code: Select all
# apt install zram-tools
Configure Zram to use the efficient zstd compression algorithm and 25% of available RAM. Then reload the service to apply the changes.
Code: Select all
# echo -e "ALGO=zstd\nPERCENT=25" | tee -a /etc/default/zramswap
# service zramswap reload
Code: Select all
# nano /etc/default/zramswap
If you would like to see the status of ZRam, use the zramctl-command
Code: Select all
# zramctl
Code: Select all
root@debian:~# zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 2,8G 8,8M 962,9K 8,1M 4 [SWAP]
4.5.4 Change the GRUB timeout
The Grub timeout is 5 seconds by default. You can set this at 2 seconds and shave a few seconds from your boot time:
Code: Select all
# nano /etc/default/grub
Save and exit.
4.5.5 Check for other operating systems
Edit /etc/default/grub:
Code: Select all
# nano /etc/default/grub
Code: Select all
#GRUB_DISABLE_OS_PROBER=false
Code: Select all
GRUB_DISABLE_OS_PROBER=false
4.6 Security
Applying timely security updates and protecting your system from unauthorized access are critical for the safety of a Linux system. This manual is highly recommended for further reading: https://www.debian.org/doc/manuals/secu ... ex.en.html
4.6.1 Updates
The system can simply be kept up-to-date by issuing the following commands:
Code: Select all
# apt update
# apt upgrade
Updates can also be automated with unattended-upgrades: https://wiki.debian.org/UnattendedUpgrades
4.6.2Firewall
If you want a basic firewall that blocks incoming traffic while allowing outgoing traffic, one of the easiest ways to administer Debian's Netfilter firewall is by using ufw.
Code: Select all
# apt install ufw
Code: Select all
# ufw enable
# ufw default deny incoming
# ufw default allow outgoing
Code: Select all
# ufw status verbose
Just add the ports you would like to keep open in the text file. Very conventient.
4.7 Back up your system
Any computer user has lost data, or has not lost data *yet*. Fortunately, creating a backup is very easy.
KDE has an integrated backup utility in System Settings.
Timeshift is a different option
Code: Select all
# apt install timeshift
4.8 Upgrade to trixie
You should always read the release notes for the next version before attempting a dist-upgrade: https://www.debian.org/releases/stable/releasenotes Debian trixie will be released some time in 2025, so be patient.
https://www.debian.org/releases/
https://en.wikipedia.org/wiki/Debian_version_history
5. Useful external resources
The Debian GNU/Linux FAQ: https://www.debian.org/doc/manuals/debian-faq/
The most common command line interface commands: https://www.debian.org/doc/user-manuals#refcard
The Debian Wiki: https://wiki.debian.org/
The Debian Reference: https://www.debian.org/doc/manuals/debian-reference/
To file bug reports, use the Mailing Lists: https://www.debian.org/MailingLists/
Here you can reach Debian: https://www.debian.org/contact