Setting Up a Cloud Linux VM
Can't install software on your computer? Want to practice with a real server? Cloud VMs are your answer. Most providers offer free tiers that work perfectly for learning.
Why Cloud VMs?
- No installation needed on your local machine
- Real server experience - this is how production works
- SSH practice - essential skill for any developer/DevOps
- Free tiers available - $0 for learning
Your Options
| Provider | Free Tier | Best For |
|---|---|---|
| Oracle Cloud | Always Free (2 VMs) | Best free option |
| Google Cloud | $300 credit, e2-micro always free | Good balance |
| AWS | 750 hours/month for 12 months | Industry standard |
| Azure | $200 credit + always free tier | Microsoft ecosystem |
| DigitalOcean | $200 credit (60 days) | Simple, developer-friendly |
| Linode | $100 credit | Good performance |
My Recommendation
Oracle Cloud Always Free gives you 2 VMs forever with no credit card charges. It's the best option for learning.
Option 1: Oracle Cloud (Always Free)
Oracle's free tier is genuinely free - no surprise charges.
Sign Up
- Go to oracle.com/cloud/free
- Click "Start for free"
- Create account (credit card required for verification, won't be charged)
- Select your home region (choose one close to you)
Create a VM
- Go to Compute > Instances > Create Instance
- Name: linux-learning (or anything)
- Image: Ubuntu 22.04 (or latest)
- Shape: VM.Standard.E2.1.Micro (always free)
- Add SSH keys:
- Select "Generate a key pair for me"
- Download BOTH the private and public keys
- Save them somewhere safe!
- Click Create
Connect to Your VM
Wait for the instance to show "Running", then note the Public IP.
Windows (PowerShell):
ssh -i C:\path\to\your\private-key ubuntu@YOUR_PUBLIC_IP
Mac/Linux:
chmod 400 ~/Downloads/your-private-key
ssh -i ~/Downloads/your-private-key ubuntu@YOUR_PUBLIC_IP
Option 2: Google Cloud (Free Tier)
Google's e2-micro VM is always free in select regions.
Sign Up
- Go to cloud.google.com
- Click "Get started for free"
- Sign in with Google account
- Add billing (get $300 credit, won't charge without consent)
Create a VM
- Go to Compute Engine > VM Instances > Create Instance
- Name: linux-learning
- Region: us-west1, us-central1, or us-east1 (free tier eligible)
- Machine type: e2-micro (free tier)
- Boot disk: Click Change > Ubuntu 22.04 LTS
- Firewall: Allow HTTP/HTTPS if you want web access
- Click Create
Connect to Your VM
Click SSH button next to your instance - opens a browser terminal. No local setup needed!
Or use the gcloud CLI:
gcloud compute ssh linux-learning
Option 3: AWS (Free Tier)
AWS is industry standard. 750 hours/month free for 12 months.
Sign Up
- Go to aws.amazon.com/free
- Create account (credit card required)
- Select Basic (free) support plan
Create a VM (EC2 Instance)
- Go to EC2 > Launch Instance
- Name: linux-learning
- AMI: Ubuntu Server 22.04 LTS (Free tier eligible)
- Instance type: t2.micro (Free tier eligible)
- Key pair: Create new key pair, download the .pem file
- Network settings: Allow SSH traffic
- Click Launch Instance
Connect to Your VM
chmod 400 ~/Downloads/your-key.pem
ssh -i ~/Downloads/your-key.pem ubuntu@YOUR_PUBLIC_IP
Find your Public IP in the EC2 console.
First Steps After Connecting
Once you're SSH'd into any cloud VM:
# Update everything
sudo apt update && sudo apt upgrade -y
# Install useful tools
sudo apt install -y git curl wget htop tree vim nano
# Verify it's working
uname -a
whoami
pwd
You now have a real Linux server to practice on.
SSH Key Tips
Protect Your Private Key
Your private key is like a password. Never share it, never commit it to git, and keep it safe. If someone gets it, they can access your server.
Create your own SSH key (recommended):
ssh-keygen -t ed25519 -C "your-email@example.com"
This creates:
~/.ssh/id_ed25519- Private key (keep secret!)~/.ssh/id_ed25519.pub- Public key (upload to cloud provider)
Cost Management
Avoid Surprise Bills
Cloud providers can charge real money if you exceed free tier. Set up billing alerts!
Oracle: Truly free, can't be charged if you stay in Always Free GCP: Set budget alerts at $1 and $10 AWS: Set CloudWatch billing alarms All: Stop/terminate VMs when not using them
Stopping vs Terminating
- Stop: Pauses the VM, keeps your data, may still incur storage costs
- Terminate/Delete: Destroys everything, no more charges
For learning: Terminate when done and create fresh when needed.
Troubleshooting
Common Mistakes
- Permission denied (publickey): Your private key doesn't match or has wrong permissions (needs
chmod 400) - Connection refused: VM might not be running, or security group/firewall blocking port 22
- Host key verification failed: The server's IP changed. Remove old entry with
ssh-keygen -R IP_ADDRESS - Lost SSH key: If you lose your private key, you'll need to create a new VM (there's no recovery)
"Permission denied (publickey)"
# Make sure key has correct permissions
chmod 400 ~/path/to/your-key.pem
# Make sure you're using the right username
# Ubuntu: ubuntu
# Amazon Linux: ec2-user
# Debian: admin or debian
Can't connect at all
- Check if instance is running (not stopped/terminated)
- Check security group allows SSH (port 22) from your IP
- Verify you're using the correct public IP (it changes if you stop/start)
SSH times out Firewall is blocking you. Check your cloud provider's security group/firewall rules.
You're Ready!
You now have access to a real Linux server in the cloud. This is exactly how production servers work - you'll SSH in, run commands, and manage the system remotely.
Head back to the course introduction and start learning!
Which cloud provider offers the best always-free VM option?