Cubs

Guide 07

Running Hermes Agent on a server, and keeping it there

A Hermes install is one command. The work is everything after it: a provider that answers, a bot nobody else can talk to, and a gateway that comes back after a reboot without you noticing it stopped.

Published 4 Dec 2026

A chat agent on your laptop answers while the lid is open. On a server it answers at 2am and can run a job while you sleep, which is the whole point and also the whole risk: a process with shell access that nobody is watching needs a supervisor, a lock on the door, and a backup.

Install

# Official installer: bootstraps the package manager, Python and the launcher
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash

# Reload the shell so `hermes` is on PATH
source ~/.bashrc

hermes --version
hermes doctor

hermes doctor is the useful one. It checks the interpreter, the dependencies and the config before you add a provider, so a failure there is not confused with a provider problem later.

Install as your normal user, not root. The default layout is ~/.hermes/ — unless HERMES_HOME says otherwise — and every path below assumes that.

Pick a model

The provider is the step that decides whether any of this works.

hermes model          # interactive picker: provider, model, credentials
hermes setup --portal # or: Nous Portal, one sign-in, 300+ models and the tool gateway

Two things worth knowing before you choose:

  • Provider, not model, is the risk. A model you picked because a benchmark liked it is no use if the key expires. hermes fallback add gives you a second provider to fail over to, and a server with no provider at 3am is a server that does nothing.
  • Secrets go in .env, settings in config.yaml. Do not hand-edit the config to paste a key into it. hermes config set KEY VALUE for settings; the env file for anything that authenticates.

Verify with one real turn before going further:

hermes chat -q "Reply with the output of \`date -u\` and nothing else."

If that prints a timestamp, the provider, the key and the network all work. Adding the gateway before this passes is how people end up debugging Telegram when the problem is an expired key.

Connect Telegram

Create the bot in Telegram by messaging @BotFather, /newbot, and keep the token it returns. Then either use the guided setup or write the token yourself.

hermes gateway setup     # interactive; walks each platform and offers to start the gateway

The token and the allowlist belong in ~/.hermes/.env:

TELEGRAM_BOT_TOKEN=123456789:AA...            # anything with this token controls the bot
TELEGRAM_ALLOWED_USERS=12345678,87654321      # your numeric Telegram ID, comma-separated

The allowlist is not optional in practice. A bot token that leaks gives the finder a shell on your server, and the default when no allowlist matches is to deny — keep it that way rather than setting an allow-all flag to make testing quicker.

Send the bot one message and confirm a reply before you install the service. A gateway that is running but unconfigured looks identical to a working one from systemctl.

Keep it running

The foreground command stops when its parent does. The service does not.

hermes gateway install            # user service: survives logout, restarts on failure
hermes gateway start
hermes gateway status

# optional: a boot-time system service, needs sudo, survives reboot without a login
sudo hermes gateway install --system

On a headless box, enable lingering so your user services start without a login session:

sudo loginctl enable-linger "$USER"
loginctl show-user "$USER" --property=Linger

Then test the failure you actually care about: reboot the machine, and check that the bot answers without you logging in.

sudo reboot
# after it comes back
hermes gateway status
journalctl --user -u 'hermes-gateway*' -n 50 --no-pager

If it does not come back, the answer is almost always lingering or the unit not being enabled — not the bot token.

Lock it down

An agent with a terminal is a remote shell with a language model attached, and the defaults assume one trusted user on a private machine.

  • Run as a non-root user. Root plus a prompt-injected instruction is a wiped server.
  • Keep the allowlist short. Numeric IDs, not usernames, and add a second person only if they need it.
  • chmod 600 ~/.hermes/.env and check the backup file too. A .env in a world-readable directory is the most common own goal on a shared VPS.
  • Keep approval on for dangerous commands. Hermes asks before things like rm -rf, sudo and service restarts; turning approval off globally to stop the prompts is trading a minute for an incident.
  • Run it on a machine where a compromise is contained. Ideally not the machine with your only copy of anything. This is the same argument as everywhere else in this set of guides: a disposable machine is a good place for an agent, a shared one is not.
# A quick audit of what the agent can already reach
sudo ss -tulpn | grep -v 127.0.0.1
ls -l ~/.hermes/.env

Back up and update

hermes backup                     # one archive of the Hermes home: profiles, memory, skills, sessions, .env
hermes update --check             # what a new release would change
hermes update --backup            # take a snapshot, then update

The archive contains live credentials. Store it somewhere you would store a private key, not in a public bucket, and not in the repository the agent works on. Restore with hermes import <file>.

Updating restarts the gateway. Do it when you can watch the bot answer afterwards, not at the start of a long unattended job.

Where Cubs fits

On a Cubs machine, install Hermes from Agents & Tools rather than from the shell, then run hermes setup in a terminal to pick a provider. You are a normal user with no passwordless sudo, so the boot-time system service is not available — run hermes gateway in a terminal and leave it there, which is fine because the machine runs until you pause it. Pausing stops the gateway process along with everything else and keeps the disk, so the config, the sessions and the bot token are still there when you resume; the bot simply does not answer while paused, and a message sent in that window is not queued.

Sources

Third-party documentation, read on the date above. Vendor pages change; check them before quoting anything, including this page.

Questions

Questions

What does Hermes Agent need to run on a server?
Linux with a modern Python, network access, and a model provider — an API key or an OAuth sign-in. The official installer bootstraps the package manager and Python for you, so a fresh Ubuntu LTS box with your user account is enough. A 1-2 GB machine handles a single agent comfortably; memory grows with the tools and subprocesses an agent runs, not with the installer.
Do I need sudo to install it?
No. Hermes installs under your home directory, and its gateway runs as a user service rather than a system one. That is deliberate: an agent with shell access should not be able to rewrite system files, and a user service can be restarted without a password. Only the optional boot-time system service uses `sudo`, and skipping it costs you nothing but a login after a reboot.
Can Hermes keep running when I close the SSH session?
Yes, if you run the gateway as a service rather than in the foreground. `hermes gateway install` registers a user service that survives logout and restarts on failure; the foreground `hermes gateway` stops when the terminal that owns it goes away. Closing the laptop is a separate matter — it is only safe if the machine running the gateway is not the laptop.
Where do the API keys live?
In `$HERMES_HOME/.env`, separate from `config.yaml`, which holds settings and never secrets. Back up both, keep the backup private, and `chmod 600` the file: it holds provider keys and platform bot tokens. On a shared machine, check who else can read your home directory before you add a key.

Read next

A new home for your agents

A machine that stays on, with your coding agents on it. $25 of credit to start, no card.

Get the download link

Enter your email and we will send the download link when the signed build ships. Open it on a Mac with Apple Silicon.

One message when the build is signed. No newsletter.