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

ProviderFree TierBest For
Oracle CloudAlways Free (2 VMs)Best free option
Google Cloud$300 credit, e2-micro always freeGood balance
AWS750 hours/month for 12 monthsIndustry standard
Azure$200 credit + always free tierMicrosoft ecosystem
DigitalOcean$200 credit (60 days)Simple, developer-friendly
Linode$100 creditGood 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

  1. Go to oracle.com/cloud/free
  2. Click "Start for free"
  3. Create account (credit card required for verification, won't be charged)
  4. Select your home region (choose one close to you)

Create a VM

  1. Go to Compute > Instances > Create Instance
  2. Name: linux-learning (or anything)
  3. Image: Ubuntu 22.04 (or latest)
  4. Shape: VM.Standard.E2.1.Micro (always free)
  5. Add SSH keys:
    • Select "Generate a key pair for me"
    • Download BOTH the private and public keys
    • Save them somewhere safe!
  6. Click Create

Connect to Your VM

Wait for the instance to show "Running", then note the Public IP.

Windows (PowerShell):

hljs powershell
ssh -i C:\path\to\your\private-key ubuntu@YOUR_PUBLIC_IP

Mac/Linux:

hljs bash
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

  1. Go to cloud.google.com
  2. Click "Get started for free"
  3. Sign in with Google account
  4. Add billing (get $300 credit, won't charge without consent)

Create a VM

  1. Go to Compute Engine > VM Instances > Create Instance
  2. Name: linux-learning
  3. Region: us-west1, us-central1, or us-east1 (free tier eligible)
  4. Machine type: e2-micro (free tier)
  5. Boot disk: Click Change > Ubuntu 22.04 LTS
  6. Firewall: Allow HTTP/HTTPS if you want web access
  7. 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:

hljs bash
gcloud compute ssh linux-learning

Option 3: AWS (Free Tier)

AWS is industry standard. 750 hours/month free for 12 months.

Sign Up

  1. Go to aws.amazon.com/free
  2. Create account (credit card required)
  3. Select Basic (free) support plan

Create a VM (EC2 Instance)

  1. Go to EC2 > Launch Instance
  2. Name: linux-learning
  3. AMI: Ubuntu Server 22.04 LTS (Free tier eligible)
  4. Instance type: t2.micro (Free tier eligible)
  5. Key pair: Create new key pair, download the .pem file
  6. Network settings: Allow SSH traffic
  7. Click Launch Instance

Connect to Your VM

hljs bash
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:

hljs bash
# 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):

hljs bash
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)"

hljs bash
# 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

  1. Check if instance is running (not stopped/terminated)
  2. Check security group allows SSH (port 22) from your IP
  3. 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!

Knowledge Check

Which cloud provider offers the best always-free VM option?