Pairdrop Print

  • 0

How to Install PairDrop on Ubuntu 24.04

PairDrop is a self-hosted, collaborative file sharing and communication tool. This guide walks you through a full installation on Ubuntu 24.04, including Node.js setup, service management, Nginx reverse proxy, and firewall configuration.

 

Step 1: Install System Dependencies

PairDrop requires Node.js, git, Nginx, and several build tools.

 
 
sudo apt update
sudo apt install -y curl git nginx ufw build-essential python3-pip

This ensures the server is ready to download binaries, compile Node modules, and serve content via Nginx.

 

Step 2: Install Node.js

 

Download and extract Node.js manually to avoid package conflicts:

wget https://nodejs.org/dist/v18.19.1/node-v18.19.1-linux-x64.tar.xz -O /tmp/node-v18.19.1-linux-x64.tar.xz
sudo tar -xJf /tmp/node-v18.19.1-linux-x64.tar.xz -C /usr/local --strip-components=1

Create symlinks for easier access:

sudo ln -sf /usr/local/bin/node /usr/bin/node
sudo ln -sf /usr/local/bin/npm /usr/bin/npm
sudo ln -sf /usr/local/bin/npx /usr/bin/npx

Verify versions:

node -v
npm -v

 

Step 3: Create PairDrop User and Directories

 

Create a dedicated system user and clean up any previous installations:

sudo useradd -r -m -d /var/www/pairdrop -s /bin/bash pairdrop
sudo rm -rf /var/www/pairdrop
sudo mkdir -p /var/www/pairdrop
sudo chown -R pairdrop:pairdrop /var/www/pairdrop

 

Step 4: Clone PairDrop Repository

 

Clone the latest code into a temporary directory, then move it to the final location:

sudo -u pairdrop mkdir -p /tmp/pairdrop-temp
cd /tmp/pairdrop-temp
sudo -u pairdrop git clone --depth 1 https://github.com/schlagmichdoch/PairDrop.git .
sudo -u pairdrop cp -r /tmp/pairdrop-temp/* /var/www/pairdrop/
sudo -u pairdrop cp -r /tmp/pairdrop-temp/.* /var/www/pairdrop/ 2>/dev/null || true
sudo rm -rf /tmp/pairdrop-temp
sudo chown -R pairdrop:pairdrop /var/www/pairdrop

 

Step 5: Install Node Modules

 

Navigate to the PairDrop directory and install dependencies:

cd /var/www/pairdrop
sudo -u pairdrop npm install

Optional: check available npm scripts:

sudo -u pairdrop npm run

Test startup (for 15 seconds):

sudo -u pairdrop timeout 15s npm start

 

Step 6: Configure PairDrop as a Systemd Service

 

Create a service file for automatic startup:

sudo nano /etc/systemd/system/pairdrop.service
[Unit]
Description=PairDrop Service
After=network.target

[Service]
Type=simple
User=pairdrop
Group=pairdrop
WorkingDirectory=/var/www/pairdrop
ExecStart=/usr/bin/npm start
Restart=on-failure
RestartSec=5
Environment=PORT=3000
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target

Reload systemd and start the service:

sudo systemctl daemon-reload
sudo systemctl enable --now pairdrop

 

Step 7: Configure Nginx Reverse Proxy

 

Create an Nginx site for PairDrop:

sudo nano /etc/nginx/sites-available/pairdrop
server {
    listen 80;
    server_name <server-ip>;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_cache_bypass $http_upgrade;
    }
}

Enable the site and restart Nginx:

sudo ln -sf /etc/nginx/sites-available/pairdrop /etc/nginx/sites-enabled/pairdrop
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl restart nginx

 

Step 8: Configure Firewall

 

Allow HTTP traffic:

sudo ufw allow 80/tcp

 

Step 9: Verify Installation

 

Check PairDrop and Nginx status:

sudo systemctl status pairdrop
sudo systemctl status nginx
curl http://<server-ip>

 

Highlights of this Installation

  • Manual Node.js binary installation (avoids package conflicts)

  • Bulletproof Git clone and move method

  • Proper user permissions with system user pairdrop

  • Managed via systemd for automatic restart

  • Nginx reverse proxy and firewall configuration included

 

Your PairDrop instance is now fully operational and accessible via your server IP.


آیا این پاسخ به شما کمک کرد؟
Back
nono Hello World