Skip to content

Latest commit

 

History

History
143 lines (97 loc) · 2.68 KB

File metadata and controls

143 lines (97 loc) · 2.68 KB

Systemd Installation Guide

This guide shows you how to run the WhatsApp-Nextcloud Bridge as a systemd service on Linux.

Prerequisites

  • Linux system with systemd
  • Node.js 18 or higher installed
  • Root or sudo access

Installation Steps

1. Create a System User

Create a dedicated user for the bridge:

sudo useradd -r -s /bin/false whatsapp-bridge

2. Install the Bridge

Clone and install the bridge:

sudo mkdir -p /opt/whatsapp-nextcloud-bridge
sudo git clone https://github.com/QuizzityMC/Whatsapp-Nextcloud-Bridge.git /opt/whatsapp-nextcloud-bridge
cd /opt/whatsapp-nextcloud-bridge
sudo npm install --production

3. Configure the Bridge

Create the configuration file:

sudo cp .env.example .env
sudo nano /opt/whatsapp-nextcloud-bridge/.env

Fill in your configuration values.

4. Set Permissions

sudo chown -R whatsapp-bridge:whatsapp-bridge /opt/whatsapp-nextcloud-bridge
sudo chmod 600 /opt/whatsapp-nextcloud-bridge/.env

5. Install Systemd Service

sudo cp systemd/whatsapp-nextcloud-bridge.service /etc/systemd/system/
sudo systemctl daemon-reload

6. Start the Service

sudo systemctl start whatsapp-nextcloud-bridge

7. Authenticate WhatsApp

On first run, you need to scan the QR code:

sudo journalctl -u whatsapp-nextcloud-bridge -f

Wait for the QR code to appear in the logs, then scan it with WhatsApp.

8. Enable Auto-Start

Once authenticated and working, enable the service to start on boot:

sudo systemctl enable whatsapp-nextcloud-bridge

Managing the Service

Check Status

sudo systemctl status whatsapp-nextcloud-bridge

View Logs

sudo journalctl -u whatsapp-nextcloud-bridge -f

Restart Service

sudo systemctl restart whatsapp-nextcloud-bridge

Stop Service

sudo systemctl stop whatsapp-nextcloud-bridge

Update the Bridge

sudo systemctl stop whatsapp-nextcloud-bridge
cd /opt/whatsapp-nextcloud-bridge
sudo git pull
sudo npm install --production
sudo systemctl start whatsapp-nextcloud-bridge

Troubleshooting

Service Won't Start

Check the logs:

sudo journalctl -u whatsapp-nextcloud-bridge -n 50

Permission Issues

Ensure the service user owns the files:

sudo chown -R whatsapp-bridge:whatsapp-bridge /opt/whatsapp-nextcloud-bridge

WhatsApp Authentication Issues

Remove the session and re-authenticate:

sudo systemctl stop whatsapp-nextcloud-bridge
sudo rm -rf /opt/whatsapp-nextcloud-bridge/session
sudo systemctl start whatsapp-nextcloud-bridge
sudo journalctl -u whatsapp-nextcloud-bridge -f

Then scan the QR code again.