Skip to main content

DigitalOcean: Install Ubuntu 24.04

Below is a step‐by‐step guide for launching and configuring an Ubuntu 24.04 headless server on DigitalOcean. This tutorial will walk you through creating a Droplet, connecting via SSH, and performing basic post-deployment configuration.


1. Create a DigitalOcean Account (if you haven’t already)

  1. Sign Up / Log In:
  2. Billing & Payment:
    • Make sure your billing information is set up so you can create Droplets.

2. Create a New Droplet with Ubuntu 24.04

  1. Navigate to Droplets:

    • In the DigitalOcean control panel, click Create and select Droplets.
  2. Choose an Image:

    • Under “Distributions”, find and select Ubuntu 24.04 LTS.

      Note: DigitalOcean’s images are headless by default (no GUI).

  3. Select a Plan:

    • Choose the Droplet size that best fits your needs (e.g., Basic with 1-2 GB of RAM for lightweight tasks, or larger for production workloads).
  4. Choose a Datacenter Region:

    • Select the region closest to your target audience for better latency.
  5. Authentication:

    • SSH Keys (Recommended):
      • Add your SSH public key to securely access the Droplet.
    • Password Authentication:
      • Alternatively, choose to use a strong password (less secure; not recommended if you can use SSH keys).
  6. Additional Options:

    • You may optionally enable backups, monitoring, and IPv6 if needed.
    • Tag your Droplet for easier organization.
  7. Finalize and Create:

    • Click Create Droplet.
    • After a few moments, your Droplet will be ready. You’ll see its public IP address on the DigitalOcean dashboard.

3. Connect to Your Droplet via SSH

  1. Open a Terminal:

    • On Linux/macOS, open your terminal.
    • On Windows, use an SSH client like PuTTY or the built-in Windows Terminal (if using OpenSSH).
  2. Connect to the Droplet:

    • Run the following command, replacing username (usually root on first login) and <droplet_ip> with your Droplet’s IP address:
      ssh root@<droplet_ip>
    • If using an SSH key, ensure your key is loaded (using ssh-agent or specifying -i path/to/your/key).
  3. Accept the Fingerprint:

    • When prompted, type yes to continue connecting.

4. Initial Post-Installation Setup

Once connected, perform these basic steps to secure and update your server.

a. Update and Upgrade Packages

  1. Update Package Lists:
    apt update
  2. Upgrade Packages:
    apt upgrade -y

b. Create a Non-Root User (Optional but Recommended)

  1. Create a User:
    adduser yourusername
  2. Grant Sudo Privileges:
    usermod -aG sudo yourusername
  3. Test by Logging in as Your New User:
    • Log out of the root session:
      exit
    • Log in again using:
      ssh yourusername@<droplet_ip>

c. Secure SSH Access

  1. Edit the SSH Configuration:

    sudo nano /etc/ssh/sshd_config
  2. Recommended Changes:

    • Disable root login (if not needed):
      PermitRootLogin no
    • (Optional) Change the default SSH port (e.g., to 2222):
      Port 2222
    • Save and exit the editor (in nano, press Ctrl+X, then Y, then Enter).
  3. Restart SSH Service:

    sudo systemctl restart ssh

    Note: If you change the SSH port, connect with:
    ssh -p 2222 yourusername@<droplet_ip>

d. Configure the UFW Firewall

  1. Allow SSH Connections:
    sudo ufw allow ssh
    • If you changed your SSH port, use:
      sudo ufw allow 2222/tcp
  2. Enable UFW:
    sudo ufw enable
  3. Check Firewall Status:
    sudo ufw status verbose

5. Install Essential Server Packages

Depending on your intended use, install additional tools. Here are some common utilities:

sudo apt install build-essential curl git vim htop -y

You can install other services (e.g., web server, database, etc.) as needed.


6. Additional DigitalOcean Features

DigitalOcean offers a range of additional features to manage your server:

  • Snapshots and Backups:
    Consider enabling regular backups or taking snapshots via the DigitalOcean control panel.

  • Monitoring:
    Use DigitalOcean Monitoring to track your Droplet’s performance.

  • Cloud Firewalls:
    Optionally configure DigitalOcean Cloud Firewalls from the control panel for an extra layer of network security.


7. Final Thoughts

Congratulations! Your Ubuntu 24.04 headless server on DigitalOcean is now set up and ready for further customization and deployment of your applications. Enjoy your new DigitalOcean Droplet!