Alright, let me walk you through this. I remember my first time moving a Node.js application like OpenClaw from my cozy local machine to a remote server. It felt like a big leap, but once you break it down, it’s incredibly satisfying to see your bot running 24/7 in the cloud. I’ve done this exact migration to Hetzner Cloud for a few projects, and I can tell you, their Ubuntu servers are a solid choice.
Looking to get a VPS for your project? Vultr offers reliable VPS hosting starting at $5/month with global data centers. Many OpenClaw users self-host on Vultr for consistent uptime and affordable pricing.
\n
Affiliate Disclosure: As an Amazon Associate, we earn from qualifying purchases. This means we may earn a small commission when you click our links and make a purchase on Amazon. This comes at no extra cost to you and helps support our site.
\n
This guide assumes you’ve already got OpenClaw running locally and have its `config.json` file ready.
\n
## Before You Start: Local Machine Prep
\n
Before we even touch the VPS, there are a couple of things you need to secure from your local OpenClaw setup:
\n
1. **Your `config.json` file:** This is crucial. It contains all your API keys, Telegram bot token, admin IDs, and other critical settings. Copy it somewhere safe on your local machine. **Do not** commit this file to a public Git repository!
\n2. **Any custom data:** If your OpenClaw instance generates or relies on specific files or a `data` directory, make sure to back those up too. For a fresh install, `config.json` is usually the only essential.
\n
## Step 1: Provisioning Your Hetzner VPS and Initial SSH Setup
\n
First things first, let’s get your server online and secure your access.
\n
1. **Spin up a Server on Hetzner:**
\n * Log in to your Hetzner Cloud console.
\n * Click “Add Server.”
\n * Choose your location (Frankfurt, Ashburn, etc.).
\n * Select **Ubuntu 22.04 LTS** (or the latest LTS version available).
\n * Pick a server type. For OpenClaw, a `CPX11` or `CPX21` (2GB RAM) is usually more than enough.
\n * **Crucially, add your SSH key.** If you don’t have one, generate it on your local machine:
\n bash
\n ssh-keygen -t rsa -b 4096 -C “your_email@example.com”
\n
Follow the prompts. Then, display your public key:
\n bash
\n cat ~/.ssh/id_rsa.pub
\n
Copy the entire output and paste it into Hetzner’s “SSH Keys” section when creating a new key. This is how you’ll securely log in.
\n * Give your server a name and click “Create & Buy Now.”
\n
2. **Initial Server Access (SSH):**
\n Once your server is active, Hetzner will show you its IP address. You’ll log in as the `root` user initially.
\n bash
\n ssh root@YOUR_SERVER_IP_ADDRESS
\n
If this is your first time connecting to this IP, you’ll be asked to confirm the authenticity of the host. Type `yes` and press Enter.
\n
3. **Basic Server Security & User Setup:**
\n I always do this immediately. Running everything as `root` is a bad practice.
\n
* **Update and Upgrade:**
\n bash
\n sudo apt update && sudo apt upgrade -y
\n
* **Create a new user (e.g., `openclawuser`):**
\n bash
\n adduser openclawuser
\n
Follow the prompts to set a strong password and fill in (or skip) the user information.
\n * **Grant sudo privileges to the new user:**
\n bash
\n usermod -aG sudo openclawuser
\n
* **Copy your SSH key to the new user:** This lets you log in as `openclawuser` directly using your SSH key.
\n bash
\n rsync –archive –chown=openclawuser:openclawuser ~/.ssh /home/openclawuser
\n
*Self-correction:* Make sure the `.ssh` directory and `authorized_keys` have the correct permissions.
\n bash
\n chmod 700 /home/openclawuser/.ssh
\n chmod 600 /home/openclawuser/.ssh/authorized_keys
\n
* **Exit root and log in as your new user:**
\n bash
\n exit
\n ssh openclawuser@YOUR_SERVER_IP_ADDRESS
\n
From now on, you should do all your work as `openclawuser`.
\n
* **Enable Firewall (UFW):**
\n bash
\n sudo ufw allow OpenSSH
\n sudo ufw enable
\n sudo ufw status
\n
You should see `Status: active` and `OpenSSH (v6) ALLOW Anywhere`. If your bot needs to access other ports later (e.g., a web interface), you’ll `sudo ufw allow PORT/tcp`.
\n
## Step 2: Installing Node.js and Git
\n
OpenClaw is a Node.js application, so we need Node.js and its package manager (npm) on the server. We’ll also need Git to clone the repository.
\n
1. **Install Node.js (LTS version):**
\n I use NodeSource’s PPA for a stable, up-to-date version.
\n bash
\n curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash –
\n sudo apt-get install -y nodejs
\n
2. **Verify Node.js and npm installation:**
\n bash
\n node -v
\n npm -v
\n
You should see version numbers (e.g., `v18.x.x` and `9.x.x`).
\n
3. **Install Git:**
\n bash
\n sudo apt-get install -y git
\n
4. **Verify Git installation:**
\n bash
\n git –version
\n
## Step 3: Installing OpenClaw
\n
Now let’s get the
\n
Frequently Asked Questions
\n
What are the essential prerequisites for moving OpenClaw to a VPS?
\n
You need an active OpenClaw installation, a configured VPS with SSH access, and fundamental command-line skills. Ensure data backup before starting the migration process.
\n
\n
Why should I move OpenClaw from my local machine to a VPS?
\n
Moving to a VPS offers enhanced accessibility, dedicated resources, improved uptime, and better performance for your OpenClaw instance, making it available 24/7 reliably.
\n
\n
Is the 30-minute migration timeframe realistic for all users?
\n
The 30-minute estimate is achievable for standard setups with a pre-configured VPS and basic CLI familiarity. Complex installations or troubleshooting might slightly extend the duration.
\n
\n
\n
Need to protect your home server from power outages? See our guide to the best UPS for home server protection →
Related: OpenClaw Setup: From Zero to Running in 30 Minutes (Part 2)
Related: OpenClaw Setup: From Zero to Running in 30 Minutes
Related: OpenClaw Setup: From Zero to Running in 30 Minutes (Part 2)
Related: OpenClaw Setup: From Zero to Running in 30 Minutes
Related: OpenClaw Setup: From Zero to Running in 30 Minutes (Part 2)
Related: OpenClaw Setup: From Zero to Running in 30 Minutes
Related: OpenClaw Setup: From Zero to Running in 30 Minutes (Part 2)
Leave a Reply