How to Install PairDrop on Ubuntu 24.04
PairDrop is a self-hosted, lightweight web application for real-time file sharing between devices. It requires Node.js and can run without additional build steps,
making it quick to deploy. This guide demonstrates installing PairDrop on Ubuntu 24.04 using systemd and Nginx.
Step 1: Install System Dependencies
Install essential tools for Node.js, Git, Nginx, and firewall management:
sudo apt update
sudo apt install -y curl git nginx ufw build-essential python3-pip
Step 2: Install Node.js
Download and install Node.js manually to ensure a specific version:
curl -O https://nodejs.org/dist/v18.19.1/node-v18.19.1-linux-x64.tar.xz
sudo tar -xf node-v18.19.1-linux-x64.tar.xz -C /usr/local --strip-components=1
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 the installation:
node --version
npm --version
Step 3: Create PairDrop User and Directory
Create a system user and prepare the application directory:
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 PairDrop code into a temporary directory and move files to the final location:
mkdir -p /tmp/pairdrop-temp
cd /tmp/pairdrop-temp
git clone --depth 1 https://github.com/schlagmichdoch/PairDrop.git .
cp -r /tmp/pairdrop-temp/* /var/www/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.js Dependencies
Install all required dependencies for production:
cd /var/www/pairdrop
sudo -u pairdrop npm install --production
Step 6: Test PairDrop
Run a temporary test to ensure the application starts:
sudo -u pairdrop timeout 15s npm start
Step 7: Configure systemd Service
Create a service to manage PairDrop automatically:
sudo tee /etc/systemd/system/pairdrop.service > /dev/null <<EOF
[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
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now pairdrop
Step 8: Configure Nginx Reverse Proxy
Create an Nginx site configuration for PairDrop:
sudo tee /etc/nginx/sites-available/pairdrop > /dev/null <<EOF
server {
listen 80;
server_name <your.server.address>;
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;
}
}
EOF
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 9: Configure Firewall
Allow HTTP traffic through UFW:
sudo ufw allow 80/tcp
sudo ufw enable
Step 10: Verify Installation
Test PairDrop availability in a browser:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/docker.gpg
The web interface should load, confirming the service is running.
Conclusion
PairDrop can be deployed quickly on Ubuntu 24.04 without a build step. By using systemd and Nginx, it runs as a reliable background service with
secure HTTP access. This setup ensures real-time file sharing is available immediately after installation.