Introduction

Debian 11 installation can be cumbersome for new Linux users, especially if one plans to use Debian 11 as a main OS to deliver a fully functional desktop environment. This page includes the main steps I prefer as a chemistry professor, while keeping in mind the efficiency of the OS, such as its availability for technical writing, common data analysis tools, and cost-free options.

Motivation

On August 1, 2022, during CHEM 102 lecture break, I had a conversation with my student on how Linux OS can be efficient for scientific studies. I love Linux OS just because it is free, stable, and there is significant amount of open-source software available for scientific community. Thus, I hope this page would be helpful for my students, who is willing to try and see a major Linux distro: Debian 11. Too, I will be using this page for my new installations to speed up the process.

Steep Learning Curve

When it comes to switching to a new operating system (OS), it naturally means a steep learning curve. However, learning Linux OS will definitely be a self-rewarding effort. In my experience, I discover new software in Linux environment and try to locate an alternative version for Mac OS or Windows OS (i.e. as office computer alternatives). You can achive many basic tasks in a Linux desktop as a beginner, too.

Main Installation

Downlad latest firware version of Debian: https://cdimage.debian.org/images/unofficial/non-free/images-including-firmware. This link includes non-free firmware to make things easier on some systems requiring proprietary but redistributable firmware. See http://wiki.debian.org/Firmware for more details.

This download will be an .ISO image file and requires about 4 GB space. Make a bootable USB drive. balenaEtcher could be very handy in this step.

Post-Install Instructions

Add user to sudoers file

Enter root shell by typing SU In the Terminal/Konsole.

Verify that sudo is installed:

sudo apt install sudo

Edit sudoers file:

sudo nano /etc/sudoers

Add your user below %sudo

# Allow members of group sudo to execute any command
%sudo	ALL=(ALL:ALL) ALL
matt    ALL=(ALL:ALL) ALL

Enable Contrib and Non-Free Packages

Open main software properties menu using terminal/konsole:

sudo software-properties-kde

Enable all listed options containing MAIN, CONTRIB, NON-FREE

If you installed Debian from a pre-built ISO you may need to disabled the CDROM: Repository to avoid errors. To do this use the OTHER SOFTWARE tab and make sure cdrom: is NOT checked.

To enable Update checking, go to the UPDATES tab and enable Check for update. As well as any other update options you desire.

Adding Backports Repository (Optional)

To install an application from the backports repository, you must first add the repository to your system.

sudo nano /etc/apt/sources.list

Go to the end of the file and paste the below lines:

deb http://deb.debian.org/debian/ bullseye-backports main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye-backports main contrib non-free
sudo apt update

To install an application from the backport repository, you must specify the source of the package in terminal/konsole.

sudo apt -t bullseye-backports install <package name>

Enable 32-bit Package Downloads (Required for some applications)

sudo dpkg --add-architecture i386
sudo apt update

Find Fastest Mirrors (Optional)

Install netselect-apt:

sudo apt install netselect-apt

Run command:

netselect-apt

A list of mirrors ranked by speed will be places in your home directory Copy this list to /etc/apt/sources.list

Refresh package index:

sudo apt-get update

Snap and Flatpak Packages

Enable support for Snap and Flatpak packages in the Discover package manager:

sudo apt install plasma-discover-backend-snap
sudo apt install plasma-discover-backend-flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Changes will take effect after rebooting the system.

Basic Package Installers

sudo apt install synaptic

For Gnome/GTK Desktops use gdebi:

sudo apt install gdebi

For KDE/QT Desktops use qapt installer:

sudo apt install qapt-deb-installer
sudo apt install qapt-utils

Caution: qapt sometimes fails to install necessary dependencies.

Non-free Codecs and Other Media Components (Optional)

These must be installed seperatly to avoid errors/conflicts.

sudo apt install ffmpeg
sudo apt install libavcodec-extra
sudo apt install ttf-mscorefonts-installer
sudo apt install libdvdcss2
sudo apt install libdvd-pkg
sudo dpkg-reconfigure libdvd-pkg
sudo apt install ffmpegthumbnailer
sudo apt install ffmpegthumbs
sudo apt install gstreamer1.0-plugins-bad
sudo apt install gstreamer1.0-plugins-ugly
sudo apt install gstreamer1.0-libav
sudo apt install gstreamer1.0-tools
sudo apt install gstreamer1.0-vaapi
sudo apt install tumbler-plugins-extra
sudo apt-get install kdegraphics-thumbnailers

Install Linux Firmware and Base Packages

sudo apt install firmware-linux firmware-linux-nonfree firmware-misc-nonfree
sudo apt install linux-headers-$(uname -r) dkms

Use the isenkram-cli package to auto-install missing firmware requested by Kernel.

sudo apt install isenkram-cli
sudo isenkram-autoinstall-firmware

Utility Applications

sudo apt install rar unrar p7zip-rar

Fix QT Themeing on GTK based Desktops

sudo apt install qt5-style-plugins
echo "export QT_QPA_PLATFORMTHEME=gtk2" >> ~/.profile

Reboot.

Install Nvidia Drivers

Only use if you have Nvidia Hardware.

sudo apt install nvidia-detect
nvidia-detect

Install the recommended driver shown. Example:

sudo apt install linux-headers-$(uname -r) nvidia-legacy-340xx-driver

Create an Xorg configuration for your gpu.

mkdir /etc/X11/xorg.conf.d
nano /etc/X11/xorg.conf.d/20-nvidia.conf

Now add below contents to the file and save.

Section "Device"
Identifier "My GPU"
Driver "nvidia"
EndSection

Reboot.

WiFi

Install and enable all Wifi Functions for Broadcom WiFi.

The default non-free firmware only gives you basic functionality. To get the most out of your Brodcom WiFi chip, install the following firmware packages.

sudo apt install broadcom-sta-dkms broadcom-sta-common firmware-brcm80211

Reboot.

Install Bluetooth Packages

sudo apt install bluetooth bluez bluez-firmware bluez-cups bluez-tools firmware-atheros firmware-iwlwifi pulseaudio-module-bluetooth pulseaudio-module-zeroconf

Reboot.

Install Virt-Manager/QEMU Virtual Machine Manager

Install on HOST:

sudo apt install qemu qemu-system qemu-kvm libvirt-daemon libvirt-clients bridge-utils virt-manager libvirt-daemon-system virtinst qemu-utils virt-viewer spice-client-gtk gir1.2-spiceclientgtk-3.0 gir1.2-spiceclientglib-2.0 ebtables
sudo virsh net-start default
sudo virsh net-autostart default
sudo modprobe vhost_net
sudo usermod -G libvirt -a $USER
sudo usermod -G kvm -a $USER

Install on Linux GUEST:

sudo apt install spice-vdagent xserver-xorg-video-qxl xserver-xspice libspice-protocol-dev qemu-guest-agent

For Windows GUEST:

Install virtio-win-guest-tools.exe, virt-viewer, and UsbDk. See the following documentation for instructions.

Installing Virtualbox on Supported Hardware

sudo apt install gnupg2
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian bullseye contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt update
sudo apt install linux-headers-$(uname -r) dkms
sudo apt install virtualbox-6.1
sudo gpasswd -a $USER vboxusers

Download Guest Additions here: https://www.virtualbox.org/wiki/Downloads

Improve Font Rendering in Debian (Optional)

Show hidden files in file manager.

Create file /home/user/.fonts.conf.

Copy and paste the following text into file:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <match target="font">
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hinting">
   <bool>true</bool>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hintstyle">
   <const>hintslight</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="antialias">
   <bool>true</bool>
  </edit>
 </match>
  <match target="font">
    <edit mode="assign" name="lcdfilter">
      <const>lcddefault</const>
    </edit>
  </match>
</fontconfig>

Reboot.

Open KDE Settings as Root

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dbus-launch systemsettings5

Hide Partitions on Boot (Optional)

Create a new file /etc/udev/rules.d/99-hide-partitions.rules and add one line per partition you want to hide like so: (change “sda*” to match the partition you wish to hide)

KERNEL=="sda1",ENV{UDISKS_IGNORE}="1"
KERNEL=="sda2",ENV{UDISKS_IGNORE}="1"

You should be able to dynamically activate it as root:

# udevadm trigger --verbose

Backup / Restore installed APT packages

Backup your packages list to your home directory. Get a packages list:

dpkg --get-selections > ~/Package.list

Copy list of repositories to your home directory:

sudo cp /etc/apt/sources.list ~/sources.list

Export repo keys to your home directory:

sudo apt-key exportall > ~/Repo.keys

Restore packages from your home directory:

sudo apt-key add ~/Repo.keys
sudo cp ~/sources.list /etc/apt/sources.list
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install dselect
sudo apt-get install $(cat ~/Package.list | awk '{print $1}')

Please note that if SUDO is not configured, simply use root terminal or SU.

CRITICAL: Any packages installed using a .DEB file or other source not included in your repositories/sources.list, must be removed from Package.list before restoring to avoid errors. These packages will need to be reinstalled manually.

Install microcode

Microcode is CPU firmware that controls how the processor works. It’s recommended to have the latest microcode to improve your CPU workings.

Open Synaptic Package Manager > Search for microcode > Install either intel-microcode or amd-microcode depending on your CPU.

Configure Swappiness

Decreasing swappiness value is one of the best ways to improve the performance of your system. This forces your Linux system to use RAM, instead of the hard drive. For those of you unfamiliar with Linux swap, check out our post on Linux swap.

Check the current swappiness value by executing:

cat /proc/sys/vm/swappiness
# 60 (default)

Open /etc/sysctl.conf file as an administrator:

sudo nano /etc/sysctl.conf

At the end of the file, add vm.swappiness=10 which will reduce swap usage.

Press CTRL + O to save changes and CTRL + X to exit the nano editor.

Reboot.

Install Firewall

Although there are not many viruses for Linux, it’s advisable to have a firewall that protects against network intrusions.

sudo apt install ufw
sudo ufw enable

We also have a dedicated post on the firewall in Linux so make sure to check it out for more advanced usage.

Install BackUp Program

BackUp programs are often overlooked. That is also the case with Debian 11 which doesn’t have backups by default. I always back up my system and good backups have saved me a few times!

Timeshift is the gold standard for system backups in Linux. It’s also very easy to install and configure.

Open Software Center > Search for Timeshift > Click Install

Upon opening the Timeshift, you’ll probably notice the Wizard button in the top right side of the app. As the name suggests, this is a user-friendly way of configuring backup.

Run Wizard and follow these steps:

  1. Snapshot Type: Select RSYNC
  2. Snapshot Location: Select the disk where you would like your snapshots to be stored.
  3. Snapshot Levels: You can choose how many snapshots Timeshift will perform/store on a monthly, weekly, daily, hourly and boot basis.
  4. User home directories: Allows you to decide which folders Timeshift will back up. You should prioritize your home directory, but depending on your space, it won’t hurt to include /root directory as well.

That’s it for Timeshift! In case you accidentally lose your data, open Timeshift, click Restore, select a snapshot that contains the files that you would like to recover and that’s it!

References

  1. Matthew Moore - Tech Café. Things you should do after installing Debian 11 KDE. Retrieved on 8/3/2022.
  2. Average Linux User. 20 Essentials Things to Do After Installing Debian 11. Retrieved on 8/3/2022.