Skip to content

Feature: Pre-install AI CLI tools (Gemini, Codex, Claude Code) for end users #185

@MagnaCapax

Description

@MagnaCapax

Summary

Pre-install three AI CLI tools system-wide on PMSS servers so end users have them available immediately on login without running any installers themselves. Each user authenticates independently (BYO API key or OAuth) — no shared credentials, no pre-existing keys, no data leakage between users.

Tools:

Tool Binary Source License
Google Gemini CLI gemini npm @google/gemini-cli Apache 2.0
OpenAI Codex CLI codex Standalone Rust binary from GitHub releases Apache 2.0
Anthropic Claude Code claude npm @anthropic-ai/claude-code Proprietary

Privacy & Security Alignment

Cardinal Value #1 — Liberty and privacy are sacred:

  • NO pre-existing API keys anywhere in skel or system config
  • Each user's config is isolated: ~/.gemini/, ~/.codex/, ~/.claude/ (mode 700, created by tools on first run)
  • No shared credentials between users
  • Users bring their own API keys or use their own OAuth logins
  • Tools communicate with their respective cloud APIs — no local model data, no inter-user leakage

Security considerations:

  • All three tools can execute shell commands — but users already have shell access, so this doesn't change the threat model
  • Codex CLI has Landlock sandboxing on kernel 5.13+ (Debian 12). On Debian 10/11 (kernel <5.13), sandbox is unavailable
  • System-wide /etc/codex/config.toml can set sandbox = "danger-full-access" on older kernels (user already has full shell, sandbox is protection from Codex, not from the user)

Prerequisites

Node.js 20+ (required for Gemini CLI and Claude Code)

Stock Debian Node.js is too old for all versions:

Debian Stock Node.js Required
10 (Buster) 10.x 20+
11 (Bullseye) 12.x 20+
12 (Bookworm) 18.x 20+

Install via NodeSource:

curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs

Kernel compatibility (Codex CLI sandbox)

Debian Kernel Codex Landlock sandbox
10 4.19 NO — needs system config workaround
11 5.10 NO — needs system config workaround
12 6.1 YES — works natively

Installation Methods (per tool)

1. Gemini CLI

# System-wide via npm (requires Node.js 20+)
npm install -g @google/gemini-cli
# Binary: /usr/local/bin/gemini (or wherever npm prefix points)

Per-user config: ~/.gemini/ (settings.json, oauth_creds.json, .env)
System config: /etc/gemini-cli/settings.json (optional, lowest precedence)
Auth options:

  • Google OAuth (free tier: 60 req/min, 1000 req/day) — opens browser
  • GEMINI_API_KEY env var — headless, BYO key from Google AI Studio
  • Vertex AI credentials — for GCP users

2. Codex CLI

# Download static musl binary (no Node.js required, no dependencies)
wget https://github.com/openai/codex/releases/latest/download/codex-x86_64-unknown-linux-musl.tar.gz
tar xzf codex-x86_64-unknown-linux-musl.tar.gz
mv codex-x86_64-unknown-linux-musl /usr/local/bin/codex
chmod +x /usr/local/bin/codex

Per-user config: ~/.codex/ (config.toml, auth.json)
System config: /etc/codex/config.toml (lowest precedence)
Auth options:

  • ChatGPT account OAuth — opens browser (requires Plus/Pro/Business/Enterprise)
  • OPENAI_API_KEY via codex login --with-api-key — headless, BYO key
  • Device code auth (codex login --device-code) — headless, beta

Debian 10/11 workaround (sandbox unavailable):

mkdir -p /etc/codex
cat > /etc/codex/config.toml << 'EOF'
# Landlock unavailable on kernel < 5.13
# Users already have full shell access; sandbox protects from Codex, not from user
sandbox = "danger-full-access"
EOF

3. Claude Code

# System-wide via npm (requires Node.js 18+, but we have 20+ from Gemini)
npm install -g @anthropic-ai/claude-code
# Binary: /usr/local/bin/claude

Note: Anthropic's recommended install (curl | bash) is per-user to ~/.local/bin/claude. For system-wide deployment, npm global install is the practical option despite being marked deprecated.

Per-user config: ~/.claude/ (settings.json, .credentials.json)
Auth options:

  • OAuth login — opens browser (requires Claude Pro/Max/Teams/Enterprise)
  • ANTHROPIC_API_KEY env var — headless, BYO key, pay-as-you-go API rates

Implementation Plan

Phase 1: System-wide binary installation (server-side script)

Create a PMSS script (e.g., /scripts/util/installAiTools.php or a bash script invoked during update) that:

  1. Checks if Node.js 20+ is installed; if not, installs via NodeSource
  2. Installs Gemini CLI via npm install -g @google/gemini-cli
  3. Downloads and installs Codex CLI static binary to /usr/local/bin/codex
  4. Installs Claude Code via npm install -g @anthropic-ai/claude-code
  5. Creates /etc/codex/config.toml with sandbox workaround on kernels < 5.13
  6. Verifies all three binaries are executable and in PATH

Phase 2: User-facing documentation / helper

Add an ai-help function to skel .bashrc (or .bashrc.custom) that displays:

  • Available tools and their commands
  • How to authenticate each tool (BYO API key instructions)
  • Links to documentation
  • Note about free tier availability (Gemini)

This could also be a standalone /usr/local/bin/ai-help script to avoid .bashrc bloat.

Phase 3: Skeleton integration

  • If adding files to skel (e.g., a helper script in ~/bin/): add to skeleton.php file list for propagation to existing users
  • System-wide binaries in /usr/local/bin/ don't need skel — they're available to all users immediately via PATH (the pmss_normalize_path function in .bashrc includes /usr/local/bin/)

Phase 4: Testing

  • Test on ONE server first (safety doctrine)
  • Verify on Debian 10, 11, and 12 if possible
  • Confirm each tool starts, shows auth prompt, and doesn't leak to other users
  • Confirm disk usage is acceptable on root partition
  • Confirm user quota is not affected (system-wide install, not per-user)

Estimated disk usage (system partition, not user quota)

  • Node.js 20: ~100 MB
  • Gemini CLI + deps: ~50-100 MB
  • Codex CLI binary: ~30 MB
  • Claude Code + deps: ~50-100 MB
  • Total: ~250-400 MB on root filesystem

Rollback

  • npm uninstall -g @google/gemini-cli @anthropic-ai/claude-code
  • rm /usr/local/bin/codex
  • Optionally remove NodeSource repo and Node.js (but other tools may use it)

User authentication summary

Tool Free tier? BYO key env var OAuth Headless
Gemini YES (Google account) GEMINI_API_KEY Google OAuth API key only
Codex NO (needs ChatGPT sub or API key) OPENAI_API_KEY ChatGPT OAuth API key or device code
Claude NO (needs subscription or API key) ANTHROPIC_API_KEY Claude OAuth API key only

Related

Väinämöinen noreply@pulsedmedia.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions