Stacks Horizon
All posts
Code and Tech2026-04-274 min readStacks Horizon

Ubuntu Server Setup for Beginners: A Step-by-Step Guide

Learn how to set up an Ubuntu server from scratch. This beginner-friendly guide covers installation, initial configuration, and essential post-setup steps to get your server running securely.

Ubuntu Server Setup for Beginners: A Step-by-Step Guide

Setting up your first server can seem daunting, but with Ubuntu Server, it's a straightforward process. Ubuntu Server is a popular choice for its stability, security, and vast community support, making it perfect for hosting websites, databases, or even a personal development environment. This guide will walk you through the entire process, from installation to essential post-setup configurations.

What is Ubuntu Server?

Ubuntu Server is a powerful, free, and open-source operating system designed specifically for servers. Unlike its desktop counterpart, it typically runs without a graphical user interface (GUI), relying on the command line for all interactions. This makes it lightweight, efficient, and ideal for headless operations.

Why use Ubuntu Server?

  • Stability: Known for its long-term support (LTS) releases, ensuring reliability.
  • Security: Regular updates and strong community focus on security practices.
  • Flexibility: Can be used for web servers (Apache, Nginx), databases (MySQL, PostgreSQL), media servers, development environments, and more.
  • Community Support: A massive community and extensive documentation are available.

Prerequisites

Before you begin, gather the following:

  1. Ubuntu Server ISO: Download the latest LTS version from the official Ubuntu website. (e.g., Ubuntu 22.04 LTS).
  2. Installation Medium: A USB flash drive (8GB or larger) for bare-metal installation, or virtualization software (like VirtualBox, VMware, or Hyper-V) if you're setting up a virtual machine.
  3. Reliable Internet Connection: Essential for downloading updates during and after installation.
  4. Computer: The machine where you intend to install Ubuntu Server.

Step-by-Step Installation

1. Create a Bootable USB (for bare metal)

If installing on physical hardware, you'll need to create a bootable USB drive using tools like Rufus (Windows), Etcher (Windows/macOS/Linux), or dd (Linux/macOS).

2. Boot from the Installation Medium

Insert your bootable USB or mount the ISO in your virtual machine. Restart your computer and enter the BIOS/UEFI settings (usually by pressing F2, F10, F12, or Del during boot) to set your USB drive or virtual CD/DVD drive as the primary boot device.

3. Language and Keyboard Layout

  • Once booted, you'll see a welcome screen. Select your preferred language.
  • Choose your keyboard layout. The installer often detects it correctly, but you can test it.

4. Network Configuration

  • The installer will attempt to configure networking using DHCP. Most home users can accept the default. If you need a static IP, you can configure it here, but it's often easier to do it after installation.
  • If you use a proxy, enter the details. Otherwise, leave it blank.

5. Storage Configuration

This is a critical step. For beginners, the safest option is:

  • Select 'Use an entire disk'. This will erase everything on the chosen disk and install Ubuntu Server.
  • Confirm your choice. Be absolutely sure you've selected the correct disk, as this action is irreversible.
  • The installer will propose a partition layout. Accept the default unless you have specific needs.

6. Profile Setup

  • Enter your name.
  • Choose a server name (hostname, e.g., my-ubuntu-server).
  • Create a username and a strong password. Remember these, as you'll use them to log in.

7. Install OpenSSH Server

  • During the installation summary, you'll be asked if you want to install the OpenSSH server. Select 'Install OpenSSH server'. This is highly recommended as it allows you to securely connect to your server remotely via SSH, which is how most server administration is done.

8. Begin Installation

Review the summary and proceed. The installation process will now begin. This can take some time depending on your hardware and internet speed.

9. Reboot

Once the installation is complete, you'll be prompted to reboot. Remove your installation medium (USB drive or unmount ISO) and press Enter. Your server will boot into your newly installed Ubuntu Server.

Post-Installation Essentials

After rebooting, log in with the username and password you created.

1. Update Your System

Keeping your server updated is crucial for security and performance. Run these commands immediately:

sudo apt update
sudo apt upgrade -y
  • sudo apt update refreshes the list of available packages.
  • sudo apt upgrade -y installs all available updates without prompting for confirmation.

2. Configure a Firewall (UFW)

Ubuntu comes with ufw (Uncomplicated Firewall), which is easy to set up.

sudo ufw enable
sudo ufw allow ssh
sudo ufw status
  • sudo ufw enable turns on the firewall.
  • sudo ufw allow ssh allows incoming connections on port 22 (SSH).
  • sudo ufw status shows the current firewall rules.

Remember to open ports for any other services you install (e.g., sudo ufw allow http for web servers).

3. Basic Server Management Commands

Here are some fundamental commands you'll use regularly:

  • ls: List directory contents.
  • cd [directory]: Change directory.
  • pwd: Print working directory.
  • mkdir [directory]: Create a new directory.
  • rm [file/directory]: Remove files or directories (use rm -r for directories).
  • nano [file]: Open a text editor for editing files.
  • htop: A powerful interactive process viewer (install with sudo apt install htop).
  • ip a: Display network interface information.
  • systemctl status [service]: Check the status of a service (e.g., systemctl status ssh).
  • man [command]: Access the manual page for a command.

Conclusion

Congratulations! You've successfully installed and performed the initial setup of your Ubuntu Server. This is just the beginning of your journey. From here, you can explore installing web servers like Nginx or Apache, setting up databases, or deploying your applications. The possibilities are endless, and the Ubuntu community is always there to help you along the way.

Keep learning, keep experimenting, and enjoy the power of your new server!

Comments

Share your thoughts on this article.

Loading comments…