New install of Debian

Debian 11 desktop

I got a new desktop computer a couplafew years ago and partitioned the hard drives and installed Debian 10 alongside the proprietary OS that came with it. Now Debian 11 has been released, but rather than upgrade I did a reinstall. I hadn't used the other OS much (at all?), so I decided to reclaim that disk space. Here are the things I did to install and configure Debian bullseye.

Create bootable thumb drive from the downloaded .iso file

Plug in thumb drive, run sudo fdisk -l and note which disk it is. In my case, it was /dev/sdc.

Copy the ISO to the device (the entire device, not /dev/sdc1 or something)

sudo cp debian-live-11.0.0-amd64-xfce+nonfree.iso /dev/sdc

This is full "live" image with Xfce and non-free drivers. In hindsight, I probably could have used the much smaller net install image. Laptops often need non-free drivers for wifi, but I'm just using ethernet for this desktop.

Boot from the thumb drive and start the install

I wanted to divide the installation between the solid-state drive (SSD) and the spinning hard disk (HDD), so I chose to partition the disks manually. I created partitions for swap (16G) and root (the rest) on the SSD and I put /tmp (100G), /var (100G), and /home (the rest) on the HDD.

That was the only fiddling I did. Everything else was defaults.

Update Debian

After rebooting, make sure we're up to date (there may have been changes since the ISO was created).

sudo apt update
sudo apt upgrade

I may have done the next two steps first, because I really can't do anything with a mouse or a keyboard (like open a terminal window and type in it) without fixing those.

Fix the mouse

I use the mouse with my left hand, so I need to reverse the buttons. In Xfce, this is done with

  Applications -> Settings -> Mouse and Touchpad
    Devices tab
      Buttons
        Left-handed

I also prefer to have the focus follow the mouse.

  Applications -> Settings -> Window Manager
    Focus Tab
      Focus follows mouse

Fix the keyboard

I need to have the control key on the home row next to the "A" key. Xfce doesn't seem to offer a way to do this, so I use setxkbmap

setxkbmap -option ctrl:swapcaps

To make this happen at start up, I add it to the Xsession.

cat >> .xsessionrc
    setxkbmap -option ctrl:swapcaps

Bash

Configure the shell with my dotfiles

cp dotfiles/.bashrc $HOME
cp -r dotfiles/.bashrc.d/ $HOME
  
cp dotfiles/.profile .
cp -r dotfiles/.profile.d/ $HOME

cat >> .xsessionrc
  . $HOME/.profile

Emacs

Xfce is based on GTK, so install the emacs-gtk package.

sudo apt install emacs-gtk

Install use-package with Emacs's Options -> Manage Emacs Packages

Copy my config from dotfiles

mkdir .emacs.d
cd .emacs.d
cp dotfiles/.emacs.d/*.el .
cp -r dotfiles/.emacs.d/config/ .

Git

sudo apt install git

cp dotfiles/.gitconfig $HOME

Install some other things I use

sudo apt install curl tree wget ripgrep jq

Firefox

Debian comes with firefox-esr, which is too old. Grab firefox from sid instead.

Add the unstable repo to /etc/apt/sources.list

deb http://deb.debian.org/debian/ unstable main contrib non-free

Now pin it, so we only get it when we ask for it.

$ cat /etc/apt/preferences.d/99pin-unstable
Package: *
Pin: release a=stable
Pin-Priority: 900

Package: *
Pin release a=unstable
Pin-Priority: 10

Now install firefox from unstable

sudo apt update
sudo apt install -t unstable firefox

And remove firefox-esr

sudo apt purge firefox-esr

Now Debian sensible-browser and menus and things will still work.

sensible-browser http://oylenshpeegul.github.io/

Thunderbird

Thunderbird is a pain to configure, so I just copied my entire .thunderbird directory over.

sudo apt install thunderbird

cp -r backup/.thunderbird $HOME

Fonts

cp -r backup/.fonts/ $HOME

Desktop and icon themes

sudo apt install arc-theme moka-icon-theme

Settings -> Appearance -> Style
Settings -> Appearance -> Icons
Settings -> Window Manager

Terminal themes

Create a ~/.local/share/xfce4/terminal/colorschemes/ directory and copy .theme files there.

mkdir -p ~/.local/share/xfce4/terminal/colorschemes/
cd ~/.local/share/xfce4/terminal/colorschemes/
wget https://raw.githubusercontent.com/guttume/isooth/master/isooth.theme

Then xfce-terminal will find them in

Edit > Preferences...
  Colors tab
    Load Presets...

Terminal prompt

I use starship for a terminal prompt

sh -c "$(curl -fsSL https://starship.rs/install.sh)"

I wrote about Command-not-found a while back, but it's much less fiddly now

sudo apt install command-not-found
sudo apt-file update
sudo update-command-not-found

Perl

Install local::lib

mkdir perl
cd perl
curl https://api-v1.metacpan.org/download_url/local::lib | jq .download_url
wget https://cpan.metacpan.org/authors/id/H/HA/HAARG/local-lib-2.000024.tar.gz
tar xf local-lib-2.000024.tar.gz
cd local-lib-2.000024
perl Makefile.PL --bootstrap
make
make test
make install

Install cpanm for local::lib (~/perl5 by default)

wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus

Debian doesn't include perldoc for some reason.

$ perldoc cpanm
You need to install the perl-doc package to use this program.

$ sudo apt install perl-doc

Let's use cpanm to install a module! We're definitely going to need Path::Tiny soon enough.

cpanm Path::Tiny

Oh, and Data::Printer needs my config for it too.

cpanm Data::Printer
cp dotfiles/.dataprinter $HOME

I configure Emacs for Perl with ~/.emacs.d/config/programming/perl.el in the Emacs step above.

Rust

Install rustup

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Install rust-analyzer (a Rust language server)

mkdir -p ~/.local/bin

curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-x86_64-unknown-linux-gnu.gz | gunzip -c - > ~/.local/bin/rust-analyzer

chmod +x ~/.local/bin/rust-analyzer

Configure Emacs

M-x package-install RET rustic RET
M-x package-install RET lsp-ui RET

This is configured by the ~/.emacs.d/config/programming/rust.el file installed in the Emacs step above.

Add cargo-edit (where cargo add lives now)

sudo apt install libssl-dev pkg-config

cargo install cargo-edit

Go

Install Go

sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xf ~/Downloads/go1.17.linux-amd64.tar.gz

Install gopls (the Go language server)

cd ~/go
GO111MODULE=on go get golang.org/x/tools/gopls@latest

This is configured by the ~/.emacs.d/config/programming/go.el file installed in the Emacs step above.

Python

Make python be python3

cd /usr/bin
sudo ln -s python3 python

Install Python Black

sudo apt install black

Configure Emacs

M-x package-install RET python-black RET

This is configured by the ~/.emacs.d/config/programming/python.el file installed in the Emacs step above.

View images

I think there are other image viewers installed, but I am going to call these (eog and feh are both great), so they might as well be there.

sudo apt install eog feh

View PDFs

Same with PDF files

sudo apt install evince

Evince does some other types of files as well.

RipIt

I've configured RipIt to rip CDs to FLAC by default.

sudo apt install ripit

cp -r dotfiles/.ripit $HOME

VSCode

VSCode can be installed without telemetry (VSCodium).

wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg \
    | gpg --dearmor \
    | sudo dd of=/usr/share/keyrings/vscodium-archive-keyring.gpg

echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://paulcarroty.gitlab.io/vscodium-deb-rpm-repo/debs vscodium main' \
    | sudo tee /etc/apt/sources.list.d/vscodium.list

sudo apt update
sudo apt install codium

Now install Awesome Emacs and rust-analyzer extensions from within VSCode.

Simple Scan

The simple-scan interface to XSane really is simple.

sudo apt install simple-scan

It finds the wireless scanner on the network with no further configuration.

Apparently, it ends up on the menu as "Document Scanner" now.

Applications -> Graphics -> Document Scanner

Not sure what the point of that was (it is further up the list than "Simple Scan" was?), but whatevs.

Gimp

sudo apt install gimp

Gimp now defaults to single pane mode (yay!) and dark mode (boo!). It's easy enough to switch to dark or light, but I think system will follow the system theme (why isn't that the default?).

Edit -> Preferences
    Interface
        Theme
            System

Connect my phone through USB

I installed usbutils (lsusb) and mtp-tools in diagnosing why my phone wasn't connecting, but I think I just needed gvfs-backends in the end.

sudo apt install gvfs-backends

TeX

I guess TeX Live is the currently preferred way to install TeX.

sudo apt install texlive-full

Java

Debian 11 has both OpenJDK 11 (latest stable) and 17 (latest). They can coexist, but I think I only need one.

sudo apt install openjdk-17-jre openjdk-17-jdk

export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64/"

Add that to a Java profile.

$ cat >> ~/.profile.d/java.sh
JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64/"
export JAVA_HOME

LibreOffice needs Java too.

sudo apt install libreoffice-java-common

Printer

If we simply install CUPS, then we should be able to find the wireless printer with no other configuration needed.

sudo apt install cups

SSH

I want to ssh to this machine from laptops and whatnot.

sudo apt install openssh-server

sudo systemctl start ssh  # start now
sudo systemctl enable ssh # start on boot

Hugo

This blog is written with Hugo, so we'll need that! :)

sudo apt install hugo

I like Hugo because it supports writing posts in Org Mode!