Skip to content

Instantly share code, notes, and snippets.

@fedewedreamlabsio
Created January 15, 2026 19:12
Show Gist options
  • Select an option

  • Save fedewedreamlabsio/145d6912761876f8341a641ff0041c2d to your computer and use it in GitHub Desktop.

Select an option

Save fedewedreamlabsio/145d6912761876f8341a641ff0041c2d to your computer and use it in GitHub Desktop.
Rawdog VPS Dev Setup - Complete guide & quick start for cross-device development with AI agents (Codex + Factory AI)

Rawdog VPS Dev Setup - Complete Guide

What this gets you: Code on any device. AI agents running 24/7. One persistent workspace.

Cost: $16/month DigitalOcean droplet

Time: One afternoon


Part 1: Create the VPS

1.1 DigitalOcean Droplet

Go to: https://cloud.digitalocean.com/droplets/new

Settings:

  • Image: Ubuntu 24.04 LTS
  • Plan: Basic ($16/month)
  • CPU: Regular, 2GB RAM / 1 CPU
  • Datacenter: Pick closest to you
  • Authentication: SSH keys (we'll create this next)

Don't create it yet. First, generate SSH keys.


Part 2: SSH Keys (For Connecting)

2.1 Generate SSH Key on Your Laptop

Windows (PowerShell):

ssh-keygen -t ed25519 -C "your_email@example.com"

Mac/Linux:

ssh-keygen -t ed25519 -C "your_email@example.com"

Prompts:

  • Where to save: Press Enter (default location)
  • Passphrase: Choose a passphrase or press Enter (no passphrase)

2.2 Copy Your PUBLIC Key

Windows:

Get-Content "$env:USERPROFILE\.ssh\id_ed25519.pub"

Mac/Linux:

cat ~/.ssh/id_ed25519.pub

Copy the entire output (starts with ssh-ed25519 ...)

2.3 Add to DigitalOcean

Back in DigitalOcean droplet creation:

  • Click "New SSH Key"
  • Paste your public key
  • Name it (e.g., "my-laptop")
  • Click "Add SSH Key"

Now create the droplet. Wait 60 seconds for it to spin up.


Part 3: Initial Server Setup

3.1 Get Your Droplet IP

From DigitalOcean dashboard, copy your droplet's IPv4 address

Example: 206.189.12.245

3.2 Connect as Root

ssh root@YOUR_DROPLET_IP

Type "yes" when asked about fingerprint.

3.3 Update System

apt update
apt upgrade -y

If you see a pink screen about services, press Tab → Enter (use default).

3.4 Create Your User

Replace cosmo with your username:

adduser cosmo

Enter password when prompted. Press Enter through other prompts (or fill them in).

3.5 Give User Sudo Access

usermod -aG sudo cosmo

3.6 Copy SSH Keys to New User

mkdir -p /home/cosmo/.ssh
cp /root/.ssh/authorized_keys /home/cosmo/.ssh/authorized_keys
chown -R cosmo:cosmo /home/cosmo/.ssh
chmod 700 /home/cosmo/.ssh
chmod 600 /home/cosmo/.ssh/authorized_keys

3.7 Test New User

Open a NEW terminal window (keep root one open). Try:

ssh cosmo@YOUR_DROPLET_IP

Should work without password. If it does, close root terminal.


Part 4: Secure the Server

Connect as your user (not root):

ssh cosmo@YOUR_DROPLET_IP

4.1 Setup Firewall

sudo ufw allow OpenSSH
sudo ufw enable

Type "y" when prompted.

4.2 Verify Firewall

sudo ufw status

Should show: Status: active with OpenSSH allowed.


Part 5: Install Core Tools

5.1 Install tmux

sudo apt install tmux -y

5.2 Configure tmux

nano ~/.tmux.conf

Paste this:

# Better colors + mouse support
set -g default-terminal "screen-256color"
set -g mouse on

# Faster key response
set -sg escape-time 0

# Bigger scrollback
set -g history-limit 100000

# Easier pane navigation
setw -g mode-keys vi

Save: Ctrl+O → Enter → Ctrl+X

5.3 Create Directory Structure

mkdir -p ~/repos/work ~/repos/side ~/repos/playground
mkdir -p ~/bin
mkdir -p ~/tmp

5.4 Add bin to PATH

nano ~/.bashrc

Add at the end:

# Add local bin to PATH
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"

# Auto-attach tmux on SSH login
if [ -n "$SSH_CONNECTION" ] && [ -z "$TMUX" ]; then
  tmux attach -t main || tmux new -s main
fi

Save: Ctrl+O → Enter → Ctrl+X

5.5 Create tmux Shortcuts

nano ~/bin/ta

Paste:

#!/usr/bin/env bash
tmux attach -t main || tmux new -s main

Save and exit.

nano ~/bin/td

Paste:

#!/usr/bin/env bash
tmux detach

Save and exit.

Make them executable:

chmod +x ~/bin/ta ~/bin/td

5.6 Reload Config

source ~/.bashrc

Part 6: GitHub Access

Your VPS needs to access GitHub to clone repos.

6.1 Generate GitHub SSH Key (On VPS)

ssh-keygen -t ed25519 -C "your_email@example.com"

Press Enter for all prompts (default location, no passphrase).

6.2 Copy the Key

cat ~/.ssh/id_ed25519.pub

Copy the entire output.

6.3 Add to GitHub

  1. Go to: https://github.com/settings/keys
  2. Click "New SSH key"
  3. Title: "VPS - Rawdog Dev"
  4. Paste the key
  5. Click "Add SSH key"

6.4 Test GitHub Connection

ssh -T git@github.com

Type "yes" when prompted.

Should see: Hi username! You've successfully authenticated...


Part 7: Install AI Coding Agents

7.1 Install OpenAI Codex CLI

curl -fsSL https://cli.openai.com/install.sh | sh

Follow the prompts.

Authentication:

If device-code auth doesn't work, do this on your laptop:

Windows:

scp -i "$env:USERPROFILE\.ssh\id_ed25519" "$env:USERPROFILE\.codex\auth.json" cosmo@YOUR_DROPLET_IP:~/.codex/auth.json

Mac/Linux:

scp ~/.codex/auth.json cosmo@YOUR_DROPLET_IP:~/.codex/auth.json

7.2 Install Factory AI Droids

pip install factory-cli

Or:

curl -fsSL https://factory.ai/install.sh | sh

(Check Factory AI docs for latest install method)

Test it:

droid --version

If not found, make sure PATH is set:

export PATH="$HOME/.local/bin:$PATH"

Or create symlink:

ln -s ~/.local/bin/droid ~/bin/droid

Part 8: Clone Your First Repo

8.1 Navigate to Directory

cd ~/repos/side

(or ~/repos/work for work projects)

8.2 Clone a Repo

git clone git@github.com:yourusername/yourrepo.git
cd yourrepo

8.3 Test Codex

codex

Should open Codex in your repo.

8.4 Test Factory Droids

droid

Should start Factory droid session.


Part 9: Connect From Phone

9.1 Install Termius

iOS: https://apps.apple.com/app/termius/id549039908 Android: https://play.google.com/store/apps/details?id=com.server.auditor.ssh.client

9.2 Setup Connection in Termius

  1. Open Termius → New Host
  2. Label: "Rawdog VPS"
  3. Hostname: Your droplet IP
  4. Username: cosmo (your username)
  5. Port: 22

9.3 Add SSH Key

  1. In Termius → Settings → Keychain
  2. Tap "+" → Import
  3. On laptop, find your SSH private key:
    • Windows: C:\Users\YourName\.ssh\id_ed25519
    • Mac/Linux: ~/.ssh/id_ed25519
  4. Transfer it to your phone (AirDrop, email to yourself, etc.)
  5. Import the file (NOT the .pub file)
  6. Enter passphrase if you set one

9.4 Link Key to Host

  1. Edit your host in Termius
  2. Keys: Select the key you just imported
  3. Save

9.5 Connect

Tap your host. Should connect without password.

You'll automatically land in tmux session main.


Part 10: The Cross-Device Magic

10.1 On Laptop

ssh cosmo@YOUR_DROPLET_IP

Auto-lands in tmux main.

Start coding:

cd ~/repos/side/yourrepo
codex

When done, detach:

tmux detach

Or press: Ctrl+b then d

Or just close terminal.

10.2 On Phone

Open Termius → Connect to your host

Run:

tmux attach -t main

Or use shortcut:

ta

You're exactly where you left off on laptop. Same cursor position. Same everything.


Part 11: Daily Workflow

Connect

ssh cosmo@YOUR_DROPLET_IP

Auto-attaches to tmux main.

Navigate

cd ~/repos/work/project-name

Start Coding with AI

codex           # For OpenAI Codex
droid           # For Factory AI droids

Detach When Switching Devices

tmux detach     # Or use: td

Re-attach on Different Device

tmux attach -t main    # Or use: ta

Check What's Running

tmux ls

Kill Session (Restart Fresh)

tmux kill-session -t main
tmux new -s main

Quick Reference Commands

SSH

ssh cosmo@YOUR_DROPLET_IP       # Connect from anywhere

tmux Sessions

tmux new -s main                 # Create session
tmux attach -t main              # Attach to session
tmux detach                      # Detach (keep running)
tmux ls                          # List sessions
tmux kill-session -t main        # Kill session

Navigation

cd ~/repos/work                  # Work projects
cd ~/repos/side                  # Side projects
cd ~/repos/playground            # Experiments

AI Agents

codex                            # OpenAI Codex
droid                            # Factory AI droids

Git

git clone git@github.com:user/repo.git
git status
git add .
git commit -m "message"
git push

Troubleshooting

Can't connect via SSH

  • Check droplet IP is correct
  • Verify SSH key is in ~/.ssh/authorized_keys on server
  • Try: ssh -v cosmo@YOUR_IP for debug info

"Permission denied (publickey)"

  • Make sure you're using the right username
  • Verify SSH key permissions on laptop: chmod 600 ~/.ssh/id_ed25519
  • Check ~/.ssh/authorized_keys exists on server

tmux not auto-attaching

  • Check ~/.bashrc has the auto-attach code
  • Run: source ~/.bashrc
  • Log out and back in

droid not found

  • Check PATH: echo $PATH should include /home/yourusername/.local/bin
  • Add to current session: export PATH="$HOME/.local/bin:$PATH"
  • Or create symlink: ln -s ~/.local/bin/droid ~/bin/droid
  • Restart tmux: tmux kill-server then reconnect

Lost in nested tmux

  • Don't run tmux inside tmux
  • Check if you're in tmux: echo $TMUX
  • Detach properly before creating new session

Can't clone from GitHub

  • Test SSH: ssh -T git@github.com
  • Verify SSH key added to GitHub
  • Check key permissions: chmod 600 ~/.ssh/id_ed25519

What You Now Have

✅ $16/month VPS running Ubuntu ✅ Secure SSH access from laptop + phone ✅ tmux persistent sessions (never lose work) ✅ Directory structure (work/side/playground) ✅ GitHub access from VPS ✅ OpenAI Codex running 24/7 ✅ Factory AI droids running 24/7 ✅ Cross-device coding (same session everywhere)

Your code lives in one place. Your agents live in one place. You access them from anywhere.

The device is now irrelevant.


Next Steps

  1. Clone your repos to ~/repos/
  2. Test cross-device (laptop → phone → same session)
  3. Set up shortcuts in your terminal (aliases, functions)
  4. Install other tools you need (Node, Python, Docker, etc.)
  5. Configure Nginx if you want to host web apps

This is the foundation. Everything else builds on this.


Credits

Setup inspired by @levelsio's "rawdog dev on the server" approach.

AI agents: OpenAI Codex + Factory AI


Questions? Issues?

DM me: @cosmo_kappa

I'm documenting this publicly. If something breaks, I want to know so I can update this guide.


Last Updated: 2026-01-15 Version: 1.0 Tested on: Ubuntu 24.04 LTS, DigitalOcean Droplet

Rawdog VPS - Quick Start (Copy-Paste Edition)

Goal: Code on any device. AI agents 24/7. One workspace.


1. Create VPS ($16/month)

DigitalOcean → Ubuntu 24.04 → 2GB RAM → Add SSH key (generate below)


2. SSH Key (Laptop)

# Generate
ssh-keygen -t ed25519 -C "your@email.com"

# Copy public key
cat ~/.ssh/id_ed25519.pub    # Mac/Linux
# or
Get-Content "$env:USERPROFILE\.ssh\id_ed25519.pub"    # Windows

# Paste into DigitalOcean SSH keys section

3. Connect & Setup

# Connect as root
ssh root@YOUR_DROPLET_IP

# Update
apt update && apt upgrade -y

# Create user
adduser cosmo
usermod -aG sudo cosmo

# Copy SSH keys
mkdir -p /home/cosmo/.ssh
cp /root/.ssh/authorized_keys /home/cosmo/.ssh/authorized_keys
chown -R cosmo:cosmo /home/cosmo/.ssh
chmod 700 /home/cosmo/.ssh
chmod 600 /home/cosmo/.ssh/authorized_keys

# Exit and test new user
exit
ssh cosmo@YOUR_DROPLET_IP

4. Secure & Install Tools

# Firewall
sudo ufw allow OpenSSH
sudo ufw enable

# tmux
sudo apt install tmux -y

# Directories
mkdir -p ~/repos/{work,side,playground} ~/bin ~/tmp

5. Configure tmux

# Create config
cat > ~/.tmux.conf << 'EOF'
set -g default-terminal "screen-256color"
set -g mouse on
set -sg escape-time 0
set -g history-limit 100000
setw -g mode-keys vi
EOF

6. Auto-attach tmux

# Add to ~/.bashrc
cat >> ~/.bashrc << 'EOF'

# Add local bin to PATH
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"

# Auto-attach tmux on SSH login
if [ -n "$SSH_CONNECTION" ] && [ -z "$TMUX" ]; then
  tmux attach -t main || tmux new -s main
fi
EOF

# Reload
source ~/.bashrc

7. GitHub Access

# Generate key on VPS
ssh-keygen -t ed25519 -C "your@email.com"

# Copy public key
cat ~/.ssh/id_ed25519.pub

# Add to: https://github.com/settings/keys

# Test
ssh -T git@github.com

8. Install AI Agents

# Codex
curl -fsSL https://cli.openai.com/install.sh | sh

# Factory Droids
pip install factory-cli

# Test
codex --version
droid --version

If droid not found:

export PATH="$HOME/.local/bin:$PATH"
ln -s ~/.local/bin/droid ~/bin/droid

9. Clone Repo & Test

cd ~/repos/side
git clone git@github.com:yourusername/yourrepo.git
cd yourrepo

# Test agents
codex
droid

10. Phone Setup (Termius)

  1. Install Termius app
  2. New Host:
    • Hostname: YOUR_DROPLET_IP
    • Username: cosmo
    • Port: 22
  3. Import SSH key (~/.ssh/id_ed25519)
  4. Connect

Daily Commands

# Connect (from any device)
ssh cosmo@YOUR_DROPLET_IP       # Auto-lands in tmux

# Navigate
cd ~/repos/work/project

# Code with AI
codex    # or: droid

# Detach (switch device)
tmux detach    # or: Ctrl+b then d

# Re-attach (different device)
tmux attach -t main

# List sessions
tmux ls

# Kill session (restart fresh)
tmux kill-session -t main

Troubleshooting

Can't SSH:

ssh -v cosmo@YOUR_IP    # Debug mode

droid not found:

export PATH="$HOME/.local/bin:$PATH"
source ~/.bashrc

Lost in tmux:

echo $TMUX    # If output = you're in tmux
tmux detach   # Get out

GitHub clone fails:

ssh -T git@github.com    # Test GitHub access

That's It

  • Code lives on VPS
  • Agents run 24/7
  • Access from any device
  • tmux keeps everything persistent

Device is now irrelevant.


Full guide: [link to detailed guide] Questions: @cosmo_kappa

Inspired by @levelsio | Powered by Codex + Factory AI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment