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:

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
- Open https://www.hostgator.com/vps-hosting in your browser.
- Pick the plan you want and click Choose Plan.

Important: Pricing is subject to change—please visit https://www.hostgator.com/vps-hosting for the current introductory/sign-up offer for HostGator VPS Hosting. For the most up-to-date renewal pricing, visit your HostGator Customer Portal Renewal Center.
- Pick a Data Center location.

- On the Cart page, you can set up your server the way you want:
- Hardware:
- Pre-selected:
You can change to a different Self-Managed VPS plan here.

- Configure:
Click Configure if you want to build your own custom package.
Note: Any changes you make here will change the total price.

- Pre-selected:
- Software:
If the selected plan does not meet the app's minimum requirements, the app will be grayed out.
- Click the Application tab.
- Choose Claude Code.

- In the pop-up, click Confirm.

- Hardware:
- Support & Security:
You can add Premium Support here for faster help and quicker replies. This is Optional.

- 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.

- 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.

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

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

- On the Checkout page, do the following:
If you are new to HostGator:
- Fill in your billing information and contact details. If you don't want marketing emails, uncheck the box at the bottom.

- Create a password for your account.

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

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.

- Fill in your billing information and contact details. If you don't want marketing emails, uncheck the box at the bottom.
- 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.

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:
- Log in to your Customer Portal.
- From the left-hand menu, navigate to Hosting and select My Plans.

- 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.

- Click the Reset Password button.

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

- 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:Replaceyour_server_ipwith your actual server IP address.ssh root@your_server_ipHere'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
- Sign up for an account over at the Anthropic Console.
- Find the API Keys or Account Settings area and create a new key there.
(Yours will look something like:sk-ant-xxxxxxxxxxxxxxxx) - Copy it down somewhere secure. Treat it like a password — never hand it off to anyone else.
Run Claude Code on your HostGator AI Credits balance instead:
- How to Manage Your HostGator API Keys: Learn how to quickly create, view, and organize your API keys to keep your account secure.
- How to Purchase HostGator AI Credits: Easily add AI credits to your account balance so your services run without interruption.
- How to Connect HostGator AI Credits to Claude Code: Link your credit balance to Claude Code in a few simple steps to start running your projects.
Signing up is free. Actually generating a key and using Claude, however, usually means adding billing details to your account, and charges can apply from there. For the current rates, check Anthropic's pricing page.
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:
- For the current terminal session (temporary):
export ANTHROPIC_API_KEY="sk-ant-xxxxxxxxxxxxxxxx"
- To persist the key (recommended):
echo 'export ANTHROPIC_API_KEY="sk-ant-xxxxxxxxxxxxxxxx"' >> /root/.profile source /root/.profile
- Confirm Claude Code is installed:
Expected output:claude --version
Claude Code CLI version 1.2.3 - Start Claude Code:
Expected prompt:claude
claude>
Error: ANTHROPIC_API_KEY not set. Please export your API key and try again.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:
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