Setting up a new box

*
planted: 08/08/2021last tended: 25/03/2024

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.

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 Debian

Debian as OS. Why Debian?

Using Gnome 3 for desktop environment for now. Not a huge fan though. Using XFCE with MX Linux.

2.1. Some minor quality of life things

2.1.1. Theme

Change to adawaita-dark via Tweaks / Appearance.

I could probably script this if I wanted: command line - How can I script the settings made by gnome-tweak-tool? - Ask …

2.1.2. Guake

A heads up display for the terminal.

sudo apt install guake
  • Run guake-preferences, set Keyboard shortcuts -> Toggle visibility to Ctrl+'.

3. 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.

3.1. add my user to sudoers

Already done on MX Linux.

3.2. get git

Already installed on MX Linux.

sudo apt install git

4. 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.

4.1. keepassxc

I use keepassxc for my personal password manager.

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

4.2. ssh keys

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

5. get my dotfiles

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

6. Install spacemacs

6.1. Install emacs

Available from apt on MX Linux.

sudo apt install emacs

Only version 27.1 at current time of writing though.

6.1.1. or from source.

on straight debian, you don't have emacs 27 out of the box. so guess go with installing from source, hey ho. that's fine, but takes a while.

Installing Emacs from source

6.2. install spacemacs

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

6.3. setup my config

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

6.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 

6.5. some of my libraries

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

6.6. start emacs

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

See My Spacemacs User Config for more details.

6.7. install icons

M-X all-the-icons-install-fonts

7. 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 https://gitlab.com/ngm/org ~/org

Had to disable mu4e for some reason.

8. 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

9. 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.

9.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

9.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.

9.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

9.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

10. Set up tmux

tmux.

It's already installed on MX Linux.

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

11. Install Nextcloud

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

11.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

11.3. Configure folders

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

12. Setup calendar

13. Setup work account

13.1. create new user

sudo adduser restart
sudo usermod -aG sudo restart

login as new user.

13.2. redo some basic config stuff

  • guake key
  • adawaita-dark theme

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

13.3. pull down org files

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

13.4. setup 1password

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

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

13.5. get my dotfiles

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

13.6. set up spacemacs

like on other account.

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

13.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.

13.8. pull down my notes

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

13.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/

14. Setup Apache

sudo apt install apache2

15. Configure Firefox

15.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

16. Install Calibre

16.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

16.2. Configure

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

17. Elsewhere

17.1. In my garden

Notes that link to this note (AKA backlinks).

17.2. In the Agora

17.3. Mentions

Recent changes. Source. Peer Production License.