Installation
Install PasarGuard Node using various methods
System Requirements
Minimum Requirements
- RAM: 1 GB
- CPU: 1 core
- Storage: 10 GB
Recommended Requirements
- RAM: 2 GB
- CPU: 2 cores
- Storage: 20 GB
Installation Methods
PasarGuard Node can be installed using multiple methods. Choose the one that best fits your needs.
One-Click Installation (Recommended)
The easiest way to install PasarGuard Node is using our automated installation script:
sudo bash -c "$(curl -sL https://github.com/PasarGuard/scripts/raw/main/pg-node.sh)" @ installThis script will:
- Install all required dependencies
- Set up the PasarGuard Node
- Configure basic settings
- Start the service automatically
Multiple Nodes on the Same Server
If you want to run more than one node on the same server, install each node with a unique name:
sudo bash -c "$(curl -sL https://github.com/PasarGuard/scripts/raw/main/pg-node.sh)" @ install --name node-eu-1After installation, use the selected name as the management command prefix:
node-eu-1 update
node-eu-1 edit
node-eu-1 edit-envYou can also use other available subcommands with the same prefix (node-eu-1 ...) to manage that specific node instance.
Important: Do not reuse ports between nodes. Connection ports and the Xray core configuration linked to each node must be unique for every node instance.
Docker Installation
Prerequisites
Install Docker on your machine:
curl -fsSL https://get.docker.com | shUsing Docker Compose
- Download the docker-compose file:
wget https://raw.githubusercontent.com/PasarGuard/node/refs/heads/main/docker-compose.yml-
Create and configure your
.envfile (see Configuration) -
Start the node:
docker compose up -dDocker Commands
View logs:
docker compose logs -fStop the node:
docker compose downRestart the node:
docker compose restartUpdate to latest version:
docker compose pull
docker compose up -dManual Installation
Manual installation is not recommended for beginners. Use the one-click installation or Docker method instead.
Prerequisites
-
Install Go (version 1.25 or higher)
Download from go.dev
-
Clone the repository:
git clone https://github.com/PasarGuard/node.git
cd nodeBuild the Binary
- Install dependencies:
make deps- Build the binary:
makeThis will generate a binary file for your system architecture.
Install Xray Core
Install the Xray core:
make install_xrayGenerate SSL Certificate
Generate a certificate based on your server's IP or domain:
# For domain-based certificate
make generate_server_cert CN=example.com SAN="DNS:example.com"
# For IP-based certificate
make generate_server_cert CN=example.com SAN="IP:YOUR_SERVER_IP"
# For both domain and IP
make generate_server_cert CN=example.com SAN="DNS:example.com,IP:YOUR_SERVER_IP"Configure and Run
-
Create and configure your
.envfile (see Configuration) -
Run the binary:
./pasarguard-nodePost-Installation
Configure Firewall
Make sure to open the required ports in your firewall:
# For Ubuntu/Debian
sudo ufw allow YOUR_PORT/tcp
# For CentOS/RHEL
sudo firewall-cmd --permanent --add-port=YOUR_PORT/tcp
sudo firewall-cmd --reloadSet Up as System Service (Manual Installation)
Create a systemd service file:
sudo nano /etc/systemd/system/pg-node.serviceAdd the following content:
[Unit]
Description=PasarGuard Node
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/path/to/node
ExecStart=/path/to/node/pasarguard-node
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.targetEnable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable pg-node
sudo systemctl start pg-nodeCheck service status:
sudo systemctl status pg-node