How to set up a DigitalOcean VPS for AI

Get your own server online and log in with an SSH key.

A place to run your tools without relying on your laptop. Start with a fresh learning server, not an existing business system.

Before you start

Check the live plan and add-on prices before creating anything. Powering off a Droplet does not end its charges.

Setup steps

  1. Create an SSH key

    Where: Your computer / Bash terminal

    This example uses a new key named campus_do. If either file already exists, do not overwrite it: verify the existing pair or choose another name and update later commands. Choose a passphrase when prompted. Only the .pub file goes to DigitalOcean.

    mkdir -p ~/.ssh
    if [ -e ~/.ssh/campus_do ] || [ -e ~/.ssh/campus_do.pub ]; then
      printf '%s\n' 'Key file exists. Verify its pair or choose another name.'
    else
      ssh-keygen -t ed25519 -f ~/.ssh/campus_do -C open-campus
    fi

    Check: You have a matching private key and public .pub file. The private key stays on your computer.

    Official documentation for this step

  2. Add the public key

    Where: Your computer, then DigitalOcean / Settings → Security

    Display the public key below, then add that public text in DigitalOcean’s SSH Keys section. Keep the private file and its passphrase to yourself.

    cat ~/.ssh/campus_do.pub

    Check: The uploaded key is the public key from the pair you will use to connect.

    Official documentation for this step

  3. Choose the server and its cost

    Where: DigitalOcean / Create → Droplets

    Select Ubuntu 24.04 LTS, your region, a plan and the key you just added. Review the displayed price and every add-on before clicking Create. Give it a name you will recognize. Keep this learning server separate from production.

    Check: The Droplet is running, and you know its public IPv4 address, selected key and expected recurring cost.

    Official documentation for this step

  4. Restrict incoming connections

    Where: DigitalOcean / Networking → Firewalls

    Create a Cloud Firewall and inspect its rules before attaching it to this Droplet. Allow inbound TCP 22 only from your public IPv4 address, using /32 for one address. Remove broad inbound sources and other inbound rules for this learning path. Leave the default outbound allowance so updates, DNS and HTTPS can work.

    Check: The attached firewall allows SSH from your address, not from all IPv4 or IPv6 addresses. It is attached only to the intended learning Droplet.

    Official documentation for this step

  5. Make the first SSH connection

    Where: Your computer / a new terminal

    Replace YOUR_DROPLET_IP with the address shown in DigitalOcean. Verify the first-connection host fingerprint through the Droplet console before accepting it. Keep this root session open while setting up and testing your regular account.

    ssh -i ~/.ssh/campus_do root@YOUR_DROPLET_IP

    Check: The remote prompt belongs to your new Droplet. A fingerprint mismatch is a reason to stop, not erase known-host records.

    Official documentation for this step

  6. Create your everyday account

    Where: The root SSH session / fresh learning Droplet only

    Create campus with sudo access and install the authorized public keys for that account. Enter the new account password privately in your terminal. This block stops if campus already exists; inspect existing accounts rather than changing them blindly. It copies root’s authorized public keys, so use it only when those are exactly the keys you intend for campus.

    if id campus >/dev/null 2>&1; then
      printf '%s\n' 'campus already exists. Stop and inspect it.'
    else
      adduser campus &&
      usermod -aG sudo campus &&
      install -d -m 700 -o campus -g campus /home/campus/.ssh &&
      install -m 600 -o campus -g campus /root/.ssh/authorized_keys /home/campus/.ssh/authorized_keys
    fi

    Check: The new account exists; its .ssh directory belongs to campus and its authorized_keys contains only the intended public keys.

    Official documentation for this step

  7. Test the account before moving on

    Where: Your computer / a second terminal

    Open a separate connection as campus. In that remote session, run whoami and sudo -v; use the account password you set if prompted. Only after this works should you close the original root session. Use campus for the Hermes guide.

    ssh -i ~/.ssh/campus_do campus@YOUR_DROPLET_IP

    Check: The second session identifies you as campus, and sudo -v succeeds. You still know how to reach the server’s console.

    Official documentation for this step

Troubleshooting

SSH times out
Check the Droplet IP and current source IP in the firewall. Use DigitalOcean’s console if your address changed.
Permission denied (publickey)
Check the username, the -i filename, and that the matching public key was selected when the Droplet was created.
You no longer need the server
Back up what you need first. The owner can then destroy the Droplet in DigitalOcean; this is destructive. Separately review billable backups, snapshots or volumes. Powering off alone does not end Droplet charges.

Completion checklist

Official references

Continue learning

Open this chapter in the interactive Setup Book

Need help applying this to your business? Talk with Jonathan at Plinko Solutions or explore Open Campus coaching options.