Run Codex CLI on CometVPS
Put OpenAI's open-source coding agent on a server of its own. Sign in from any browser, keep sessions running in tmux, and let builds run on hardware that isn't your laptop.
Why Run Codex on a Server?
Codex runs on your server while OpenAI's models answer from OpenAI's side. The VPS holds your code, tools and sessions, so no GPU is needed.
Runs While You're Away
Sign In Without a Browser
Room to Build and Test
Setup Guide
From a fresh server to a running Codex session in seven steps
This guide gets Codex CLI running; keeping your server secure is up to you. Codex CLI changes over time, so if a step doesn't match, follow the official Codex CLI documentation, and read each command before you run it.
Order a VPS
OpenAI lists 4 GB of RAM as the minimum for Codex CLI and recommends 8 GB, on Ubuntu 20.04+ or Debian 10+. Core VPS Basic meets the minimum for one session. Supernova Blaze meets the recommendation and leaves room for heavy builds or several sessions at once. Pick Ubuntu or Debian as the operating system.Create a regular user for the agent
Connect as root with the IP and credentials from your welcome email, then create a non-root user. Running the agent as a normal user limits what a bad command can touch. From your own computer, copy your SSH key to the new user and log in as them.ssh root@your-server-ip adduser dev usermod -aG sudo dev exit # back on your own computer ssh-copy-id dev@your-server-ip ssh dev@your-server-ipInstall git, tmux and bubblewrap
tmux keeps your session alive after you disconnect. On Linux, Codex runs commands in a sandbox built on bubblewrap, and OpenAI asks you to install it first.sudo apt update && sudo apt install -y git tmux bubblewrapUbuntu 24.04 only: if Codex later warns that it can't create a user namespace, load the bubblewrap AppArmor profile, as OpenAI's sandboxing guide shows.sudo apt install -y apparmor-profiles apparmor-utils sudo install -m 0644 \ /usr/share/apparmor/extra-profiles/bwrap-userns-restrict \ /etc/apparmor.d/bwrap-userns-restrict sudo apparmor_parser -r /etc/apparmor.d/bwrap-userns-restrictInstall Codex CLI
OpenAI's standalone installer needs no Node.js. It puts codex in ~/.local/bin and adds that folder to your PATH in ~/.bashrc, so reload it, then check that the command works. Run the installer again later to update. If you already use Node.js, npm install -g @openai/codex works too.curl -fsSL https://chatgpt.com/codex/install.sh | sh source ~/.bashrc codex --versionSign in with a device code
The normal login waits for a browser on the same machine, which a server doesn't have. Device-code login (in beta) prints a link and a one-time code instead. First turn on device code login in your ChatGPT security settings, or, in a ChatGPT workspace, ask an admin to allow it in the workspace permissions. Then run the command below, open the link on any device, sign in, and enter the code within 15 minutes. To use an OpenAI API key instead, pipe it to codex login as the second command shows.codex login --device-auth # or sign in with an API key instead printenv OPENAI_API_KEY | codex login --with-api-keyStart Codex in tmux
Open a named tmux session, clone your project, and start Codex.tmux new -A -s codex git clone https://github.com/you/your-repo.git cd your-repo codexDetach, reconnect, and resume
Press Ctrl+B, then D, to detach and leave Codex working. Reconnect over SSH any time and run the same tmux command to pick up where you left off. A server reboot ends tmux sessions. After one, start tmux again, go back into your project and run codex resume --last, which reopens the most recent chat in that folder.tmux new -A -s codex # reattach cd your-repo && codex resume --last # after a reboot
Prefer a desktop app?
The ChatGPT desktop app can run Codex chats on this server over SSH. Follow steps 1 to 5 so Codex is installed and signed in on the server, then add the server to ~/.ssh/config on your computer. In the app, open Settings, then Connections, add the host and choose your project folder. You can also hand a chat off from your laptop to the server and back. Read OpenAI's guide.
# ~/.ssh/config on your computer
Host cometvps
HostName your-server-ip
User devCheck in from your phone
Any SSH app on your phone can reattach to the same tmux session, so you can read progress, answer an approval prompt or start the next task from anywhere.
Security tip: before you loosen approvals
If you relax Codex's sandbox or approval settings for unattended runs, keep the server free of anything you can't afford to lose. Give it a deploy key or fine-grained token scoped to the repositories it needs, never your personal SSH key, keep production secrets off the box, and allow only SSH through the firewall. Backups are available as a paid add-on, and you can reinstall the OS from the control panel at any time.
sudo apt install -y ufw
sudo ufw allow OpenSSH
sudo ufw enableRecommended VPS Plans
Choose a server for Codex based on how many sessions you run at once
Core VPS - Basic
2 vCPU, 4GB RAM, 60GB NVMe
Meets the 4 GB RAM minimum that Anthropic and OpenAI list for Claude Code and Codex. Good for one agent session at a time on small and medium repositories.
Supernova VPS - Blaze
4 Ryzen Cores, 8GB DDR5, 100GB NVMe
Meets OpenAI's 8 GB recommendation for Codex, with room for two or three agents plus language servers, test suites and Docker builds on fast Ryzen cores.
Supernova VPS - Flare
6 Ryzen Cores, 16GB DDR5, 200GB NVMe
Room for four or more agents, each in its own git worktree, alongside heavy builds and test suites. Also works well as one shared server for a small team.
Ready to Run Codex 24/7?
Launch a server in minutes and keep your agent working while you're away from your desk.