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

Your First Ubuntu Server: A Beginner's Guide to Setup and Configuration

Learn how to set up an Ubuntu server from scratch, covering installation, basic configuration, and essential post-setup steps for beginners. Get your server running securely and efficiently.

Your First Ubuntu Server: A Beginner's Guide to Setup and Configuration

Your First Ubuntu Server: A Beginner's Guide to Setup and Configuration

Setting up your own server might sound daunting, but with Ubuntu Server, it's a remarkably straightforward process. Whether you're looking to host a website, run a personal cloud, or experiment with server-side applications, Ubuntu provides a robust, free, and widely supported platform. This guide will walk you through the entire process, from downloading the installation media to performing essential post-setup configurations.

Why Choose Ubuntu Server?

Ubuntu Server is a popular choice for several reasons:

  • Free and Open Source: No licensing costs, and a transparent development model.
  • Stability and Security: Known for its reliability and strong security features.
  • Vast Community Support: A massive user base and extensive documentation mean help is always available.
  • Ease of Use: Despite being command-line driven, its package management and logical structure make it accessible for beginners.
  • Performance: Optimized for server environments, providing excellent performance.

Prerequisites

Before we begin, ensure you have the following:

  1. A Computer for the Server: This can be a dedicated physical machine, a virtual machine (using VirtualBox, VMware, etc.), or a single-board computer like a Raspberry Pi.
  2. Internet Connection: Required for downloading the ISO and updating packages.
  3. USB Drive (8GB or larger): If installing on a physical machine, to create a bootable installer.
  4. Rufus or Etcher: Software to create a bootable USB drive.

Step 1: Download Ubuntu Server ISO

First, you need the Ubuntu Server installation image. Always download it from the official Ubuntu website to ensure you get a legitimate and secure version.

  1. Go to the official Ubuntu Server download page.
  2. Download the latest LTS (Long Term Support) version. LTS releases receive updates and support for five years, making them ideal for servers.

Step 2: Create a Bootable USB Drive

If you're installing on a physical machine, you'll need to create a bootable USB drive from the downloaded ISO.

  1. Insert your USB drive into your computer.
  2. Open Rufus (Windows) or Etcher (Windows/macOS/Linux).
  3. Select the Ubuntu Server ISO file you downloaded.
  4. Select your USB drive as the target device.
  5. Start the writing process. This will erase all data on the USB drive and make it bootable.

If you're using a virtual machine, you can typically mount the ISO file directly as a virtual CD/DVD drive in your VM software (e.g., VirtualBox).

Step 3: Install Ubuntu Server

Now, let's get Ubuntu Server installed.

  1. Boot from the USB/ISO:
    • Physical machine: Plug in the USB, restart your computer, and enter your BIOS/UEFI settings (usually by pressing F2, F10, DEL, or ESC during startup) to set the USB drive as the primary boot device. Save and exit.
    • Virtual machine: Start the VM, and it should automatically boot from the mounted ISO.
  2. Language Selection: Choose your preferred language for the installation.
  3. Keyboard Layout: Select your keyboard layout.
  4. Network Configuration: The installer will attempt to configure your network via DHCP. If you need a static IP, you can configure it here, but for beginners, DHCP is usually fine to start with. Press Done.
  5. Proxy Server: If you're behind a proxy, enter its details. Otherwise, leave blank and press Done.
  6. Mirror Address: The default mirror is usually fine. Press Done.
  7. Storage Configuration: This is a critical step.
    • Use an entire disk: For beginners, the easiest option is to select Use an entire disk. The installer will automatically partition the disk for you. Make sure you select the correct disk if you have multiple drives. This will erase all data on the selected disk.
    • Custom storage layout: More advanced users might choose this to create specific partitions (e.g., separate /home, /var, or /boot partitions).
    • Confirm your choices and proceed.
  8. Profile Setup: Create your user account.
    • Your name: Your full name.
    • Your server's name: A hostname for your server (e.g., myserver).
    • Pick a username: Your login username (e.g., admin).
    • Choose a password: Crucially, pick a strong, unique password.
  9. SSH Setup: The installer will offer to install OpenSSH server. Check this box. This allows you to remotely connect to your server later, which is highly recommended. You can also import an SSH identity from GitHub or Launchpad if you have one, but for now, just installing the server is enough.
  10. Featured Snaps: You'll be presented with a list of popular Snap packages. You can install them now or later. For a clean start, you can skip them and install what you need later.
  11. Installation Begins: The installer will now proceed with copying files and configuring the system. This can take some time.
  12. Reboot: Once the installation is complete, you'll be prompted to Reboot Now. Remove the USB drive when prompted (or unmount the ISO in your VM software) before rebooting.

Congratulations! You've successfully installed Ubuntu Server.

Step 4: Post-Installation Setup and Basic Security

After rebooting, you'll be greeted by a command-line login prompt. Log in with the username and password you created during installation.

4.1 Update Your System

It's crucial to update your server immediately after installation to ensure you have the latest security patches and software versions.

sudo apt update
sudo apt upgrade -y
  • sudo apt update: Refreshes the list of available packages.
  • sudo apt upgrade -y: Installs all available updates. The -y flag automatically confirms prompts.

4.2 Configure the Firewall (UFW)

Ubuntu comes with ufw (Uncomplicated Firewall), which is easy to configure and essential for security.

By default, all incoming connections are blocked. We need to allow SSH so you can connect remotely.

sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status
  • sudo ufw allow OpenSSH: Allows incoming connections on the default SSH port (22).
  • sudo ufw enable: Activates the firewall. You'll be warned that this might disrupt existing SSH connections. Type y and press Enter.
  • sudo ufw status: Verifies the firewall status and allowed rules.

If you plan to run other services (e.g., a web server on port 80/443), you'll need to open those ports with ufw allow http and ufw allow https.

4.3 Install Common Tools (Optional but Recommended)

Some tools make managing your server easier.

sudo apt install git htop nano -y
  • git: Version control system.
  • htop: An interactive process viewer (a more user-friendly alternative to top).
  • nano: A simple text editor (if you prefer it over the default vi/vim).

4.4 SSH into Your Server (Remote Access)

Now that OpenSSH is installed and the firewall is configured, you can connect to your server remotely from another computer.

First, find your server's IP address:

ip a

Look for the inet address under your network interface (e.g., enp0s3).

From your local machine (Windows using PowerShell/WSL, macOS, Linux):

ssh your_username@your_server_ip_address

Replace your_username with the username you created during installation and your_server_ip_address with the actual IP. You'll be prompted for your password.

Next Steps

With your Ubuntu server up and running, here are some ideas for what to do next:

  • Install a Web Server: Set up Apache or Nginx to host websites.
  • Database Server: Install MySQL or PostgreSQL.
  • Docker: Explore containerization for deploying applications.
  • Version Control: Set up a Git server or use git to manage your code.
  • Monitor Your Server: Learn about tools like glances or Prometheus for more detailed monitoring.
  • SSH Key Authentication: For enhanced security, set up passwordless SSH login using SSH keys.

Setting up an Ubuntu server is a fundamental step in many tech journeys. With this guide, you now have a solid foundation to build upon. Happy serving!

Comments

Share your thoughts on this article.

Loading comments…