Imagine having a personal assistant that lives on your computer, respects your privacy, costs $0 in subscription fees, and chats with you directly through Slack.
This guide will show you how to set up OpenClaw (an open-source AI agent), Ollama (to run the AI brain locally), and Slack (the interface) on an Ubuntu system. Even if you aren't a Linux expert, you can follow these steps to get your agent running.
Prerequisites
- A computer running Ubuntu (20.04 or newer).
- A Slack workspace where you have permission to add apps.
- Basic comfort with the Terminal (Ctrl+Alt+T).
Step 1: Install the "Brain" (Ollama)
Ollama allows your computer to run powerful AI models (like Llama 3 or Qwen) locally so your data never leaves your machine.
- Run the Installer: Open your terminal and paste this command:
curl -fsSL https://ollama.com | sh
- Download a Model: We’ll use qwen2.5-coder, which is excellent at following instructions and using tools.
ollama pull qwen2.5-coder:7b
Step 2: Install the "Agent" (OpenClaw)
OpenClaw is the "body" of your assistant. It takes your Slack messages, asks the AI brain what to do, and performs tasks like searching files or the web.
- Install Dependencies: OpenClaw needs Node.js. The easiest way is the official script:
curl -fsSL https://openclaw.ai | bash
- Run Onboarding: This command sets up the background services.
openclaw onboard --install-daemon
Follow the prompts: Select Manual and Local when asked.
- Start the Gateway:
openclaw gateway start
Step 3: Create the "Interface" (Slack App)
To talk to your agent, you need to create a "bot" in Slack.
- Create App: Go to Slack API Dashboard → Create New App → From Scratch. Name it "MyAI" and pick your workspace.
- Enable Socket Mode: This allows the bot to work without complex networking.
- In the left sidebar, click Socket Mode → Toggle Enable.
- Give the token a name (e.g., "OpenClawToken") and click Generate.
- Copy the token (starts with xapp-).
- Permissions (Scopes):
- Go to OAuth & Permissions.
- Scroll to Bot Token Scopes and add: app_mentions:read, chat:write, im:history, and im:read.
- Scroll up and click Install to Workspace.
- Copy the Bot User OAuth Token (starts with xoxb-).
- Events:
- Go to Event Subscriptions → Toggle On.
- Under "Subscribe to bot events," add app_mention and message.im. Click Save Changes.
Step 4: Connecting Everything
Now, tell OpenClaw how to talk to Slack and Ollama.
- Configure Tokens: Replace the placeholders below with your actual tokens from Step 3:
openclaw config set channels.slack.enabled true
openclaw config set channels.slack.appToken "YOUR_XAPP_TOKEN"
openclaw config set channels.slack.botToken "YOUR_XOXB_TOKEN"
- Connect Ollama: Tell OpenClaw to use your local AI model.
openclaw config set provider.type "ollama"
openclaw config set provider.model "qwen2.5-coder:7b"
- Restart & Pair:
openclaw gateway restart
- The Final Handshake:
- Open Slack and find your new bot under "Apps."
- Send it a message like "Hello."
- The bot will reply with a Pairing Code.
- Go back to your Ubuntu terminal and type:
openclaw pairing approve slack
Success!
Your local AI agent is now live. You can ask it to write code, summarize text, or (once you install more "skills" from the OpenClaw dashboard) manage your calendar and files.