Setting up a new box

*
planted: 08/08/2021last tended: 22/05/2026

Documenting the steps needed to set up a new Linux box. I'd kind of ultimately like to get things smooth enough to the point where I'm fine doing a fresh install of the OS pretty regularly, like every couple of months. Kind of a disaster recovery thing.

For now, just documenting the steps. But long-term it may make sense to use something like Guix Home.

1. Main goals

My main usage is:

So it's pretty much all about getting emacs set up. The rest is just sugar on top after that, really.

2. Install OS

Currently trying Zorin as OS. See Notes on Zorin 18.1. But would prefer to use Debian as daily driver. (Why Debian?).

3. Terminal quality of life

3.1. fish

sudo apt install fish
chsh -s /usr/bin/fish

3.2. Guake

A heads up display for the terminal.

sudo apt install guake
  • Run guake-preferences, set Keyboard shortcuts -> Toggle visibility to Ctrl+'.
    • NOTE: above doesn't work on Wayland.

4. In the beginning there was git

At present I have much of my stuff backed up in a git repo somewhere, so I need git to pull that in.

4.1. If necessary, add my user to sudoers

Already done on Zorin.

4.2. If necessary, install git

sudo apt install git

4.3. git restore mtime

Use git-restore-mtime on cloned org-roam repos, to get ordering by date in the completion buffer

sudo apt install git-restore-mtime

5. Passwords and ssh keys

Then I need my passwords and ssh keys.

Realising a slight flaw here in that in theory I need my keys in order to access gitlab. In practice I can currently get it via password-based access, and I can remember my password. Or I can copy from an existing device. But assuming I lost all my devices, and also my memory, I would perhaps not be able to access (though I might be able to get emailed reminders - though what if I couldn't access my email?) Anyway, upshot is, I should be storing my keys somewhere offline and always close to hand, too.

5.1. keepassxc

I use keepassxc for my personal password manager.

sudo apt install keepassxc
git clone git@gitlab.com:ngm/keepass ~/Documents/keepass

5.2. ssh keys

mkdir .ssh
cp ~/Documents/keepass/keys/* ~/.ssh/
chmod 600 ~/.ssh/*

6. get my dotfiles

git clone https://codeberg.org/ngm/dotfiles .dotfiles

7. Install spacemacs

7.1. Install emacs

sudo apt install emacs

7.1.1. or from source.

It's quite likely not the latest Emacs in the repo. If needed, have to go with Installing Emacs from source. Takes a while.

7.2. install spacemacs

git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

7.3. setup my config

ln -s ~/.dotfiles/spacemacs.d ~/.spacemacs.d

See My Spacemacs User Config for more details.

7.4. install source code pro

see: software installation - How to use the Adobe Source Code Pro font? - Ask Ubuntu

sudo wget --content-disposition -P /usr/share/fonts/opentype/source-code-pro https://github.com/adobe-fonts/source-code-pro/blob/29fdb884c6e9dc2a312f4a5e2bb3b2dad2350777/OTF/SourceCodePro-{Black,BlackIt,Bold,BoldIt,ExtraLight,ExtraLightIt,It,Light,LightIt,Medium,MediumIt,Regular,Semibold,SemiboldIt}.otf?raw=true 

7.5. some of my libraries

git clone https://gitlab.com/ngm/commonplace-lib .emacs.d/private/commonplace-lib

7.6. start emacs

Start it up, and spacemacs should then do its installation business.

This is very long process. Asks to install sqlite and vterm and epdftools along the way. But I don't think you can let it run unattended.

7.7. install icons

M-x all-the-icons-install-fonts
M-x nerd-icons-install-fonts 

8. Set up org

org-mode itself is already set up from the spacemacs installation above. This is just pulling in my own files.

git clone git@gitlab.com:ngm/org ~/org

Why is my org repo so large?

9. Set up org-roam

Likewise, various bits of org-roam install and config are taken care of by spacemacs installation.

This is just pulling in my files.

git clone https://gitlab.com/ngm/commonplace ~/commonplace

For publishing to Agora:

git clone https://gitlab.com/ngm/ox-agora ~/.emacs.d/private/ox-agora

To get org-roam ready to rock:

M-X org-roam-db-sync

10. Set up syncthing

I use syncthing to sync files between machines. Most of what I sync I've already pulled in via git (which functions as the backup). This just does real-time syncing of them when I make changes.

10.1. Install

The default Debian (and MX Linux also) one is mega out of date, doesn't work with syncthing on other devices.

So use special repo. See https://apt.syncthing.net/

sudo apt install curl
sudo curl -s -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
printf "Package: *\nPin: origin apt.syncthing.net\nPin-Priority: 990\n" | sudo tee /etc/apt/preferences.d/syncthing
sudo apt update
sudo apt install syncthing

10.2. Connect to peers devices

Not sure of the recommended way of doing this. They don't all need to be connected to each other.

I think probably best to connect to my phone first, as that's more likely to be on. Or, connect to noodlemaps, as that's also potentially an always on peer.

That said, sometimes syncthing will handily pick up another box that's on the same physical network as it.

10.3. Add shared folders for syncing

The main ones:

  • orgzly (my org files, but I've called the folder orgzly sometime in the past when I was first syncing to just phone)
  • keepass

10.4. Add to startup programs

  • Gnome: Add 'Start Syncthing' to startup apps via Gnome Tweaks.
  • XFCE
    • Session and Startup
    • Add application
      • Name: Syncthing
      • Description: Start syncthing server
      • Command: /usr/bin/syncthing
      • Trigger: on login

11. Set up tmux

tmux.

It's already installed on MX Linux.

ln -s .dotfiles/tmux.conf .tmux.conf

12. Install Nextcloud

What's this for? Calibre and photo syncing I think.

12.2. install

mv Downloads/Nextcloud-3.3.0-x86_64.AppImage Programs/
cd Programs
chmod u+x Downloads/Nextcloud-3.3.0-x86_64.AppImage
./Nextcloud-3.3.0-x86_64.AppImage

12.3. Configure folders

In Nextcloud Settings, check InstantUpload, Multimedia, and Shared multimedia folders in the list of synced folders.

13. Setup calendar

14. Setup work account

14.1. create new user

sudo adduser restart
sudo usermod -aG sudo restart

login as new user.

14.2. redo some basic config stuff

  • guake key
  • adawaita-dark theme

(is there a way to apply this across all users?)

14.3. pull down org files

git clone <xxx>/restart.git ~/Documents/org

14.4. setup 1password

While for personal I use keepassxc, for work we use 1password.

  • login, get key from emergency info pdf
  • add firefox extension

14.5. get my dotfiles

git clone https://github.com/ngm/dotfiles .dotfiles

14.6. set up spacemacs

like on other account.

git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

14.7. setup my config

ln -s ~/.dotfiles/spacemacs.d ~/.spacemacs.d

I need to do something different here in order to have different configs for work and personal accounts.

14.8. pull down my notes

git clone <xxx>/restart-kbase.git ~/Documents/kbase

14.9. set up ssh

So I can access various servers. At the moment, copy my keys via usb. Need to work on this a bit though.

something like https://ferrario.me/using-keepassxc-to-manage-ssh-keys/

15. Setup Apache

sudo apt install apache2

16. Configure Firefox

16.1. Settings

I could perhaps just use Firefox Sync here, but it's only a few settings and I don't particularly want to set up the account.

  • homepage and new windows - blank page
  • new tabs - blank page
  • search engine - YunoSearx

17. Install Calibre

17.1. Install

As per https://calibre-ebook.com/download_linux

Install script. (always be wary of running someone else's script!!!)

sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin

17.2. Configure

Set /home/neil/Nextcloud/Shared multimedia/eBook as the library folder.

18. Elsewhere

18.1. In my garden

Notes that link to this note (AKA backlinks).

18.2. In the Agora

18.3. Mentions

Recent changes. Source. Peer Production License.