Skip to content

Ubuntu Server Setup & CLI Walkthrough

This walkthrough will guide you through installing Ubuntu Server 22.04 in a local virtual machine and preparing the sever with essential command-line tools. By the end, you will have a basic but working Linux server environment with a simple web service running.

This guide is written for developers, students, or sysadmins new to Linux who want hands-on experience with the server edition of Ubuntu in a safe, local environment. No prior Linux administration experience is required, though some familiarity with the command line will help.

Before starting, make sure you have:

  • A virtualization tool such as VirtualBox, VMware, or WSL2. This allows you to run Ubuntu in a contained environment without affecting your main operating system.

  • Ubuntu Server 22.04 ISO image, downloadable from the Ubuntu website.

  • Basic command-line knowledge (navigating directories, running commands with sudo).

  1. Open your virtualization tool and create a new virtual machine. Allocate at least 2 CPU cores, 2 GB of RAM, and 20 GB of disk space.

  2. Mount the Ubuntu Server ISO as the VM’s boot device.

  3. Start the VM and follow the on-screen installer prompts:

    • Select your language and region/timezone.

    • Create a user account with a strong password.

    • Choose default options unless you have specific requirements.

  4. After installation completes, reboot the VM. You should see a login prompt for your new Ubuntu system.

    VM settings
    VirtualBox VM setup wizard showing CPU/RAM settings.

Keeping your system up to date ensures you have the latest security patches and software.

  1. Log in with the username you created.

  2. Update package lists:

    Terminal window
    sudo apt update
  3. Upgrade installed packages:

    Terminal window
    sudo apt upgrade
  4. Verify the update by checking OS version and kernel:

    Terminal window
    lsb_release -a
    uname -r
    apt upgrade
    Terminal showing successful apt upgrade with updated packages.

Ubuntu Server starts with a minimal set of packages. Let’s add some common tools:

  • Git (for source code version control):

    Terminal window
    sudo apt install git
  • curl (for testing APIs and fetching data over HTTP):

    Terminal window
    sudo apt install curl
  • htop (optional; real-time process monitor):

    Terminal window
    sudo apt install htop

After installation, you can test:

Terminal window
git --version
curl --version
htop --version
htop running
htop running in terminal.

To confirm our environment works, we’ll install nginx, a lightweight web server.

  1. Install nginx:

    Terminal window
    sudo apt install nginx
  2. Start the service:

    Terminal window
    sudo systemctl start nginx
  3. Check status:

    Terminal window
    sudo systemctl status nginx

    Look for Active: active (running) in the output.

    nginx service status
    nginx service status showing active.
  1. From inside the VM, run:
    Terminal window
    curl http://localhost

You should see HTML output starting with <html><head><title>Welcome to nginx!</title></head>.

  1. If your VM uses a bridged or NAT network, open a browser on your host machine and visit http://127.0.0.1 or the VM’s assigned IP.

  2. You should see the default “Welcome to nginx!” page.

    nginx welcome page
    nginx welcome page in browser.

Congratulations! You now have a basic Ubuntu Server VM with tools and a running web service.

From here you can:

  • Secure the server with a firewall:

    Terminal window
    sudo ufw allow 'Nginx HTTP'
    sudo ufw enable
  • Add HTTPS with Let’s Encrypt using certbot.

  • Explore the Ubuntu Server documentation for advanced configuration and best practices.