Short guide about how I install and configure Debian. -- Branwell
Find a file
2022-01-03 21:43:38 +01:00
.gitignore Added __pycache__/ to .gitignore 2021-12-28 17:38:22 +01:00
Getting_Debian.md Section "Getting audio to work" written 2022-01-03 21:43:38 +01:00
README.md First commit 2021-12-25 18:27:44 +01:00
update_index.py Added update_index.py 2021-12-28 15:54:08 +01:00

Getting Debian

This is a short guide explaining how I normally install and configure Debian, but someone else may do it differently. It will not teach you things like how to use the command line: it is focused on more specific topics. I recommend that you read each section before starting to do what it says.

Index


Installing Debian

  1. Before starting, backup all the files you want to keep on your next Debian installation. These normally include most of your Home folder, potential configuration files located outside of it, browser bookmarks and emails saved locally. You can use an external drive, like a USB stick, or a cloud service. You can directly copy or upload your files, but it may be more convenient to create a ZIP or TAR archive.

  2. Download the correct ISO from the Debian site. I usually choose a netinst ISO for Debian Stable.1 A netinst ISO is small in size but requires an Internet connection during installation, so you will need an Ethernet cable or a similar method of going online without WiFi. To check your processor architecture you can run dpkg --print-architecture: in my case, it is amd64. Important note: if you do not have an Ethernet cable and plan to use WiFi on your system, consider choosing an ISO with non-free firmware included, as it will be impossible for you to download WiFi drivers later on.

  3. Create an installation medium. For this process you will need an external drive. Please note that all of its content will be overwritten and lost. If you decide to use a USB stick, you can follow this guide on the Arch Wiki.

  4. Power off your computer and make sure its charger is plugged in: it is important that the device does not run out of power during the process. If you have chosen a netinst ISO, connect your Ethernet cable.

  5. Switch on your computer and quickly open the boot options before the operating system starts loading. Usually you can do this by pressing F12, but the actual key may be different on your device. To make sure the key stroke gets recognised, press it three or four times quickly. Select the installation medium instead of the internal hard disk. You should be able to navigate through a list of devices using the arrow keys and confirm with Enter.

  6. A screen with the Debian logo and a list of options should appear. You can choose to proceed with a graphical interface or a command-line one. I recommend the latter. At this point you only have to follow the intructions that appear on the screen. I recommend that you also read this page on the Installation Guide while you go on with the installation. It describes the whole process and explains some important concepts.

About the desktop environment

I like having a minimal operating system, so during the installation I select not to install any desktop environment. However, since I still want a GUI, I later install and configure a window manager, along with all the programs I need. If you prefer an OS that already comes with a full desktop experience and all the programs you need, or if you do not have time to configure Debian, you can select a desktop environment. I like XFCE as it is lightweight, but functional. It provides all the tools I need while remaining simple and usable.


Upgrading to Debian Unstable

At this point, you have installed either Debian Stable or Testing. However, you might want to upgrade to Debian Unstable, which is the version I personally prefer.

To upgrade to Debian Unstable, you have to change the respositories that will be used to download packages. In order to do that, you must change the content of the file located at /etc/apt/sources.list, so run sudoedit /etc/apt/sources.list and enter your password. Alternatively, become root and use your favourite text editor. The file should contain some lines looking more or less like this and other commented lines, namely lines starting with # that are totally ignored:

deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main

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

deb http://deb.debian.org/debian bullseye-updates main
deb-src http://deb.debian.org/debian bullseye-updates main

In the first two lines, replace the code name of the Debian version ("bullseye" for Debian 11) with "unstable". The following two lines must be deleted or commented (I recommend the latter), because they are for security updates, which Debian Unstable never gets. The last lines must be deleted or commented as well. Save the changes (Ctrl+S if sudoedit opened Nano) and close the text editor (Ctrl+X in Nano).

Now run the following commands, either preceding them with the command sudo or logging in as root:

apt update
apt full-upgrade

Finally, reboot the system with systemctl reboot or in the graphical way.

Best practices

  • Only upgrade packages when you have some time to fix pontential problems. Do not upgrade before important events like a presentation or a business trip: your system will break at the worst times!
  • Do not blindly accept the actions proposed by the package manager: make sure they are in line with your wishes and expectations.
  • Avoid apt full-upgrade as it may remove packages you depend on.
  • Install the packages apt-listbugs and apt-listchanges: they will tell you when a package you are about to install or upgrade has bugs or important changes.
  • Backup your system frequently.2

Getting WiFi and Ethernet to work

It is a very common problem that WiFi does not work out of the box after installing Debian. This happens because WiFi often needs non-free, proprietary software, which is not included in the Debian repositories by default. To install the correct drivers and get WiFi to work, follow this guide on the Debian Wiki and the other guides linked in it. First, you must identify your WiFi device, then install the correct drivers, possibly the free ones, and maybe other important packages. After that, I recommend that you disable the non-free repositories, if you had to enable them to install the drivers. This will prevent you from installing other non-free software later. To make sure everything works correctly, reboot your computer either with the command systemctl reboot or graphically. If you are using a desktop environment, you should now be able to manage WiFi through the preinstalled graphical tools. To do it on the command line, use nmcli or nmtui, both included in the package network-manager. NetworkManager may have some problems handling wired networks, though: this is because it does not manage this kind of interfaces by default. To enable them, edit the file /etc/NetworkManager/NetworkManager.conf and change the line managed=false to managed=true. Then, restart NetworkManager with sudo service NetworkManager restart.


Getting audio to work

Sound functions in Debian are provided by the Advanced Linux Sound Architecture (ALSA), which is an essential part of the kernel, almost always in combination with a sound server. If you have installed a full DE, a sound server like PulseAudio, JACK, or PipeWire probably is already present on your system, and audio should work just fine. If you have done a minimal installation and intend to use ALSA alone, though, you may encounter some complications. In case the audio does not work right after your minimal installation, run the command sudo alsactl init to initialize ALSA, then reboot. This should do the trick.

You may also want to install alsa-utils: it includes useful tools to manage audio directly through ALSA. For example, amixer, a command-line mixer that will be especially useful if you have to configure keyboard shortcuts to adjust the volume. Then there is alsamixer, a cool mixer with a semi-graphical interface that works inside the terminal.

Note that some programs depend on a sound server to manage sound. For example, without PulseAudio, Firefox used to give me some problems as it did not receive any input from the microphone. Luckily, there is a nice workaround that does not use PulseAudio and will solve these issues: you can install the package apulse, which is basically a partial PulseAudio emulator for ALSA. It allows you to use programs like Firefox simply by launching them with the command apulse <program>.


Removing default folders from Home

In your Home folder there are some default directories, like Desktop or Pictures. If you do not need them, you may try to remove them. However, they would be recreated automatically after a while. If you want to prevent this, you can delete the folders you do not need and then run xdg-user-dirs-update. The command should tell you that some default folders were removed, and that the corresponding variables now point to your Home directory.


Disabling recent files

I do not really like that my system remembers the recently used files. I think it is a useless feature: just because I have recently opened a file, it does not mean that I want to open it again, does it? If you agree with me, here is how I managed to disable this misfeature. You will have to add the following lines in the file located at ~/.config/gtk-3.0/settings.ini:

gtk-recent-files-max-age=0
gtk-recent-files-limit=0
gtk-recent-files-enabled=0

If these options are already specified inside settings.ini, just change their values to 0. At this point, the problem is not fully solved yet. It is possible that your file chooser still defaults to the Recent folder. To change this behaviour and set your Home folder as the default, add the following lines inside ~/.config/gtk-2.0/gtkfilechooser.ini:

StartupMode=cwd
DefaultFolder=cwd

Again, if the options are already specified, just change their values. The last step is to delete the file ~/.local/share/recently-used.xbel.


Changing GRUB background

GRUB, the boot loader, can be customised to match your preferences. One of the many things you can change is the background splash image you see before the OS starts loading. To do this, you have to change the content of /etc/default/grub. First, set the following options, replacing the tags between < and > with the actual values:

GRUB_GFXMODE=<screen_width_in_px>x<screen_height_in_px>
GRUB_GFXPAYLOAD_LINUX=keep

Then, make sure that the line GRUB_TERMINAL=console is absent, or commented by a # at the beginning. Now, choose your new background image. It must have the following properties to work properly:

  • PNG, JPG or TGA format;
  • resolution equal to that of your screen; this is not essential, but recommended;
  • RGB mode, not indexed, 8-bit.

Now, you can add the line GRUB_BACKGROUND="/full/path/to/image" inside /etc/default/grub, obviously using the real full path. Finally, run sudo update-grub. If everything went well, the output should contain the line Found background image....


Quick adjustments

This section contains short notes about things you might want to do on Debian. Some of them could be further developed in the future.

  • Add this line: export QT_QPA_PLATFORMTHEME="gtk3" to ~/.bashrc to tell Qt to follow, more or less, GTK theme (better than nothing).
  • You can deactivate Bluetooth in the following ways:
    • sudo systemctl stop bluetooth.service stops the Bluetooth unit now, but it may start again on the next boot or when manually started;
    • sudo systemctl disable bluetooth.service disables the Bluetooth unit: it will not start on boot anymore;
    • setting the option AutoEnable=false (this is the default value) in the [Policy] section of /etc/bluetooth/main.conf will prevent the Bluetooth adapter to power on after a reboot.
  • If you want to transfer files between a smartphone and your Debian computer through a USB cable, you may want to install the package mtp-tools.
  • To use a scanner, install sane-utils and then use the command scanimage.

Additional software

This is a list of the software I use for different purposes. This is only a personal recommendation and if you have installed a desktop environment you will probably have most of the programs you need.

  • Window manager: openbox
  • Terminal emulator: xfce4-terminal
  • Web browser: firefox
  • File manager: thunar
  • Image viewer: ristretto
  • Image editor: gimp3
  • Vector image editor: inkscape
  • Media player: parole
  • Song metadata editor: exfalso
  • Document reader: atril
  • Document editor: libreoffice-writer45
  • Instant messaging: telegram-desktop
  • Version control system: git
  • Panels: polybar
  • Wallpaper changer: hsetroot
  • Screen locking tool: xtrlock
  • Night light tool: sct

Footnotes


  1. Learn more about the releases of Debian:

    I would like to point out that despite its name Debian Unstable is not as unstable as the documentation suggests. It hardly ever happens that an upgrade breaks your system, it is not like new packages are thrown in the unstable repositories completely at random, and although the repositories receive daily updates, you do not have to upgrade everything all the time. Moreover, bugs are fixed in a couple of days. ↩︎

  2. In the following pages you can find information about backups and many example tools. Personally, I like using TAR.

    ↩︎
  3. You may notice that GIMP has an ugly interface, with buttons in relief looking as if they came from the 1990s. To solve this, launch gimp from a terminal. You should get this error:

    GTK theme error: Unable to locate theme engine in module_path: "pixmap"
    

    If that is the case, simply install the package gtk2-engines-pixbuf. ↩︎

  4. If you use LibreOffice, you should also install the package libreoffice-gtk3: it will allow LibreOffice to integrate with the system theme. ↩︎

  5. If you want to use a spell checker on LibreOffice, you need the corresponding package. Most of them are hunspell-... packages: for example hunspell-it is for the Italian spell checker. ↩︎