Deploy an AI Coding Assistant on a Private NAS with a VM: Complete Setup Guide
A practical walkthrough for running a command-line AI coding assistant on a private NAS inside a virtual machine. It compares containerized desktop workstations against VMs for 7x24 service workloads, explains a modest 2 vCPU / 4 GB resource plan, and walks through OS installation choices, SSH-based remote administration, and installing the assistant without root. It also covers hardening, snapshots, autostart, monitoring, resource limits, and common failure modes, so the NAS ends up as a maintainable private AI coding workstation.
In automation scripts, code assistance, and local knowledge bases, more developers are moving command-line AI coding assistants onto hardware they control. Compared with relying entirely on public cloud services, a private deployment has clear advantages in data privacy, predictable cost, and availability on your own schedule. The hard part is rarely which install command to run — it is deciding what form to deploy into and how to keep it running reliably over the long term.
This article uses a private network-attached storage (NAS) device as the deployment host. It covers choosing a deployment form, resource planning, OS installation, setting up a remote access channel, and finally installing the assistant itself without root privileges.
1. Choosing a Deployment Form: Containerized Desktop or Virtual Machine
Several NAS products now try to squeeze desktop capability into the appliance: outputting a graphical desktop over HDMI so the same box serves files and desktop applications. A containerized desktop workstation like this is an interesting setup and works well for local media playback, browsing, and monitoring dashboards — it also makes decent use of the HDMI port.
For an AI coding assistant that has to stay up 7x24 and be invoked continuously, however, the containerized desktop has a few practical weaknesses:
- The graphical stack is tightly coupled to application lifecycle; if the desktop session breaks, services started alongside it tend to exit too.
- Containers share the host kernel, so upgrading the host or rebuilding the container can both disturb runtime consistency.
- Long dependency chains mean high debugging cost, and maintainability over months tends to be mediocre.
A virtual machine, by contrast, packages the entire system into a self-contained runtime. Isolation is better, snapshots allow quick rollback, and the operational habits carry over directly from traditional Linux servers. For long-running service workloads, this article recommends deploying inside a VM.
2. Resource Planning: How Much Should the VM Get
One counterintuitive but important conclusion: for this kind of assistant, the heavy work — model inference — normally happens at the remote end. The local VM mainly handles request forwarding, context assembly, and lightweight processing, so it is not sensitive to local resources.
- CPU: 2 cores is plenty; most of the time the load stays low.
- Memory: 4 GB covers the OS, the runtime, and the assistant process with some headroom.
- Disk: reserve 20–40 GB for the system, dependencies, logs, and cache.
- Network: default NAT is sufficient. If other devices on the LAN should reach the assistant, switch to bridged mode.
2 vCPU and 4 GB is a “sufficient but not excessive” tier: stable enough to run on, while leaving the NAS’s primary workloads — storage and transcoding — their resources.
3. A Few Details Worth Getting Right During OS Installation
- Pick an image that includes a graphical desktop. When you are deploying for the first time, a GUI makes troubleshooting far more direct.
- Set the system language in the installer to whichever one you read most comfortably (the author uses Chinese). Later, when you are digging through documentation and error messages, this saves a lot of effort.
- Create a regular user and finish the installation with that account. The assistant itself needs no root, and a non-root account is the safer choice (see Section 6).
4. Setting Up a Remote Administration Channel (SSH)
Once the system is installed, get SSH working from the graphical desktop. After that you no longer need the desktop at all — everything happens in a terminal.
Step 1 — switch to root:
sudo -i
Step 2 — install the basic tooling (version management, download, editor, and the SSH server):
apt update && apt install -y git curl wget vim openssh-server
Step 3 — edit the SSH server configuration:
nano /etc/ssh/sshd_config
Make sure these three settings are present or added:
Port 22PermitRootLogin yesPasswordAuthentication yes
Step 4 — save, exit, and restart the service (Ctrl+O to save, Enter to confirm, Ctrl+X to leave the editor):
systemctl restart ssh
One warning deserves emphasis. PermitRootLogin yes combined with PasswordAuthentication yes is the “convenient but risky” pairing: direct root login with password authentication noticeably raises the risk of brute-force attacks. On a host that stays online permanently, the safer path is to switch to key-based login and disable password authentication, disable direct root login, move off the default port, and restrict source IPs with a firewall. Keep the permissive configuration above only in a controlled intranet, for temporary debugging.
5. Taking Over Administration with an SSH Client
Once the configuration is done, connect with any SSH client from your own machine. Every installation and administration task now happens in the terminal — no more switching back to the VM desktop, which makes day-to-day management noticeably more efficient.
6. Installing the AI Coding Assistant Without Root
Installing as root is not recommended, for three reasons:
- Least privilege: it reduces the blast radius of mistakes and of supply-chain issues.
- Dependency isolation: packages land in the current user’s home directory, which makes cleanup and uninstalling straightforward.
- Version control: you decide which runtime version is in use.
The recommended sequence:
- Use a runtime version manager to pin a stable runtime version. These CLI assistants are typically built on a Node.js runtime, so an LTS release is the sensible pick.
- Switch to that version and set it as the default.
- Install the assistant globally through the Node package manager:
npm install -g <assistant-name>@latest
After installation, invoke the assistant directly in the terminal using its command name. Some communities also publish localized (for example Chinese) builds; installation and invocation work the same way as upstream, with only a slight difference in the command prefix, so pick whichever you prefer.
7. Best Practices for Long-Term Operation
- Snapshots and backups: take an initial snapshot right after installation, and snapshot again before any significant change, so a bad change can be rolled back quickly.
- Autostart and supervision: configure the assistant to start at boot or run under a supervisor, so an abnormal exit gets picked up instead of silently staying down.
- Logs and monitoring: write runtime logs to disk and add basic monitoring and alerting, which makes invocation failures much easier to trace.
- Security hardening: key-based login, a non-default port, firewall restrictions on source addresses, and no unnecessary direct root login.
- Update policy: upgrade in small steps, and validate on a snapshot copy before putting a change into production use.
- Resource limits: cap the assistant process’s memory and CPU so it cannot crowd out the NAS’s primary workloads.
8. Common Problems and How to Diagnose Them
- SSH refuses to connect: check the SSH service status, whether the port is open, the firewall rules, and the VM’s network mode, in that order.
- Permission errors during installation (EACCES): confirm you are installing root-free as a regular user, and check ownership and permissions under the home directory.
- “Command not found”: confirm the runtime version manager’s environment has been loaded (source its configuration) and that PATH is in effect.
- Service dies for no visible reason: set up supervision or autostart, and check whether resource usage is hitting the ceiling.
9. Summary
Deploying an AI coding assistant on private hardware means picking the right form matters more than typing the right command. For workloads that stay online, a virtual machine beats a containerized desktop thanks to isolation and snapshot rollback; a 2 vCPU / 4 GB allocation is enough for everyday use; and getting SSH working first, then installing without root, balances efficiency against security. Add snapshots, autostart, monitoring, and hardening, and a NAS turns into a private AI coding workstation you can maintain for the long haul.
