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)
- Sign Up / Log In:
- Visit DigitalOcean and log in or sign up for an account.
- Billing & Payment:
- Make sure your billing information is set up so you can create Droplets.
2. Create a New Droplet with Ubuntu 24.04
3. Connect to Your Droplet via SSH
-
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).
-
Connect to the Droplet:
- Run the following command, replacing
username
(usuallyroot
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
).
- Run the following command, replacing
-
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
- Update Package Lists:
apt update
- Upgrade Packages:
apt upgrade -y
b. Create a Non-Root User (Optional but Recommended)
- Create a User:
adduser yourusername
- Grant Sudo Privileges:
usermod -aG sudo yourusername
- Test by Logging in as Your New User:
- Log out of the root session:
exit
- Log in again using:
ssh yourusername@<droplet_ip>
- Log out of the root session:
c. Secure SSH Access
-
Edit the SSH Configuration:
sudo nano /etc/ssh/sshd_config
-
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
, thenY
, thenEnter
).
- Disable root login (if not needed):
-
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
- Allow SSH Connections:
sudo ufw allow ssh
- If you changed your SSH port, use:
sudo ufw allow 2222/tcp
- If you changed your SSH port, use:
- Enable UFW:
sudo ufw enable
- 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
-
Documentation:
Check out DigitalOcean’s tutorials and Ubuntu Server documentation for advanced configurations. -
Security:
Regularly update your server and monitor logs to keep your server secure.
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!