AI Command-Line Coding Assistant Setup for a Single Student Laptop

    This guide explains how to deploy a terminal-based AI coding assistant on the one laptop many students rely on. It compares native Windows and a Linux virtual machine, covers environment checks, Node.js installation, API key configuration, security and proxy settings, and common troubleshooting steps so readers can get a working setup and verify it before daily use.

    Introduction

    Command-line AI coding assistants are tools that run in the terminal. You can start one in a project directory, ask questions in natural language, or let it read the code in the current directory and suggest changes. They do not replace an understanding of the code, but they can save time when explaining errors, reading unfamiliar code, and writing repetitive scripts.

    For most university students, the only development device is a laptop. The good news is that these tools are small and do not have high hardware requirements. The key is to set up the environment correctly and manage keys securely. This article follows this order: first choose a deployment method, then check the environment, then provide two sets of steps for native Windows and a virtual machine, and finally explain security settings and troubleshooting methods.

    1. Choose a Deployment Method First

    The two options suit different scenarios. Use the table below as a reference.

    Comparison Item Native Windows Linux Virtual Machine in Windows
    Ease of setup Low; fewer installation steps Higher; requires installing a virtual machine and Linux first
    Resource usage Small Larger; the virtual machine uses memory and disk space
    Suitable courses or projects General web, Python, and Java projects Courses that require Linux commands, servers, or specific dependencies
    Environment isolation Dependency conflicts may affect the system Isolated from the main system; can be rebuilt if problems occur
    Recommended audience Students using it for the first time Students whose courses explicitly require a Linux environment

    If you are unsure, complete the deployment on native Windows first. When a course actually requires a Linux environment, add a virtual machine.

    2. Check the Environment

    Is the Operating System Version Usable?

    Windows 10 reached the end of official support in October 2025. It is recommended to upgrade to Windows 11 and keep the system updated to the latest version. You can check the version information in Settings > System > About.

    Hardware and Disk Space

    • Memory: 8 GB is the minimum for running the tool. 16 GB is safer, especially when the browser, IDE, and virtual machine are open at the same time.
    • Disk: Reserve at least 20 GB of free space. Node.js, dependency caches, and virtual machine images take up much more space than the tool itself.

    Install Node.js

    Many command-line AI coding tools are built on Node.js, so Node.js must be installed first. Download the LTS (Long-Term Support) version from the official Node.js website. After installation, open a new terminal and run the following commands to confirm that the version numbers are displayed correctly:

    1. node -v
    2. npm -v

    If you see a message such as “not recognized as an internal or external command,” the usual cause is that Node.js was not added to PATH during installation, or the terminal was not reopened. Reinstall and restart the terminal.

    3. Native Windows Deployment

    1. Install a Terminal

    Windows 11 includes Windows Terminal. If it is not available, search for “Windows Terminal” in the Microsoft Store and install it. It supports multiple tabs and can open PowerShell, Command Prompt, and Git Bash at the same time, making it easy to switch between them.

    2. Install a Command-Line AI Tool

    For example, Anthropic’s official Claude Code is installed globally via npm. Run the following in PowerShell:

    1. npm install -g @anthropic-ai/claude-code
    2. claude --version

    If the second command outputs a version number, the installation was successful. Package names and installation methods may change between versions, so refer to the tool’s official documentation. Other similar tools, such as OpenAI’s Codex CLI and Google’s Gemini CLI, use similar installation flows. Choose one of them.

    On Windows, running npm global installs with administrator privileges is not recommended. If a permission error occurs, check whether Node.js is installed in the correct location, or use a version manager such as nvm-windows.

    3. Configure the API Key

    Tools need an API key to call cloud large language models. It is equivalent to an account password and must be kept secure. Different shells use different syntax; choose according to the table below.

    Shell Valid Only in the Current Window Permanently Saved (Requires a New Terminal)
    PowerShell $env:ANTHROPIC_API_KEY="your key" [Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY","your key","User")
    Command Prompt (cmd) set ANTHROPIC_API_KEY=your key setx ANTHROPIC_API_KEY "your key"
    Git Bash or WSL export ANTHROPIC_API_KEY="your key" Write it to ~/.bashrc, then run source ~/.bashrc

    Note that export only works in Git Bash or a Linux shell; PowerShell and cmd will report errors. In addition, variables written by setx do not affect terminals that are already open. You must open a new terminal for them to take effect.

    If the tool supports account login, prefer that method to avoid storing a plaintext key locally.

    4. Launch and Verify

    Enter a practice project directory and run the launch command (for Claude Code, this is claude). First ask it to explain a small file or a simple function to confirm that it returns normal results. If it returns an authentication error, check whether the environment variable is effective in the current terminal.

    4. Deploy a Linux Environment in a Virtual Machine

    1. Choose Virtual Machine Software

    You can use open-source VirtualBox or desktop virtualization products such as VMware Workstation. Both can run common distributions such as Ubuntu on Windows.

    2. Allocate Resources

    2 CPU cores and 4 GB of memory are the minimum usable configuration. This is generally enough when only running command-line tools and compilation tasks. If your laptop has 16 GB of memory, allocating 4 cores and 8 GB to the virtual machine is recommended; compilation and dependency installation will be noticeably smoother. Allocating too many resources will slow down the main system, so adjust according to your available memory.

    3. Install Linux and Update Packages

    Choose an Ubuntu LTS version. After installation, open the terminal and run:

    1. sudo apt update
    2. sudo apt install -y build-essential git curl

    4. Install Node.js with nvm

    The Node.js version installed directly from the system repository may be old. It is recommended to use nvm (Node Version Manager) to install the LTS version. For the version number of the installation script, refer to the latest instructions in the official nvm repository:

    1. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
    2. source ~/.bashrc
    3. nvm install --lts
    4. node -v

    Node.js installed by nvm is located in the user directory, so global installs can avoid using sudo. If you still encounter an EACCES permission error, do not force the installation with sudo. Check whether the current Node.js is managed by nvm.

    5. Install the Tool and Set the Key

    In the Linux terminal, the installation steps are the same as on Windows:

    1. npm install -g @anthropic-ai/claude-code
    2. export ANTHROPIC_API_KEY="your key"

    To save it permanently, write it to ~/.bashrc. Note, however, that a plaintext key in .bashrc may be seen by others, so this is only suitable for a personal computer.

    6. Network Mode and Code Synchronization

    • NAT mode: The virtual machine accesses the internet through the host. This is the default and easiest choice. In most cases, AI tools can connect normally.
    • Bridged mode: The virtual machine has an independent address on the local network, which is suitable for services that need to be accessed by other devices. If you only use AI tools, NAT is sufficient.

    A common approach is to write code in an editor you are comfortable with on Windows and run the tool in Linux. You can use the shared folder feature of the virtual machine software. There are two points to note: first, shared folders let the virtual machine read and write files on the host, so share only project directories, not the entire user directory; second, modifying the same file on both sides at the same time may cause conflicts, so use Git and commit before each change.

    5. Security and Network Settings

    Secure Storage of API Keys

    • Do not write API keys into source code, configuration files, or screenshots.
    • If a project has a .env file, add it to .gitignore to avoid committing it to the repository:
    1. .env
    2. *.key
    • If a key is accidentally leaked, immediately delete the old key in the service provider’s console and generate a new one, then update the local environment variable.
    • Keep sensitive files such as database passwords and internal configurations outside the project directory, or exclude them using the tool’s ignore configuration. Refer to the official documentation for the exact syntax.

    Proxy Settings

    If requests to the service provider’s API time out, proxy configuration may be needed. The port number depends on the proxy software you use; the 7890 below is only an example.

    PowerShell:

    1. $env:HTTP_PROXY="http://127.0.0.1:7890"
    2. $env:HTTPS_PROXY="http://127.0.0.1:7890"

    Command Prompt:

    1. set HTTP_PROXY=http://127.0.0.1:7890
    2. set HTTPS_PROXY=http://127.0.0.1:7890

    Linux or Git Bash:

    1. export HTTP_PROXY="http://127.0.0.1:7890"
    2. export HTTPS_PROXY="http://127.0.0.1:7890"

    Use proxies only for lawful network access. Do not write account credentials into scripts, and do not commit proxy configurations to public repositories.

    6. Troubleshooting Common Issues

    Symptom Possible Cause Solution
    Command not found npm global path is not in PATH, or the terminal was not restarted Run npm config get prefix, confirm that the path is in PATH, and restart the terminal
    EACCES permission error during installation System-level Node.js or sudo was used Install Node.js with nvm and do not use sudo for global installs
    401 error returned API key is incorrect or not effective Check that the key is complete and confirm that the environment variable was set in the current terminal
    429 error returned Too many requests or quota exhausted Retry later, or check the quota in the service provider’s console
    Connection timeout Network is unavailable or proxy configuration is incorrect Check the network and confirm that the proxy port is correct
    Virtual machine cannot access the internet Network adapter mode is incorrect Set the adapter to NAT, restart the virtual machine, and test again
    PowerShell reports an error, but the command works in a tutorial The tutorial uses Linux syntax Use the syntax for the corresponding shell according to the table in Section 3

    7. Acceptance Check

    After deployment, check the following three items in order:

    1. node -v and npm -v output version numbers.
    2. The tool’s --version outputs a version number.
    3. Start the tool in a practice directory and ask it to explain a small file; it returns a normal answer.

    If all three pass, the environment is ready for daily development. The tool is most helpful for repetitive coding, finding the cause of errors, and reading unfamiliar code, but generated code still needs to be run, tested, and reviewed by you.