Introduction
If you want to run OpenClaw on Ubuntu 25.04 and use it through Discord, a VPS or dedicated Linux server is one of the most reliable ways to do it. This setup keeps the service online around the clock, separates your AI agent from your personal workstation, and makes maintenance much easier. In this guide, you will learn how to install OpenClaw on Ubuntu, complete the initial onboarding process, create a Discord bot, and link the two together for a working self-hosted AI assistant.
What OpenClaw does
OpenClaw is a self-hosted AI agent platform that can work with local models or external AI providers. It acts as a gateway between users and language models, allowing conversations to be delivered through platforms such as Discord, Telegram, or a web interface. Once configured, it runs as a persistent service that receives messages, sends them to the selected model, and returns responses through the connected channel.
Why use a VPS for OpenClaw
Although OpenClaw can be installed on a desktop or laptop, hosting it on a VPS is usually the better choice. A remote Ubuntu server offers more predictable uptime, easier SSH-based administration, and improved isolation from your daily system. It also reduces the risk of resource spikes affecting your main computer.
Ubuntu 25.04 system requirements
A clean Ubuntu 25.04 installation is ideal for this deployment. The same process should also work on recent Ubuntu releases starting from 22.04 and newer.
- 2 vCPU minimum
- 2 GB RAM minimum, with 4 GB recommended
- 20 GB SSD minimum, with 30 to 50 GB preferred
- Ubuntu 22.04 or later
If you plan to use local AI models later through tools such as Ollama, you may need significantly more CPU, RAM, or GPU capacity. For a Discord bot connected to cloud-based models, the basic specification above is generally sufficient.
Update Ubuntu before installing OpenClaw
Start by updating the package list and upgrading installed software. This helps ensure your Ubuntu server has the latest security patches and dependency versions.
sudo apt-get update
sudo apt-get upgrade -y
If your upgrade includes a new kernel, reboot the server before continuing. Next, install a few helpful utilities often needed during setup and troubleshooting.
sudo apt-get install -y curl git build-essential
curl is needed to download the installer, git is useful for working with add-ons or repositories, and build-essential helps prevent dependency issues involving native packages.
Install OpenClaw on Ubuntu 25.04
On a fresh Ubuntu server, the simplest approach is to use the official OpenClaw installation script. It detects your environment, installs any required runtime components, and prepares the OpenClaw CLI.
curl -fsSL https://openclaw.ai/install.sh | bash
When the process finishes, verify that both OpenClaw and Node.js are available.
openclaw --version
node -v
In most cases, the installer handles the Node.js dependency automatically. If it does not, you can install Node.js manually afterward, but that is usually unnecessary.
Run the OpenClaw onboarding process
After installation, OpenClaw needs to initialize its workspace and create its configuration files. In many environments the onboarding wizard starts automatically. If it does not, launch it manually.
openclaw onboard
Security prompt
During onboarding, OpenClaw displays a warning explaining that it may access files and execute commands depending on its configuration. Only proceed if you trust the environment and understand the capabilities of the software.
Recommended onboarding selections
For a straightforward Ubuntu and Discord deployment, use the following choices in the text interface:
- Select QuickStart as the onboarding mode
- Choose Skip for now when asked about model or authentication setup
- Select All providers so future integrations are easier to enable
- Keep the current default model placeholder
- Skip channel selection for now, since Discord will be added manually later
- Choose No for skills during the initial setup
- Select Hatch in TUI to finalize the workspace
This creates a clean starting point without forcing you to configure providers or channels before Discord is ready.
Create a Discord bot application
To connect OpenClaw to Discord, you need to create a bot in the Discord Developer Portal. Open https://discord.com/developers/applications in your browser and sign in with your Discord account.
Create a new application, assign it a descriptive name, and save the configuration. Then open the Bot section and generate a bot token.
Protect the Discord bot token
The Discord token is a secret credential. Anyone with access to it can control your bot, so do not share it publicly or store it in insecure files. If you believe the token has been exposed, regenerate it immediately in the Developer Portal.
Configure Discord OAuth settings
Next, open the OAuth2 section of your Discord application and generate an invite link for the bot. Choose the scopes and permissions required for your intended use, then copy the generated URL. Open it in your browser, select the target server, and authorize the bot.
After authorization, the bot should appear in your Discord server, even if it is not online yet.
Store the Discord bot token on Ubuntu
Now create a secure environment file for OpenClaw and add the Discord token to it.
sudo install -d /opt/openclaw
sudo tee /opt/openclaw/.env > /dev/null <<'EOF' DISCORD_BOT_TOKEN=YOUR_DISCORD_BOT_TOKEN_HERE EOF
Replace YOUR_DISCORD_BOT_TOKEN_HERE with the actual token from the Discord Developer Portal. After saving the file, lock down its permissions so other users cannot read it.
sudo chmod 600 /opt/openclaw/.env
Enable required Discord intents
Before starting the bot, go back to the Discord Developer Portal and enable the intents OpenClaw may need to function correctly.
- Presence Intent
- Server Members Intent
- Message Content Intent
These settings are especially important if your bot needs to read messages and interact naturally inside channels.
Add Discord as an OpenClaw channel
Load the environment variables from the token file and register Discord as a channel in OpenClaw.
set -a && . /opt/openclaw/.env && set +a && openclaw channels add --channel discord --use-env
If OpenClaw reports any configuration or dependency issues, run the built-in repair tool.
openclaw doctor --fix
Start the OpenClaw gateway
Once the Discord channel has been added successfully, start the OpenClaw gateway process.
openclaw gateway --force
This command launches the long-running service that listens for Discord events and sends replies through your configured AI backend. When the gateway is active, the bot should appear online inside your Discord server.
How to verify the OpenClaw Discord setup
Test the deployment by checking whether the bot shows as online and responds to messages in the appropriate channels. If the bot does not respond, review the following points:
- Confirm the bot token is correct in
/opt/openclaw/.env - Make sure the required Discord intents are enabled
- Review gateway output for authentication or permission errors
- Run the OpenClaw diagnostics tool again
openclaw doctor
Best practices after installation
Once OpenClaw is working with Discord, consider improving the deployment with a few additional steps:
- Add your preferred AI provider credentials
- Install skills only after basic messaging has been confirmed
- Use a process manager or system service for automatic restarts
- Harden SSH access and firewall rules on your Ubuntu VPS
- Monitor disk, memory, and CPU usage if you plan to expand the setup
Conclusion
Installing OpenClaw on Ubuntu 25.04 and connecting it to Discord is a practical way to deploy a self-hosted AI bot with full control over the environment. By preparing the server, running the OpenClaw installer, completing onboarding, creating a Discord application, and linking the bot token securely, you can build a stable foundation for advanced automation and AI-assisted workflows. From here, you can add model providers, expand capabilities with skills, and optimize the server for production use.







