This is mostly a reminder of how I like to setup my Ubuntu servers. If you run some command like man foo you will get a warning.
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.
To restore this content, including manpages, you can run the 'unminimize'
command. You will still need to ensure the 'man-db' package is installed.
This is a thing you do all the time in Ubuntu. If you are going to do something then do this first then do what you were you going to do.
sudo apt update
Since I did a minimal server install I am missing many things for my server needs. To be fair the installer warns you that a minimal install is not meant for use by humans. So yes this is self-inflicted work. This is more of a reminder to myself to install all these things next time I do a minimal install.
sudo apt install vim htop atop glances coreutils \
transmission-daemon ca-certificates curl \
# docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin \
landscape-common \
man-db manpages-posix manpages-dev manpages-posix-dev \
locate netcat-traditional nmap iputils-ping \
winbind libnss-winbind cifs-utils smbclient bash-completion \
rsync rename mmv renameutils fwupd
Do a minimal install and select no additional packages to install. This will not install any snaps on your system. If you like snaps, skip this step and may god have mercy on your soul. Otherwise, if you are a normal person when you run snap list you should see something like this:
No snaps are installed yet. Try 'snap install hello-world'.
Congratulations you are snap free. However, Ubuntu still hates you and can still install snaps without you potentially noticing that it happened. Ubuntu devs have always hated you and always know better than you. To prevent this, add the following:
sudo vim /etc/apt/preferences.d/nosnap.pref
Package: snapd
Pin: release a=*
Pin-Priority: -10
Run sudo apt info snapd
Package: snapd
State: not a real package (virtual)
You are safe from snapd being installed and thus any snaps being on your pure and untainted operating system.
sudo apt install man-db manpages-posix manpages-dev manpages-posix-dev
Avoid the snap version of docker at all costs. It is a living hell. Full guide here: https://docs.docker.com/engine/install/ubuntu/
You can install transmission-daemon on Ubuntu 24.04 LTS from the default repo. sudo apt install transmission-daemon. This should install version transmission-daemon 4.0.5 (a6fe2a64aa). The default install configuration of transmission is messed up. If you see error message like below this is the solution.
systemd[1]: Starting transmission-daemon.service - Transmission BitTorrent Daemon...
systemd[1]: transmission-daemon.service: start operation timed out. Terminating.
transmission-daemon[2780]: Closing transmission session... done.
systemd[1]: transmission-daemon.service: Failed with result 'timeout'.
systemd[1]: Failed to start transmission-daemon.service - Transmission BitTorrent Daemon.
In /etc/systemd/system/multi-user.target.wants/transmission-daemon.service change the following:
Type=notify
to
Type=simple
sudo systemctl daemon-reload
sudo systemctl enable transmission.service
sudo systemctl restart transmission.service
sudo systemctl status transmission.service
sudo apt install bash-completion
add to ~/.bashrc
source /usr/share/bash-completion/completions/systemctl
alias sct='systemctl'
complete -F _systemctl sct
This does not qualify as an annoyance. I like to have glances running as a web service so I can use glances data on the useful homepage dashboard app.
/etc/systemd/system/glances.service
[Unit]
Description = Glances in Web Server Mode
After = network.target
[Service]
ExecStart = /usr/bin/glances -w -t 5
[Install]
WantedBy = multi-user.target
Afterwards, get systemd to pickup the changes and then do a proper start.
sudo systemctl daemon-reload
sudo systemctl enable glances.service
sudo systemctl restart glances.service
sudo systemctl status glances.service
Ubuntu added some really useful feature to the motd but also really awful ones like news and ads. This one is useful.
sudo apt install landscape-common
To test run:
run-parts /etc/update-motd.d/
Get rid of the annoying stuff stored in /etc/update-motd.d/:
sudo chmod -v 666 /etc/update-motd.d/10-help-text
sudo chmod -v 666 /etc/update-motd.d/50-motd-news
sudo chmod -v 666 /etc/update-motd.d/60-unminimize
sudo chmod -v 666 /etc/update-motd.d/92-unattended-upgrades
To test run:
run-parts /etc/update-motd.d/
Optional. You cam also disable the services:
sudo systemctl mask apt-news.service
sudo systemctl mask esm-cache.service
PS1='${debian_chroot:+($debian_chroot)}\[\033[37m\]\u\[\033[00m\]@\[\033[33m\]\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$ '
HISTSIZE=10000
HISTFILESIZE=50000
Optional in ~/.bashrc
# Don't limit the size of the history file
HISTFILESIZE=-1
# Don't limit the size of the in-memory history list
HISTSIZE=-1
In ~/.inputrc add:
# Briefly highlight the corresponding opening symbol when entering a closing symbol
set blink-matching-paren on
# When listing possible completions, color the part that is already typed
set colored-completion-prefix on
Unattended upgrades performs the equivalent of apt update and apt upgrade. Set these to 0:
/etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
Disable and/or mask the services.
sudo systemctl disable apt-daily-upgrade.timer
sudo systemctl disable apt-daily.timer
sudo systemctl mask apt-daily-upgrade.service
sudo systemctl mask apt-daily.service
sudo systemctl mask apt-daily.timer
sudo systemctl mask apt-daily-upgrade.timer
Systemd is a giant bloated waste of time and effort and was never needed. Show current disk usage:
journalctl --disk-usage
Reduce usage to an amount you would prefer
journalctl --vacuum-size=150M
Show the current config. Or a super fancy cat. Someone wrote this?
systemd-analyze cat-config systemd/journald.conf
Set a sane (any) limit on the size of the logs for journald in /etc/systemd/journald.conf
sudo vim /etc/systemd/journald.conf
add some limits:
SystemMaxUse=100M
Restart journald
systemctl reload systemd-journald
or
systemctl restart systemd-journald
or
systemctl force-reload systemd-journald
I like local time. Show timezones.
timedatectl list-timezones
Set the timezone:
sudo timedatectl set-timezone America/New_York
Glances web ui is broken because of the Debian Devs. See https://gist.github.com/jfeilbach/b7e33f38dbb263f3342924d7e5a03e47
# alias rr='if [ -f /var/run/reboot-required ]; then echo "reboot required"; else echo "No reboot needed"; fi'
alias rr='if [ -f /var/run/reboot-required ]; then cat /var/run/reboot-required ; echo "Packages requiring reboot:" ; cat /var/run/reboot-required.pkgs ; else echo "No reboot needed"; fi'
alias t-start='sudo service transmission-daemon start'
alias t-stop='sudo service transmission-daemon stop'
alias t-reload='sudo service transmission-daemon reload'
alias t-list='transmission-remote -n 'transmission:transmission' -l'
alias t-basicstats='transmission-remote -n 'transmission:transmission' -st'
alias t-fullstats='transmission-remote -n 'transmission:transmission' -si'
alias dl='header=$(df -hTP | head -n 1) ; echo "${header}" ; df -hTP | grep /dl_'