Installation
Install PasarGuard Node using various methods
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)" @ install
This script will:
- Install all required dependencies
- Set up the PasarGuard Node
- Configure basic settings
- Start the service automatically
Docker Installation
Prerequisites
Install Docker on your machine:
curl -fsSL https://get.docker.com | sh
Using Docker Compose
- Download the docker-compose file:
wget https://raw.githubusercontent.com/PasarGuard/node/refs/heads/main/docker-compose.yml
-
Create and configure your
.env
file (see Configuration) -
Start the node:
docker compose up -d
Docker Commands
View logs:
docker compose logs -f
Stop the node:
docker compose down
Restart the node:
docker compose restart
Update to latest version:
docker compose pull
docker compose up -d
Manual 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 node
Build the Binary
- Install dependencies:
make deps
- Build the binary:
make
This will generate a binary file for your system architecture.
Install Xray Core
Install the Xray core:
make install_xray
Generate 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
.env
file (see Configuration) -
Run the binary:
./pasarguard-node
Post-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 --reload
Set Up as System Service (Manual Installation)
Create a systemd service file:
sudo nano /etc/systemd/system/pg-node.service
Add 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.target
Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable pg-node
sudo systemctl start pg-node
Check service status:
sudo systemctl status pg-node