Environment Setup
This guide walks you through setting up a local development environment for NexPanel.
Requirements
- A Linux machine or VM (Ubuntu or Debian recommended, since NexPanel targets those)
- Root or
sudoaccess - Internet access to download Go and dependencies
Windows and macOS are not supported as development hosts. If you are on Windows, use WSL2 with Ubuntu.
Install Go and Build Tools
Install the essential build packages:
sudo apt update
sudo apt install build-essential git make curl
Download and install Go:
cd /tmp
curl -OL https://go.dev/dl/go1.26.4.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.26.4.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
echo 'export PATH=$PATH:$HOME/go/bin' >> ~/.bashrc
source ~/.bashrc
go version
You should see go version go1.26.4 linux/amd64 (or similar) printed.
Clone the Repository
cd /path/of/your/choice
git clone https://github.com/nexpanel/NexPanel.git
cd NexPanel
Configure Local Overrides
NexPanel reads some configuration from environment variables. This lets you point the panel at local services or test URLs without modifying config.go.
Create a .env file in the project root:
touch .env
Add any overrides you need. All variables are optional - the panel falls back to sensible defaults defined in internal/system/config.go when they are not set.
# Point the panel at a local version file instead of the public one
NEXPANEL_VERSION_URL=http://192.168.10.150:8080/VERSION
# Point at a local upgrade script
NEXPANEL_UPGRADE_URL=http://192.168.10.150:8080/upgrade.sh
# Point at a local download mirror
NEXPANEL_DOWNLOAD_URL=http://192.168.10.150:8080/nexpanel-%s-linux-%s
The .env file is gitignored. Every developer maintains their own, and nothing you put there ends up in the repository.
Note
The panel uses sensible defaults for all of these when the environment variable is not set. Only override the ones you need to point at your local test environment.
Start the Dev Server
From the project directory, run:
sudo make dev
The dev target:
- Downloads Go dependencies
- Downloads the Tailwind CSS binary if not present
- Installs Air (the live-reloader) if not present
- Starts the panel on
http://localhost:2020
Open http://localhost:2020 in your browser. The server reloads automatically when you change Go, HTML, CSS, or JS files.
First Run
On the first run, the dev server creates a local SQLite database and seeds a default admin user. The credentials are printed to the terminal once, right after setup:
────────────────────────────────────────
Username: admin
Password: 8f3a7c2b91d4e6f0
────────────────────────────────────────
Copy these and log in at http://localhost:2020. The password is generated randomly on first run and is only shown once.
Note
This only happens in development mode. Production installations use the setup wizard in the browser instead, where you pick your own admin credentials.
Warning
The dev server is meant to run as root because NexPanel manages system services, users, and configuration files. Do not run it on a machine you do not want to modify.
Stopping the Dev Server
Press Ctrl+C in the terminal running make dev. Air shuts down the server cleanly.
Next Steps
- Makefile Commands - full reference of build and dev commands