Set up Node.js and Claude Code on the VPS
Install Node.js and Claude Code on the VPS, authenticate with your Claude subscription, and have your first remote conversation.
Lesson outcome
You will have Claude Code running on your VPS, authenticated with your Claude Pro or Max subscription, and be able to use it exactly as you do on your local machine.
Why this matters in an agency
When Claude Code runs on your VPS, you are no longer tied to your laptop. You can SSH in from any device — your office computer, your personal laptop, your phone (with a terminal app), or a client's machine — and have the full operator stack available. The VPS never closes, never runs out of battery, and never loses your work when the lid shuts. This is the moment the operator stack becomes a real operating system rather than a local experiment.
Inputs, tools, and prerequisites
SSH access to your VPS (ssh vps from the previous module). Your Claude Pro or Max subscription credentials.
Step-by-step walkthrough
SSH into your VPS
Open your terminal and connect:
```
ssh vps
```
You are now on the VPS. Everything you type runs on the remote server.
Install Node.js on the VPS
The VPS is a fresh Ubuntu installation. It does not have Node.js yet. The fastest way to install it is using the NodeSource repository, which provides up-to-date Node.js packages for Ubuntu.
Run these commands on the VPS:
```
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash -
sudo apt-get install -y nodejs
```
The first command adds the Node.js package repository. The second installs Node.js. This takes about thirty seconds.
Verify:
```
node --version
npm --version
```
Both should print version numbers. Node.js is installed on the VPS.
Install Claude Code
Same command as on your local machine:
```
npm install -g @anthropic-ai/claude-code
```
Since you are logged in as root, you do not need sudo. The installation takes a minute or two.
Verify:
```
claude --version
```
You should see the version number. Claude Code is installed on the VPS.
Authenticate Claude Code
Run:
```
claude
```
Claude Code will need to authenticate, just like it did on your local machine. However, the VPS does not have a web browser, so the flow is slightly different. Claude Code will display a URL and a code. You need to:
- Copy the URL that Claude Code shows you.
- Open that URL in a browser on your local machine (or phone).
- Sign in with your Claude account.
- Enter the code that Claude Code displayed, or the page will automatically confirm the link.
Once authenticated, Claude Code will show the familiar prompt on the VPS. You are now running Claude Code remotely.
Have your first remote conversation
Ask Claude Code something to confirm it is working:
```
What operating system is this machine running? What are the hardware specs?
```
Claude Code will run commands on the VPS (with your permission) and report back. It will tell you Ubuntu version, CPU count, RAM, and disk space. This is the same Claude Code you used locally — same model, same capabilities — but now it is running on a server that is always on.
Create a working directory
Create a directory where your projects will live:
```
Create a directory at /root/projects and tell me the full path.
```
This is where you will store your vault, scripts, and tools on the VPS. Having a consistent working directory makes navigation easier.
Verify the full loop
Disconnect from the VPS by typing /exit to leave Claude Code, then exit to close the SSH session. Wait a moment. Then SSH back in:
```
ssh vps
cd /root/projects
claude
```
Claude Code starts up on the VPS, in your projects directory, ready to work. You just completed the full loop: local terminal → SSH → VPS → Claude Code. This is how you will start every work session from now on.
Failure modes and verification checks
The most common failure is the authentication flow when there is no browser on the VPS. If the URL method does not work, check that your local browser has access to the internet and that you are signed into the correct Claude account. If Claude Code fails to start with a Node.js error, verify that node --version shows v18 or higher.
Another common issue: if you get "npm: command not found" after installing Node.js, try closing the SSH session and reconnecting. The shell needs to reload its PATH.
Verification: Claude Code runs on the VPS, responds to questions, can execute commands, and survives a disconnect-reconnect cycle.
Implementation checklist
- SSH into the VPS.
- Install Node.js via NodeSource.
- Verify Node.js and npm versions.
- Install Claude Code globally.
- Verify Claude Code version.
- Authenticate Claude Code using the URL+code flow.
- Have a test conversation.
- Create
/root/projectsas the working directory. - Disconnect, reconnect, and verify Claude Code still works.
Immediate next action
Move to the next module. You will use Claude Code on the VPS to secure and configure the server properly.
Exercise
With Claude Code running on the VPS, ask it to compare the VPS to your local machine:
```
Tell me the key differences between this server environment and a typical Mac or Windows desktop. What can this server do that my laptop cannot? What does it lack?
```
Read the answer. Claude Code will explain things like: the server has no graphical interface, it runs Linux instead of macOS or Windows, it stays on when you disconnect, it has a fixed public IP address, and it lacks a display, keyboard, or mouse. This mental model — understanding what the VPS is and is not — will help you make better decisions about what to run locally versus remotely.