Author: Fran
- Installing Ubuntu Server
- Set the root password
- Upgrade
- Enable beep
- Configure ethernet
- Get rid of snap
- Install sensor monitoring tools and hwinfo
- Configure Wake on LAN
- Using screen to run a long (in time) command in a remote terminal
- Use mosh to connect from mobile phones and iSH
- tmux Terminal Multiplexer
- Unattended upgrades
First step is installing Ubuntu Server. I have currently installed 22.04 LTS. There are plenty of tutorials on how to do this, so I won't explain it here.
sudo passwd root. Do not forget the root password.
sudo apt update
sudo apt upgradeYou might think that's silly, but it helps me a lot when debugging or as notification.
sudo apt install beep
sudo apt install acl
sudo modprobe pcspkrIf you try to beep, non root users see beep: Error: Could not open any device and running with sudo outputs beep: Error: Running under sudo, which is not supported for security reasons. beep: Error: Set up permissions for the pcspkr evdev device file instead.
You need special permissions to beep, so we will add a group sudo addgroup --system beep and make some rules to be able to beep. Edit sudo nano /lib/udev/rules.d/90-pcspkr-beep.rules and add:
# Add write access to the PC speaker for the "beep" group
ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="PC Speaker", ENV{DEVNAME}!="", RUN+="/usr/bin/setfacl -m g:beep:w '$env{DEVNAME}'"Add the beeping user to the group sudo usermod sister -a -G beep and reboot
Test it with the beep command. Since we ran sudo modprobe pcspkr that will work for the current session. To make the beeping persistent comment the line blacklist pcspkr from /etc/modprobe.d/blacklist.conf.
Create the script /usr/local/bin/beep-on-login.sh
#!/bin/bash
beep -f 1000 -l 100 -r 2Make the script executable sudo chmod +x /usr/local/bin/beep-on-login.sh
Add the script to /etc/rc.local using /usr/local/bin/beep-on-login.sh &
Check your ethernet interface name with ip address and run sudo nano /etc/netplan/00-installer-config.yaml. I have it configured with fixed IP and fixed interface name tied to the mac address.:
network:
version: 2
ethernets:
lan:
match:
macaddress: 00:ab:cd:ef:12:34
set-name: cable
dhcp4: no
wakeonlan: true
addresses:
- 192.168.1.50/24
gateway4: 192.168.1.1
nameservers:
addresses: [1.0.0.1, 1.1.1.1]Then sudo netplan apply you should be connected now.
sudo snap remove lxd
sudo snap remove core20
sudo snap remove snapd
sudo apt purge snapd
rm -rf ~/snapsudo apt install hwinfo
sudo apt install lm-sensors
sudo sensors-detect
sudo apt install hddtemp
sudo apt install glancesFirst enable this feature in the BIOS. Check if the adapter supports WOL sudo ethtool cable and look for Supports Wake-on: <letters>. If g is among the letters, then it supports the magic packet. Also check if WoL is enabled Wake-on: <letters>. If letters contain g and not d then WoL is enabled. However, if letters contain d you need to enable WoL by running:
sudo ethtool -s cable wol g
You need to issue this command at every boot or by adding wakeonlan: true in netplan config file (see above). Finally in your computer issue the command wol 00:ab:cd:ef:12:34 and the server should wake.
If you open a remote terminal and run a command, it will stop if the connection is closed. To prevent that run screen. A new terminal window will open where you can run your command. Detach the screen with control+A followed by d. To reattach the screen run screen -r. If multiple screen sessions are running, list them with screen -ls and attach the session with screen -r ID.
Mosh (mobile shell) is a remote terminal application like SSH but designed to handle roaming, intermittent connectivity, and network changes more gracefully. It uses UDP with built-in prediction and keep-alive, allowing you to stay connected while moving between Wi-Fi and mobile networks or during short outages, without the session freezing or dropping as SSH often does.
You have to install mosh in the Ubuntu server
sudo apt install mosh
and in your computer or phone. Then I have an alias to connect quickly. Note if your SSH port is not standard you need to specify.
pinky='mosh --ssh="ssh -p 2622" pink@beachlab.org'
To close all ghost sessions:
pkill -u $USER mosh-server
tmux is a terminal multiplexer: it lets you open multiple terminal sessions inside a single window, split the screen into panes, detach a session so it keeps running in the background, and later reattach to it from anywhere. This makes it ideal for running long-lived processes, organizing multiple shells, or maintaining work across SSH or mosh connections without losing progress.
You only need to install tmux in your computer (not the server). So in macos
brew install tmux
To create a new tmux session
tmux new -s work
If connection drops, reattach
tmux attach -t work
Install sudo apt-get install unattended-upgrades
Edit the config file and uncomment/modify the options sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
Test sudo unattended-upgrades --dry-run --debug
Apply the changes sudo dpkg-reconfigure --priority=low unattended-upgrades
