{"id":7771,"date":"2026-07-21T07:38:57","date_gmt":"2026-07-21T07:38:57","guid":{"rendered":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/?p=7771"},"modified":"2026-07-21T07:39:00","modified_gmt":"2026-07-21T07:39:00","slug":"install-openclaw-on-ubuntu-in-vps-html","status":"publish","type":"post","link":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html","title":{"rendered":"How to Install OpenClaw on Ubuntu in a VPS?"},"content":{"rendered":"\n<p>Running AI agents on your own server gives you greater control over your data, better performance, and the flexibility to customize your workflows. OpenClaw is an open-source AI gateway that lets you connect to, manage, and interact with AI services from your own infrastructure rather than relying entirely on hosted platforms.<\/p>\n\n\n\n<p>Installing OpenClaw on an Ubuntu VPS is straightforward but requires preparing the server, installing Node.js, configuring the gateway, and securing the service to start automatically after every reboot.<\/p>\n\n\n\n<p>In this knowledgebase article, you will learn how to install OpenClaw on an Ubuntu VPS from scratch, configure it as a system service, access the web dashboard, and pair your device for the first time. Every step is explained in simple language so you understand what you are doing and why, rather than simply copying commands.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Prerequisites<\/strong><\/h2>\n\n\n\n<p>Before you begin, make sure you have:<\/p>\n\n\n\n<ul style=\"margin-left: 20px;\">\n   <li>An Ubuntu VPS (Ubuntu 24 LTS)<\/li>\n   <li>Root SSH access<\/li>\n   <li>PuTTY (Windows) or Terminal (Linux\/macOS)<\/li>\n   <li>A stable internet connection<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Steps to Install OpenClaw on Ubuntu in a VPS<\/strong><\/h2>\n\n\n\n<table style=\"border-collapse: collapse; width: 100%; margin-bottom: 1rem;\" border=\"1\">\n<tbody>\n<tr>\n<td style=\"width: 100%; padding: 15px;\">\n<p>\u27a2 Step 1: Connect to Your Ubuntu VPS<\/p>\n<p>\u27a2 Step 2: Enable Safe Bash Execution<\/p>\n<p>\u27a2 Step 3: Create a Simple Logging Function<\/p>\n<p>\u27a2 Step 4: Update Ubuntu Packages<\/p>\n<p>\u27a2 Step 5: Install Node.js 22<\/p>\n<p>\u27a2 Step 6: Create a Dedicated OpenClaw User<\/p>\n<p>\u27a2 Step 7: Install the Latest Version of OpenClaw<\/p>\n<p>\u27a2 Step 8: Complete the Initial OpenClaw Setup<\/p>\n<p>\u27a2 Step 9: Enable TLS<\/p>\n<p>\u27a2 Step 10: Allow Host Header Origin Fallback<\/p>\n<p>\u27a2 Step 11: Create the OpenClaw Systemd Service<\/p>\n<p>\u27a2 Step 12: Create the Compile Cache Directory<\/p>\n<p>\u27a2 Step 13: Enable and Start the Service<\/p>\n<p>\u27a2 Step 14: Get Your Gateway Token<\/p>\n<p>\u27a2 Step 15: Open the OpenClaw Dashboard<\/p>\n<p>\u27a2 Step 16: Connect to the Gateway<\/p>\n<p>\u27a2 Step 17: Approve Device Pairing<\/p>\n<p>\u27a2 Step 18: Log in to the OpenClaw User and Start Onboarding<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n\n<p style=\"margin-left: 24px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 1: Connect to Your Ubuntu VPS<\/strong><\/p>\n\n\n\n<p>Before installing OpenClaw, you need to connect to your VPS using SSH.<\/p>\n\n\n\n<p>If you are using Windows, open PuTTY, enter your VPS IP address, and log in using the root account.<\/p>\n\n\n\n<p>After logging in successfully, you will see the terminal prompt.<\/p>\n\n\n\n<div style=\"border: 1px solid #faf4ff; padding: 18px 24px; background-color: #faf4ff; width: 730px;\">\n  <p style=\"margin: 0 0 10px 0;\">\n    <strong>\u2605 Important Tip<\/strong>\n  <\/p>\n\n  <p style=\"margin: 0 0 10px 0;\">\n  Running the installation as root avoids permission-related issues during package installation and service configuration.\n  <\/p>\n<\/div>\n\n\n\n<p style=\"margin-left: 24px; margin-top:12px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 2: Enable Safe Bash Execution<\/strong><\/p>\n\n\n\n<p>To enable strict error handling in your shell session, run this command.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>set -euo pipefail\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p>It helps:<\/p>\n\n\n\n<ul style=\"margin-left: 20px;\">\n   <li>Stopping immediately if any command fails<\/li>\n   <li>Preventing undefined variables from causing unexpected behavior<\/li>\n   <li>Detecting failures inside command pipelines<\/li>\n<\/ul>\n\n\n\n<p>This makes the installation safer and easier to troubleshoot.<\/p>\n\n\n\n<p style=\"margin-left: 24px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 3: Create a Simple Logging Function<\/strong><\/p>\n\n\n\n<p>To create a small helper function for displaying readable log messages during installation, run the following command<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>log() { echo &#8220;${LOG_TAG} $*&#8221;; }\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p style=\"margin-left: 24px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 4: Update Ubuntu Packages<\/strong><\/p>\n\n\n\n<p>It is important to update Ubuntu to ensure it downloads the latest package information from its repositories.<\/p>\n\n\n\n<p>Firstly run:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>apt update -y\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p>Then upgrade installed packages:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>apt upgrade -y\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<div style=\"border: 1px solid #faf4ff; padding: 18px 24px; background-color: #faf4ff; width: 730px;\">\n  <p style=\"margin: 0 0 10px 0;\">\n    <strong>\u2605 Important Tip<\/strong>\n  <\/p>\n\n  <p style=\"margin: 0 0 10px 0;\">\n  Restart your VPS after a major system upgrade if the kernel has been updated.\n  <\/p>\n<\/div>\n\n\n\n<p style=\"margin-left: 24px; margin-top:12px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 5: Install Node.js 22<\/strong><\/p>\n\n\n\n<p>OpenClaw requires Node.js to run. For this, you have to first add the official NodeSource repository:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>curl -fsSL https:\/\/deb.nodesource.com\/setup_22.x | bash\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p>Then install Node.js:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>apt-get install -y nodejs\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p style=\"margin-left: 24px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 6: Create a Dedicated OpenClaw User<\/strong><\/p>\n\n\n\n<p>You have to create a separate user, as instead of running everything as root, OpenClaw runs under its own Linux account.<\/p>\n\n\n\n<p>You have to run:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>useradd -m -s \/bin\/bash openclaw\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p style=\"margin-left: 24px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 7: Install the Latest Version of OpenClaw\n<\/strong><\/p>\n\n\n\n<p>To install OpenClaw, run the following command:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>npm install -g openclaw@latest\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<div style=\"border: 1px solid #faf4ff; padding: 18px 24px; background-color: #faf4ff; width: 730px;\">\n  <p style=\"margin: 0 0 10px 0;\">\n    <strong>\u2605 Tip<\/strong>\n  <\/p>\n\n  <p style=\"margin: 0 0 10px 0;\">\n  Installing the latest version gives you access to new features, bug fixes, and security improvements.\n  <\/p>\n<\/div>\n\n\n\n<p style=\"margin-left: 24px; margin-top:12px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 8: Complete the Initial OpenClaw Setup\n<\/strong><\/p>\n\n\n\n<p>To initialize OpenClaw automatically without requiring manual interaction, you have to run this command:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>su &#8211; openclaw -c &#8220;openclaw onboard &#8211;non-interactive &#8211;accept-risk &#8211;mode local &#8211;flow quickstart &#8211;skip-health&#8221;\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p style=\"margin-left: 24px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 9: Enable TLS\n<\/strong><\/p>\n\n\n\n<p>To encrypt communication between your browser and the OpenClaw gateway, you have to enable TLS.<\/p>\n\n\n\n<p>For this, run the following command:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>su &#8211; openclaw -c &#8220;openclaw config set gateway.tls.enabled true&#8221;\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p style=\"margin-left: 24px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 10: Allow Host Header Origin Fallback\n<\/strong><\/p>\n\n\n\n<p>When accessing OpenClaw via a VPS IP address, browsers may reject requests due to host header validation. To ensure the dashboard works correctly in these situations, run the following command:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>su &#8211; openclaw -c &#8220;openclaw config set gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback true&#8221;\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p style=\"margin-left: 24px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 11: Create the OpenClaw Systemd Service\n<\/strong><\/p>\n\n\n\n<p>To make OpenClaw start automatically whenever your VPS boots, you will need to create a systemd service. A systemd service allows OpenClaw to run in the background and automatically restart if it stops unexpectedly.<\/p>\n\n\n\n<p>Run the following command:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>cat > \/etc\/systemd\/system\/openclaw.service <<'UNIT'\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p>Now paste the following service configuration:<\/p>\n\n\n\n<figure class=\"wp-block-table\">\n    <button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button>\n    <span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\">\n\n[Unit]<br>\nDescription=OpenClaw Gateway<br>\nAfter=network.target<br>\n\n[Service]<br>\nType=simple<br>\nUser=openclaw<br>\nWorkingDirectory=\/home\/openclaw<br>\nExecStart=\/usr\/bin\/openclaw gateway run &#8211;bind lan &#8211;port 18789<br>\nRestart=on-failure<br>\nRestartSec=5<br>\nEnvironment=NODE_ENV=production<br>\nEnvironment=NODE_COMPILE_CACHE=\/var\/tmp\/openclaw-compile-cache<br>\nEnvironment=OPENCLAW_NO_RESPAWN=1<br>\n\n[Install]<br>\nWantedBy=multi-user.target<br>\nUNIT\n                <\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p><strong>This configuration will:<\/strong><\/p>\n\n\n\n<ul style=\"margin-left: 20px;\">\n    <li>Starts the OpenClaw gateway automatically after the network is available.<\/li>\n    <li>Runs the service using the dedicated openclaw user instead of the root account.<\/li>\n    <li>Launches the gateway on port 18789.<\/li>\n    <li>Automatically restarts the service if it crashes or stops unexpectedly.<\/li>\n    <li>Sets the required environment variables for production use.<\/li>\n    <li>Enables the service to start automatically every time the VPS boots.<\/li>\n<\/ul>\n\n\n\n<p style=\"margin-left: 24px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 12: Create the Compile Cache Directory\n<\/strong><\/p>\n\n\n\n<p>To store temporary compilation cache files &amp; helping OpenClaw launch more efficiently, create a cache directory with the following command:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>mkdir -p \/var\/tmp\/openclaw-compile-cache\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p style=\"margin-left: 24px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 13: Enable and Start the Service\n<\/strong><\/p>\n\n\n\n<p>After creating the service file, you need to reload <strong>systemd<\/strong> so it recognizes the new service. Enabling and starting the service ensures OpenClaw launches automatically on every server boot and begins running immediately without requiring manual intervention.<\/p>\n\n\n\n<p style=\"margin-left: 24px;\"><strong>\u2794 To reload systemd:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>systemctl daemon-reload\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p style=\"margin-left: 24px;\"><strong>\u2794 To enable the service:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>systemctl enable openclaw.service\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p style=\"margin-left: 24px;\"><strong>\u2794 To start it:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>systemctl start openclaw.service\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<div style=\"border: 1px solid #faf4ff; padding: 18px 24px; background-color: #faf4ff; width: 730px;\">\n  <p style=\"margin: 0 0 10px 0;\">\n    <strong>\u2605 Tip<\/strong>\n  <\/p>\n\n  <p style=\"margin: 0 0 10px 0;\">\n  To verify the service is running correctly, use:<\/p>\n\n<p><strong>systemctl status openclaw.service<\/strong><\/p>\n\n<p>If everything is working, you should see the service in the active (running) state.\n\n  <\/p>\n<\/div>\n\n\n\n<p style=\"margin-left: 24px; margin-top:12px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 14: Get Your Gateway Token\n<\/strong><\/p>\n\n\n\n<p>OpenClaw generates a unique gateway token during installation. To get that token, run the following command:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>grep token \/home\/openclaw\/.openclaw\/openclaw.json\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p>Just copy the token value, as you will need it when connecting to the dashboard.<\/p>\n\n\n\n<p style=\"margin-left: 24px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 15: Open the OpenClaw Dashboard\n<\/strong><\/p>\n\n\n\n<p>Now, it\u2019s time to open your browser and visit: <strong>https:\/\/YOUR_SERVER_IP:18789<\/strong><\/p>\n\n\n\n<p>With your VPS&#8217;s public IP address.<\/p>\n\n\n\n<p>Your browser will display a security warning because OpenClaw uses a self-signed TLS certificate by default.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"671\" height=\"450\" src=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/security-warning.png\" alt=\"security-warning\" class=\"wp-image-7863\" srcset=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/security-warning.png 671w, https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/security-warning-300x201.png 300w\" sizes=\"auto, (max-width: 671px) 100vw, 671px\" \/><\/figure>\n<\/div>\n\n\n<p>This is expected.<\/p>\n\n\n\n<p><strong>You have to simply click:<\/strong><\/p>\n\n\n\n<p>Advanced \u2192 Proceed anyway<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"641\" height=\"85\" src=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/click-on-advanced.png\" alt=\"click on advanced\" class=\"wp-image-7866\" srcset=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/click-on-advanced.png 641w, https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/click-on-advanced-300x40.png 300w\" sizes=\"auto, (max-width: 641px) 100vw, 641px\" \/><\/figure>\n<\/div>\n\n\n<p style=\"margin-left: 24px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 16: Connect to the Gateway\n<\/strong><\/p>\n\n\n\n<p>Here, paste your Gateway Token into the Gateway Token field &amp; click <strong>\u2018Connect\u2019<\/strong><\/p>\n\n\n\n<p>On your first connection, OpenClaw will request device approval. Don\u2019t worry; below is the way for that approval.<\/p>\n\n\n\n<p style=\"margin-left: 24px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 17: Approve Device Pairing\n<\/strong><\/p>\n\n\n\n<p>For this approval process, you have to exit the OpenClaw user session by typing exit or pressing Ctrl+D. Once you are back to the root user on your Ubuntu VPS, continue with the device pairing steps below.<\/p>\n\n\n\n<p>When you click the <strong>\u2018Connect<\/strong>\u2019 button, you will see a Request ID for approval in the box below.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"472\" height=\"258\" src=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/request-id-approval.png\" alt=\"request id approval\" class=\"wp-image-7872\" srcset=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/request-id-approval.png 472w, https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/request-id-approval-300x164.png 300w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\" \/><\/figure>\n<\/div>\n\n\n<p>Just copy that code &amp; paste it into the following command in the replacement of <strong>\u2018PASTE-REQUEST-ID-HERE\u2019<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>su &#8211; openclaw -c &#8220;openclaw devices approve PASTE-REQUEST-ID-HERE&#8221;\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p>Go back to the browser &amp; click <strong>\u2018Connect\u2019<\/strong> again.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"476\" height=\"53\" src=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/click-connect.png\" alt=\"click connect\" class=\"wp-image-7876\" srcset=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/click-connect.png 476w, https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/click-connect-300x33.png 300w\" sizes=\"auto, (max-width: 476px) 100vw, 476px\" \/><\/figure>\n<\/div>\n\n\n<p>You are now connected successfully!<\/p>\n\n\n\n<div style=\"border: 1px solid #faf4ff; padding: 18px 24px; background-color: #faf4ff; width: 730px;\">\n  <p style=\"margin: 0 0 10px 0;\">\n    <strong>\u2605 Tip<\/strong>\n  <\/p>\n\n  <p style=\"margin: 0 0 10px 0;\">\n  Device pairing is required only once per browser or device. Future connections only require your Gateway Token.\n  <\/p>\n<\/div>\n\n\n\n<p style=\"margin-left: 24px; margin-top:12px;\"><strong style=\" font-size: 24px;\">\u27a2 Step 18: Log in to the OpenClaw User and Start Onboarding\n<\/strong><\/p>\n\n\n\n<p>Once your device has been approved successfully, switch back to the dedicated openclaw user to complete the onboarding process by running the following command:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>su &#8211; openclaw\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p>Then start the onboarding wizard by running:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><button class=\"copy-btn\" onclick=\"copyCommand(this)\">\ud83d\udccb<\/button><span class=\"copy-msg\">Copied!<\/span>\n    <table class=\"has-fixed-layout\">\n        <tbody>\n            <tr>\n                <td class=\"kb_firewall\"><strong><strong>openclaw onboard\n<\/strong><\/strong><\/td>\n            <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<p><strong><strong>Also Read: <a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/518\/openclaw-onboarding-guide.html\">OpenClaw Onboarding Guide \u2013 Steps to Know<\/a><\/strong><\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>Installing OpenClaw on an Ubuntu VPS may seem like a lengthy process at first, but once you complete each step in the correct order, you end up with a secure, reliable, and self-hosted AI gateway that is always ready to use.&nbsp;<\/p>\n\n\n\n<p>From preparing your Ubuntu server and installing the required dependencies to configuring the gateway, enabling it as a system service, pairing your device, and completing the onboarding process, every step plays an important role in ensuring a stable deployment.<\/p>\n\n\n\n<p>By hosting OpenClaw on your own VPS, you gain greater control over your environment, improved privacy, and the flexibility to manage your AI workflows without relying solely on third-party infrastructure.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Running AI agents on your own server gives you greater control over your data, better performance, and the flexibility to customize your workflows. OpenClaw is an open-source AI gateway that lets you connect to, manage, and interact with AI services from your own infrastructure rather than relying entirely on hosted platforms. Installing OpenClaw on an [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[65],"tags":[],"class_list":["post-7771","post","type-post","status-publish","format-standard","hentry","category-openclaw"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Install OpenClaw on Ubuntu in a VPS?<\/title>\n<meta name=\"description\" content=\"Learn how to install OpenClaw on an Ubuntu VPS with this step-by-step guide. Set up, configure, and run your self-hosted AI gateway quickly and securely.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install OpenClaw on Ubuntu in a VPS?\" \/>\n<meta property=\"og:description\" content=\"Learn how to install OpenClaw on an Ubuntu VPS with this step-by-step guide. Set up, configure, and run your self-hosted AI gateway quickly and securely.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html\" \/>\n<meta property=\"og:site_name\" content=\"Host IT Smart Knowledge base\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-21T07:38:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-21T07:39:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/security-warning.png\" \/>\n\t<meta property=\"og:image:width\" content=\"671\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html\",\"url\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html\",\"name\":\"How to Install OpenClaw on Ubuntu in a VPS?\",\"isPartOf\":{\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/security-warning.png\",\"datePublished\":\"2026-07-21T07:38:57+00:00\",\"dateModified\":\"2026-07-21T07:39:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/317c14a877385667f19d3b7496bd5108\"},\"description\":\"Learn how to install OpenClaw on an Ubuntu VPS with this step-by-step guide. Set up, configure, and run your self-hosted AI gateway quickly and securely.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html#primaryimage\",\"url\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/security-warning.png\",\"contentUrl\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/security-warning.png\",\"width\":671,\"height\":450},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#website\",\"url\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/\",\"name\":\"Host IT Smart Knowledge base\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/317c14a877385667f19d3b7496bd5108\",\"name\":\"Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d4827c56a6721070dde339640d47ff44ba0d0e515c7e577cf29305ab72383fe3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d4827c56a6721070dde339640d47ff44ba0d0e515c7e577cf29305ab72383fe3?s=96&d=mm&r=g\",\"caption\":\"Admin\"},\"sameAs\":[\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/\"],\"url\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install OpenClaw on Ubuntu in a VPS?","description":"Learn how to install OpenClaw on an Ubuntu VPS with this step-by-step guide. Set up, configure, and run your self-hosted AI gateway quickly and securely.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html","og_locale":"en_US","og_type":"article","og_title":"How to Install OpenClaw on Ubuntu in a VPS?","og_description":"Learn how to install OpenClaw on an Ubuntu VPS with this step-by-step guide. Set up, configure, and run your self-hosted AI gateway quickly and securely.","og_url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html","og_site_name":"Host IT Smart Knowledge base","article_published_time":"2026-07-21T07:38:57+00:00","article_modified_time":"2026-07-21T07:39:00+00:00","og_image":[{"width":671,"height":450,"url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/security-warning.png","type":"image\/png"}],"author":"Admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Admin","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html","url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html","name":"How to Install OpenClaw on Ubuntu in a VPS?","isPartOf":{"@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html#primaryimage"},"image":{"@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html#primaryimage"},"thumbnailUrl":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/security-warning.png","datePublished":"2026-07-21T07:38:57+00:00","dateModified":"2026-07-21T07:39:00+00:00","author":{"@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/317c14a877385667f19d3b7496bd5108"},"description":"Learn how to install OpenClaw on an Ubuntu VPS with this step-by-step guide. Set up, configure, and run your self-hosted AI gateway quickly and securely.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/519\/install-openclaw-on-ubuntu-in-vps.html#primaryimage","url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/security-warning.png","contentUrl":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-content\/uploads\/2026\/07\/security-warning.png","width":671,"height":450},{"@type":"WebSite","@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#website","url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/","name":"Host IT Smart Knowledge base","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/317c14a877385667f19d3b7496bd5108","name":"Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d4827c56a6721070dde339640d47ff44ba0d0e515c7e577cf29305ab72383fe3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d4827c56a6721070dde339640d47ff44ba0d0e515c7e577cf29305ab72383fe3?s=96&d=mm&r=g","caption":"Admin"},"sameAs":["https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/"],"url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts\/7771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/comments?post=7771"}],"version-history":[{"count":119,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts\/7771\/revisions"}],"predecessor-version":[{"id":7961,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts\/7771\/revisions\/7961"}],"wp:attachment":[{"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/media?parent=7771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/categories?post=7771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/tags?post=7771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}