Axel Verne → Junk Drawer kit → Chapter 3
Chapter 3 — The Boring Foundation
7 blocks to copy, in the order they appear in the chapter. Nothing here is required to be typed by hand.
Laptop-specific: don't let it sleep when you close the lid
3.1 · bash
sudo sed -i 's/^#\?HandleLidSwitch=.*/HandleLidSwitch=ignore/' /etc/systemd/logind.conf
sudo sed -i 's/^#\?HandleLidSwitchExternalPower=.*/HandleLidSwitchExternalPower=ignore/' /etc/systemd/logind.conf
sudo systemctl restart systemd-logindLaptop-specific: battery as UPS
3.2 · bash
# ThinkPad only; caps charging at 80%
echo 80 | sudo tee /sys/class/power_supply/BAT0/charge_control_end_thresholdIntel Mac-specific: Wi-Fi
3.3 · bash
sudo apt install firmware-brcm80211 # enable "non-free-firmware" in /etc/apt/sources.list firstEverybody: the ten-command setup
3.4 · bash
# 1. Update everything
sudo apt update && sudo apt upgrade -y
# 2. The tools you'll miss when they're not there
sudo apt install -y curl git htop smartmontools ufw unattended-upgrades
# 3. Automatic security updates (set and forget)
sudo dpkg-reconfigure -plow unattended-upgrades # answer Yes
# 4. Firewall: allow SSH, block everything else by default
sudo ufw allow OpenSSH
sudo ufw --force enable
# 5. Docker, the official way
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USER
newgrp docker # or log out and back in
# 6. The one folder layout every chapter uses
sudo mkdir -p /srv/lab
sudo chown -R $USER:$USER /srv/lab
mkdir -p /srv/lab/{compose,data,media,backup}Docker in 30 seconds, for people who've never used it
3.5 · bash
cd /srv/lab/compose/<app>
docker compose up -d # start (and download the image the first time)
docker compose logs -f # watch what it's doing (Ctrl-C to stop watching)
docker compose down # stopThe folder layout, explained once
3.6 · text
/srv/lab/
├── compose/ one subfolder per app, each holding its compose.yaml
├── data/ app databases and config — SMALL, back this up (Ch. 11)
├── media/ your movies, music, photos — BIG, back this up differently
└── backup/ where other machines' backups landCheck your drives before you trust them
3.7 · bash
sudo smartctl -H /dev/sda # "PASSED" or not
sudo smartctl -A /dev/sda | grep -E "Reallocated|Pending|Uncorrect"Get the next build in your inbox
An email when a new build write-up goes up: what I ran, on what hardware, and the commands that paste. Free, unsubscribe any time. The kit stays free either way.