Tutorials

Ubuntu Server Setup Guide for Beginners in 2026

A fresh Linux VPS may look ready to use immediately, but skipping the initial security configuration can expose your system to unnecessary risks. A proper Ubuntu Server Setup helps secure remote access, protect services, and prepare the server for production workloads.

This guide explains the essential first steps after deploying an Ubuntu 26.04 server, including creating a sudo user, configuring SSH keys, enabling the firewall, and updating the system safely.

Connect to Your Ubuntu Server

The first login usually happens through the root account provided by your hosting company. Connect to the server using SSH from your local machine:

ssh root@server_ip_address

After entering the password or using your SSH key, you will gain full administrative access to the system.

Create a Secure Sudo User

Using the root account daily is not recommended because every command has unrestricted system privileges. Instead, create a dedicated user account for administration.

Add a new user:

adduser username

Grant administrative access:

usermod -aG sudo username

This allows the account to execute administrative commands using sudo.

Ubuntu Server Setup with SSH Keys

SSH key authentication provides stronger security than passwords and helps prevent brute-force attacks.

If you already have SSH keys on your local system, copy them to the server:

ssh-copy-id username@server_ip_address

Now test the connection using the new account:

ssh username@server_ip_address

Successful login confirms the SSH configuration is working properly.

Disable Root Login and Password Authentication

Once SSH keys are configured, harden your server by disabling direct root access and password authentication.

Create a custom SSH configuration file:

sudo nano /etc/ssh/sshd_config.d/99-hardening.conf

Add the following lines:

PermitRootLogin no
PasswordAuthentication no

Verify the SSH syntax:

sudo sshd -t

Reload the SSH service:

sudo systemctl reload ssh

These changes significantly improve server security.

Configure the Firewall Using UFW

Ubuntu includes UFW (Uncomplicated Firewall), which simplifies firewall management.

Allow SSH traffic first:

sudo ufw allow OpenSSH

Enable the firewall:

sudo ufw enable

Check active firewall rules:

sudo ufw status

If you later install web servers like Nginx or Apache, additional firewall rules may be required.

Set Hostname and Timezone

A proper hostname helps identify servers quickly in logs and monitoring systems.

Set the hostname:

sudo hostnamectl set-hostname web-server

Configure your timezone:

sudo timedatectl set-timezone Asia/Kolkata

Correct timezone settings improve scheduling accuracy for logs and cron jobs.

Update Ubuntu Packages

Keeping packages updated is one of the most important security practices.

Refresh repositories and install updates:

sudo apt update
sudo apt upgrade

If the update installs a new kernel, reboot the server:

sudo reboot

Final Thoughts

Completing a proper Ubuntu Server Setup ensures your VPS starts with strong security, safer SSH access, firewall protection, and updated software packages. These initial steps create a solid foundation before deploying websites, databases, containers, or production applications on Ubuntu 26.04.

Cyber Defence

Recent Posts

groupdel Command in Linux: Remove a Group and Audit Files

The groupdel command in Linux removes a group from the system. It deletes the group's entry from /etc/group and /etc/gshadow,…

13 hours ago

wc Command in Linux: Count Lines, Words, Characters, and Bytes

The wc command in Linux counts lines, words, characters, and bytes in files or standard input. It…

13 hours ago

top Command in Linux: Monitor Processes and Resource Usage

The top command in Linux provides a real-time view of running processes and system resource usage. From…

13 hours ago

usermod Command in Linux: Modify User Accounts and Groups

The usermod command in Linux modifies existing user account attributes. You can use it to manage group…

13 hours ago

sort Command in Linux: Sort Text, Numbers, Columns, and More

The sort command in Linux reads lines from files or standard input and writes them to standard…

2 days ago

wall Command in Linux: Broadcast Messages to Logged-In Users

The wall command in Linux sends a message to the terminals of all currently logged-in users. The…

2 days ago