Loading...

Knowledge Base

Purchase a HostGator Self-Managed VPS with Claude Code Installation

Claude Code is Anthropic's agentic coding tool, built to live inside your terminal. Instead of hunting through documentation or writing everything by hand, you hand off substantial engineering work, like debugging, refactoring, and managing git, to an AI that understands plain-language instructions.

Key Benefits of Claude Code

Constantly switching between your code editor and a browser tab breaks your focus. Claude Code solves that by sitting right in your terminal, ready to fix bugs, take on multi-step tasks, or search through a large codebase without pulling you away from where you're already working. Keeping everything in one place means fewer context switches and more time actually building.

What You Can Do With Claude Code

From the first commit to the last pull request, Claude Code stays with your project every step of the way:

  • Fix Bugs Faster: Point Claude at an error and it investigates the cause, proposes a fix, and runs the code to confirm the fix actually works.
  • Automate Big Changes: Rename variables, restructure folders, or touch your whole codebase at once, all while keeping things consistent.
  • Write and Run Tests: Generate tests for new features and run them right in the terminal to catch problems early.
  • Handle Git Tasks: Let Claude stage your changes, draft clear commit messages, and get your work ready for a pull request.
  • Manage Your System: Run scripts, install libraries, or organize files, all through simple commands instead of manual steps.

Because it's woven so deeply into your local environment, engineers who get used to staying in flow through complex builds tend to keep reaching for Claude Code.

How to Purchase a Self-Managed VPS with Claude Code Installation

To use Claude Code on HostGator, you first need to buy a Self-Managed VPS plan. Here is how to do it:

Pre-configured Setup

Self-Managed VPS - Pre-configured Setup
Not sure which VPS setup is right for you? That's exactly what Pre-configured Setup is for. You'll find this option near the top of the HostGator Self-Managed VPS purchase page, and it takes the guesswork out of getting started. Just tell us what you're building—a WordPress Site, an AI Agent/Claude Code project, a Dev/Staging environment, or an eCommerce Store—and we'll automatically select the right plan, operating system, and template to match.
  • Great option if you're new to VPS or want a fast, easy setup
  • Get the recommended configuration for your project right away
  • No need to figure out the technical details yourself
  • Full flexibility to adjust settings later on
Try Pre-configured Setup and have your HostGator Self-Managed VPS ready to go in minutes!
  1. Open https://www.hostgator.com/vps-hosting in your browser.
  2. Pick the plan you want and click Choose Plan.

    Self-Managed VPS - Choose Plan
     

  3. Pick a Data Center location.

    Self-Managed VPS - Data Center Locations
     

  4. On the Cart page, you can set up your server the way you want:
    1. Hardware:
      1. Pre-selected:

        You can change to a different Self-Managed VPS plan here.

        Self-Managed VPS - Pre-selected Hardware
         

      2. Configure:

        Click Configure if you want to build your own custom package.

        Self-Managed VPS - Configure
         

    2. Software:
      1. Click the Application tab.
      2. Choose Claude Code.

        Self-Managed VPS - Claude Code Software
         

      3. In the pop-up, click Confirm.

        Self-Managed VPS - Claude Code -Confirm
         

  5. Support & Security:

    You can add Premium Support here for faster help and quicker replies. This is Optional.

    Self-Managed VPS - Premium Support
     

  6. AI Credits:

    Add a HostGator AI Credits package to connect your application to top LLM providers through one API key and a single bill. This step is optional.

    Self-Managed VPS - AI Credits
     

  7. In Advanced options, you can set these up if you want:
    • Extra IPs: Add more IP addresses for an extra cost. The price changes based on how many you add.
    • Hostname: Give your server a custom name. This is optional.
    • SSH Key: If you want to log in without a password, add your SSH public key here. This is optional.

      Self-Managed VPS - Advanced Options
       

  8. Choose a billing term, check your Order Summary, then click Continue to Checkout.

    Self-Managed VPS -Initial- Order Summary
     

  9. Check your HostGator cart. Remove any add-ons you don't want, then click Continue to Checkout again.

    Self-Managed VPS - Continue to Checkout
     

  10. On the Checkout page, do the following:

    If you are new to HostGator:

    1. Fill in your billing information and contact details. If you don't want marketing emails, uncheck the box at the bottom.

      Self-Managed VPS - Billing Information
       

    2. Create a password for your account.

      Self-Managed VPS - Account Password
       

    3. Choose how you want to pay—Credit Card or PayPal—and enter your payment details.

      Self-Managed VPS - Payment Method Options
       

    If you already have an account, your HostGator login details will show up once you log in to your Customer Portal. If you are not logged in, click Log In.

    Self-Managed VPS - HostGator Login
     

  11. Review your payment method and order total. If you have a promo code, click Add Promo Code and enter your code. If you need to make changes, click Edit or Add Payment Method. When everything looks correct, click Submit Payment to complete your purchase. By clicking Submit Payment, you agree to the Auto Renewal Terms, Terms of Service, Cancellation Policy, and Privacy Notice.

    Self-Managed VPS - Submit Payment
     

After checkout, your Self-Managed VPS will begin setting up. Once it’s ready, you can find it under the Hosting tab in your Customer Portal.

Setting Up Your Anthropic API Key

The most straightforward way to authenticate Claude Code on a headless server like this is with an Anthropic API Key (ANTHROPIC_API_KEY). This key is what lets your server connect securely to the Claude API.

After installation completes:

  1. Log in to your Customer Portal.
  2. From the left-hand menu, navigate to Hosting and select My Plans.

    Customer Portal - Hosting tab - View Details
     

  3. Locate the server you want to manage, then click View Details in the bottom-left corner to expand the section and access additional server information.

    Customer Portal - Hosting tab - View Details
     

  4. Click the Reset Password button.

    Customer Portal - Hosting tab - View Details - Reset Password
     

  5. In the pop-up window, type your new root password, then click Reset Password again to confirm and save the changes.

    Customer Portal - Hosting tab - View Details - Reset Password
     

  1. Connect to your server via SSH.
    Use your VPS IP and credentials with an SSH client, follow the prompts, and enter your root password when asked:
    ssh root@your_server_ip

    Here's what that message looks like:

    Welcome to Ubuntu 24.04.4 LTS (GNU/Linux 6.8.0-111-generic x86_64)
    ********************************************************************************
    
    Claude Code Ubuntu 24.04 image is installed and ready.
    
    ANTHROPIC_API_KEY is not configured yet.
    
    Set it for current shell:
      export ANTHROPIC_API_KEY="sk-ant-..."
    
    Persist it for root:
      echo 'export ANTHROPIC_API_KEY="sk-ant-..."' >> /root/.profile
      source /root/.profile
    
    Verify installation:
      claude --version
    
    Start Claude Code:
      claude
    
    Documentation:
      /root/README.md
    
    ********************************************************************************
    

Where to get your API key

  1. Sign up for an account over at the Anthropic Console.
  2. Find the API Keys or Account Settings area and create a new key there.
    (Yours will look something like: sk-ant-xxxxxxxxxxxxxxxx)
  3. Copy it down somewhere secure. Treat it like a password — never hand it off to anyone else.

Configuring Your API Key

Once you have your key, add it to your server's environment using the commands from your welcome message, or the steps below:

  1. For the current terminal session (temporary):
    export ANTHROPIC_API_KEY="sk-ant-xxxxxxxxxxxxxxxx"
  2. To persist the key (recommended):
    echo 'export ANTHROPIC_API_KEY="sk-ant-xxxxxxxxxxxxxxxx"' >> /root/.profile source /root/.profile
  3. Confirm Claude Code is installed:
    claude --version
    Expected output: Claude Code CLI version 1.2.3
  4. Start Claude Code:
    claude
    Expected prompt: claude>

For anything beyond the basics, check the local documentation stored on your server:

cat /root/README.md

Additional Information and Examples

Running this command shows you the local documentation:

cat /root/README.md

Sample output:

Last login: Wed Jun  3 14:08:04 2026 from 203.0.113.5
root@server-123456:~# cat /root/README.md
# Claude Code

## Description

Claude Code is an agentic coding tool by Anthropic that runs in your terminal, allowing developers to delegate substantial engineering tasks such as debugging, refactoring, and git workflows to AI via natural language commands.

## Services

- SSH on port 22 (protected by UFW)
- Claude Code CLI available in terminal sessions

## Links

- Claude Code Installation: https://claude.ai/install.sh
- Anthropic Claude: https://www.anthropic.com/claude
- Node.js: https://nodejs.org/

## What's Included

- Ubuntu 24.04 minimal base image
- Node.js 22.x from NodeSource repository
- Claude Code CLI installed globally
- UFW firewall configured (SSH only)
- Automated first-boot configuration check
- MOTD support via /etc/update-motd.d/99-claude-code
- Test suite for validation

## Installation Process

The build process performs the following steps:

1. Prerequisites: Installs required packages (curl, ca-certificates, gnupg, xz-utils)
2. Node.js Setup: Removes any distro-provided Node.js/npm to avoid vulnerabilities, installs Node.js 22.x from NodeSource
3. Claude Code Installation: Attempts native installer first (curl -fsSL https://claude.ai/install.sh | bash), falls back to npm (npm install -g @anthropic-ai/claude-code) if needed
4. Configuration: Sets up PATH, permissions on copied files, and writes installation notes
5. Validation: Verifies Node.js, npm, and Claude Code are working
6. Firewall: Configures UFW with SSH access only
7. Cleanup: Removes package caches and temporary files

## Configuration

### PATH Setup

The image configures the shell PATH to include common Claude Code installation locations via /etc/profile.d/claude-code.sh:

- /usr/local/bin
- ~/.local/bin
- ~/.claude/bin
- ~/.npm-global/bin

### First Boot

On first boot, the system (/var/lib/cloud/scripts/per-instance/001_onboot) checks for an Anthropic API key in:

- Environment variable ANTHROPIC_API_KEY
- /etc/environment
- /root/.profile

If found, it writes a ready-to-use message to /root/.app_passwords/claude-code-firstboot.txt. If not, it provides setup instructions in the same file.

## Usage

### Setting API Key

Before using Claude Code, you need an Anthropic API key from https://console.anthropic.com/.

For current shell only:
export ANTHROPIC_API_KEY="sk-ant-..."

Persist for root user sessions:
echo 'export ANTHROPIC_API_KEY="your_api_key_here"' >> /root/.profile
source /root/.profile

### Running Claude Code

Verify installation:
claude --version

Start Claude Code:
claude

If claude is not found after logging in, reload your shell environment:
source /etc/profile
source ~/.bashrc
claude

## Security

- UFW firewall enabled with default deny incoming
- Only SSH (port 22/tcp) allowed inbound
- All outbound traffic allowed
- Root login via SSH with key authentication only

## Testing

The image includes a test suite (/root/app_test/main.t) that validates:

- Claude Code binary is executable in expected locations
- claude --version works in shell environment with PATH loaded

Run tests:
cd /root/app_test
perl main.t

Loading...