Last updated: May 1, 2026
VPS Setup Manual
This note contains basic instructions for a fresh Ubuntu server (Ubuntu 24.04 at the time of writing), a set of steps and commands to keep close for the next time I need to set it up manually.
Connect to the VPS
Connect to the server as root using SSH:
ssh root@ip # replace ip with the server IP address
Package maintenance
apt update # update the package list
apt upgrade -y # update installed packages
reboot
shutdown -r now # reboot now
shutdown -h now # shutdown now
shutdown -h +10 # shutdown in 10 minutes
shutdown -c # cancel a scheduled shutdown
Create a new user
In order not to use the root user for everyday server work, we need to create a new user and give them super user rights.
adduser normal_user # add new user
usermod -aG sudo normal_user # add the user to the sudo group
su - normal_user # switch to a new user
sudo whoami # check sudo access
exit
Enable SSH login for the new user
mkdir -p ~/.ssh # create .ssh directory for the new user
vi ~/.ssh/authorized_keys # paste your public key
sudo ssh normal_user@ip # login with the new user
chmod 644 ~/.ssh/authorized_keys # change file permission
Once key login works, to disable root login, edit /etc/ssh/sshd_config (as root):
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
Apply changes safely:
sudo sshd -t
sudo systemctl restart ssh
Test that the new user still works:
ssh normal_user@ip
Then check that root login is disabled:
ssh root@ip
Auth log
Ubuntu writes SSH logins, PAM sessions, and many sudo events to /var/log/auth.log.
sudo cat /var/log/auth.log
sudo tail -f /var/log/auth.log
Install zsh
sudo apt install zsh # install zsh
chsh -s $(which zsh) # set it as the default shell
vi ~/.zshrc # customize the config
source ~/.zshrc # apply the changes
Ghostty backspace/backslash quick fix
If some keys behave incorrectly in Ghostty on the VPS, it might help to set the terminal type manually.
Add this to ~/.zshrc on the VPS:
export TERM=xterm-256color