Skip to content

Ubuntu Server Baseline

This page prepares a fresh Ubuntu Server for course labs. It follows the same basic direction as DigitalOcean's Initial Server Setup with Ubuntu: create a non-root user, enable sudo, configure SSH access, and turn on a firewall safely.

Goal

Finish with a non-root administrative account, working SSH access, updated packages, and a basic firewall that allows SSH.

1. Confirm the Server Version

lsb_release -a
uname -a

Recommended: Ubuntu 22.04 LTS or Ubuntu 24.04 LTS.

2. Update Packages

sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y

If this is a brand-new server and you are logged in as root, omit sudo until you create the regular user.

3. Create a Non-Root User

Replace student with your username:

adduser student
usermod -aG sudo student

Verify the user is in the sudo group:

groups student

Expected: the output includes sudo.

4. Test the New User

Open a second terminal and connect as the new user:

ssh student@SERVER_IP_ADDRESS

Then test administrative access:

sudo whoami

Expected output:

root

Keep the original session open

Do not close the root or existing working session until the new user can log in and run sudo.

5. Install Core Utilities

sudo apt install -y curl wget ca-certificates gnupg lsb-release unzip zip nano vim tree htop ufw

These tools support later setup pages and common lab workflows.

6. Enable a Basic Firewall

Allow SSH first:

sudo ufw allow OpenSSH

Enable UFW:

sudo ufw enable

Check status:

sudo ufw status verbose

Expected: OpenSSH is allowed and the firewall status is active.

Avoid lockout

If you use a custom SSH port, allow that port before enabling UFW. Example: sudo ufw allow 2222/tcp.

7. Set the Time Zone Optional

List time zones:

timedatectl list-timezones | grep America

Set a time zone:

sudo timedatectl set-timezone America/New_York

Verify:

timedatectl

8. Classroom Checkpoint

Record these outputs:

lsb_release -a
groups $USER
sudo ufw status verbose

Troubleshooting

Problem Check
sudo: command not found Confirm you are on Ubuntu Server and install sudo as root.
User cannot run sudo Run usermod -aG sudo USERNAME as root, then log out/in.
SSH stops working after firewall changes Use the provider console and allow OpenSSH or the custom SSH port.

Next Step

Continue to SSH and Terminal Workflow.