How to Setup Your First VPS on DigitalOcean
Hello from Bishworaj Poudel, setting up your first VPS (Virtual Private Server) might seem intimidating, but it's actually quite straightforward. A VPS is like having your own computer running online 24/7 that you can access from anywhere.
In this guide, I'll walk you through setting up your first VPS on DigitalOcean step by step. By the end, you'll have your own server running and ready to use.
What is a Droplet?
A Droplet is DigitalOcean's term for a VPS. Think of it as someone else's computer running online 24/7 that you can rent and control remotely. You can install software, host websites, run applications, and do almost anything you'd do with a regular computer.
Creating Your Droplet
Step 1: Choose Your VPS Provider
Popular VPS providers include:
- DigitalOcean (Great for beginners)
- Hetzner (Budget-friendly)
- AWS (Enterprise-level)
- Linode (Developer-friendly)
For this guide, we'll use DigitalOcean.
Step 2: Create Account and Verify
- Go to DigitalOcean and sign up
- Verify your email address
- Add a payment method (required, but you can get $200 free credit!)
Step 3: Login to Your Account
Once verified, log in to your DigitalOcean dashboard.
Step 4: Generate SSH Key
Before creating a droplet, you need to set up SSH (Secure Shell) for secure access to your server.
On your local computer, open terminal and run:
1ssh-keygen -t ed25519 -C "[email protected]"
- Press Enter to accept the default file location
- Optionally set a passphrase (or press Enter for no passphrase)
This creates two files:
- Private key (
~/.ssh/id_ed25519) - Keep this secret! - Public key (
~/.ssh/id_ed25519.pub) - This is safe to share
Step 5: Add Public Key to DigitalOcean
- Copy your public key:
1cat ~/.ssh/id_ed25519.pub - In DigitalOcean dashboard, go to Settings → Security → SSH Keys
- Click Add SSH Key
- Paste your public key and give it a name
- Click Add SSH Key
Step 6: Create Your Droplet
- Click Create → Droplets in the DigitalOcean dashboard
- Choose Region: Select the closest region to your users
- Choose OS: Select Ubuntu (recommended for beginners)
- Choose Plan: Start with the Basic plan ($4/month is perfect for learning)
- Add SSH Keys: Select the SSH key you added earlier
- Finalize: Give your droplet a name (e.g., "my-first-server")
- Click Create Droplet
Wait 1-2 minutes for your droplet to be created. You'll see your server's IP address once it's ready.
Connecting to Your Droplet
Step 1: Open Your Server
Once your droplet is created, you'll see an IP address (like 68.183.85.9).
Run this command in your terminal:
1ssh root@<Your IP Address>
Example:
1ssh [email protected]
The first time you connect, you'll see a message asking to confirm the server's identity. Type yes and press Enter.
Step 2: You're In!
Congratulations! You're now connected to your server. You'll see a command prompt like:
1root@your-droplet-name:~#
This means you're controlling your remote server from your local terminal.
First Things to Do with Your Server
Once connected, run these essential commands to update your server:
1sudo apt update
2sudo apt upgrade -y
1sudo apt update && sudo apt upgrade -y
What these do:
apt update- Downloads the list of available software updatesapt upgrade -y- Installs all available updates (the-yflag automatically says "yes")
This ensures your server has the latest security patches and software updates.
💡 Pro Tips
- Keep your private key safe: Never share
~/.ssh/id_ed25519with anyone - Use strong passwords: Even with SSH keys, use strong passwords for your server
- Regular updates: Run
apt update && apt upgrade -yweekly - Backup important data: Always backup files you can't afford to lose
Get Started with $200 Free Credit
Use this referral link to get $200 free credit for 2 months on DigitalOcean:
Get $200 Free For 2 Month On DigitalOcean
This is perfect for learning and experimenting with your first VPS!
Learn More About Server Management
Join our community of developers:
- Website: technologychannel.org
- Email: [email protected]
- YouTube: Technology Channel - 290K+ Subscribers