After installing a fresh Ubuntu Server from an ISO (or spinning up a cloud VM), you need to get it securely on the network before you can actually start using it.
1. Set a Static IP Address
Ubuntu uses netplan for network configuration.
- Open the Netplan config file (the filename may vary, usually starts with
50-or00-):sudo nano /etc/netplan/00-installer-config.yaml - Modify it to use a static IP (assuming your interface is
eth0):network: ethernets: eth0: addresses: - 10.10.10.25/24 routes: - to: default via: 10.10.10.1 nameservers: addresses: [8.8.8.8, 1.1.1.1] version: 2 - Apply the changes:
sudo netplan apply
2. Secure SSH Access
Never rely on passwords for SSH. You should set up SSH keys.
From your local laptop, generate a key and copy it to the server:
# Generate a key (if you don't already have one)
ssh-keygen -t ed25519
# Copy it to the new server
ssh-copy-id username@10.10.10.25
Now, disable password authentication on the server:
sudo nano /etc/ssh/sshd_config
Find the line PasswordAuthentication yes and change it to no. Restart SSH:
sudo systemctl restart ssh
3. Update Packages
Finally, ensure the system is fully patched and secure:
sudo apt update && sudo apt upgrade -y