Step-by-Step Guide to Installing Etherpad on Debian 12

Etherpad is a compelling free and open-source alternative to platforms like Google Docs and Zoho Writer. This web-based, collaborative, real-time text editor allows your team to edit documents from anywhere, facilitating seamless teamwork. Etherpad supports versioning, built-in formatting, and various plugins, and is compatible with modern document formats such as doc, pdf, odt, and markdown.

This guide will walk you through installing the Etherpad collaborative editor on a Debian 12 server. We will guide you through setting up Etherpad with a MariaDB database server and an Nginx web server, while also demonstrating how to secure Etherpad using UFW (Uncomplicated Firewall) and SSL via Certbot and Let’s Encrypt.

Prerequisites

To complete this guide, ensure you have the following:

  • A Debian 12 server.
  • A non-root user with administrator privileges.
  • A domain name pointed to your server’s IP address.

Installing Dependencies

Since Etherpad is an open-source software for collaborative editing written in JavaScript, you need to install the JavaScript runtime on your Debian server. Begin by updating and refreshing your Debian package index:

sudo apt update

update repo

Next, install the necessary package dependencies with the following command. Enter “y” to confirm and proceed with the installation.

sudo apt install mariadb-server nginx ufw nodejs npm gzip git curl python3 libssl-dev

install dependencies

Once the dependencies are installed, verify the Node.js version to ensure Node.js 18 is installed:

nodejs --version

check nodejs

Next, check the MariaDB service status using the following commands. You should find the MariaDB service is enabled to run automatically at system boot, and its status should be “running”.

sudo systemctl is-enabled mariadb
sudo systemctl status mariadb

check mariadb

Finally, ensure the Nginx service is running and enabled.

sudo systemctl is-enabled nginx
sudo systemctl status nginx

check nginx

Configuring UFW (Uncomplicated Firewall)

With dependencies installed, proceed to secure your Etherpad setup using UFW. Start by allowing the OpenSSH profile and enabling UFW:

sudo ufw allow OpenSSH
sudo ufw enable

Confirm with “y” to enable UFW.

enable ufw

Next, retrieve available firewall profiles and enable the “Nginx Full” profile to allow both HTTP and HTTPS traffic.

sudo ufw app list
sudo ufw allow "Nginx Full"

Reload UFW to apply changes and verify enabled rules and profiles.

sudo ufw reload
sudo ufw status

You should see UFW is active with “OpenSSH” and “Nginx Full” profiles enabled.

setup ufw

Configuring MariaDB Database Server

Next, secure your MariaDB installation and create a database for Etherpad.

Run the following command to secure the MariaDB server:

sudo mariadb-secure-installation
  • Press ENTER when prompted for the root password.
  • Answer “n” for the Unix socket authentication method.
  • Set a new password for the MariaDB root user when prompted.
  • Continue to answer “Y” to remove anonymous users, disable root login remotely, remove test databases, and reload privilege tables.

Create a database and user for Etherpad:

sudo mariadb -u root -p
CREATE DATABASE etherpad_lite_db;
CREATE USER etherpaduser@localhost IDENTIFIED BY 'StrongPasswordEtherpadDB';
GRANT CREATE,ALTER,SELECT,INSERT,UPDATE,DELETE on etherpad_lite_db.* to etherpaduser@localhost;
FLUSH PRIVILEGES;

create database

Verify the created user’s permissions:

SHOW GRANTS FOR etherpaduser@localhost;

Ensure the output confirms access for user “etherpaduser” to the “etherpad_lite_db” database.

check user

Exit the MariaDB prompt with `quit` when done.

Downloading and Configuring Etherpad

Now, proceed to download the Etherpad source code and configuration.

Create a new user and set up the Etherpad source code:

sudo adduser --system --no-create-home --home=/opt/etherpad-lite --group etherpad
cd /opt && git clone --branch master https://github.com/ether/etherpad-lite.git
sudo chown -R etherpad:etherpad /opt/etherpad-lite

create user download etherpad

Install Etherpad dependencies and run the setup:

cd /opt/etherpad-lite
sudo su -s /bin/bash -c "./bin/run.sh" etherpad

etherpad dependencies

Etherpad should be running with the default configuration:
etherpad is running

Press Ctrl+c to stop Etherpad and proceed with configuring the settings.json file:

nano settings.json

Set the Etherpad title and IP configuration to localhost:

"title": "Etherpad Debian 12",
"ip": "127.0.0.1",
"port": 9001,

Update the database settings to use MariaDB:

/*
 *"dbType": "dirty",
 *"dbSettings": {
 * "filename": "var/dirty.db"
 *},
 */
"dbType" : "mysql",
"dbSettings" : {
   "user": "etherpaduser",
   "host": "127.0.0.1",
   "port": 3306,
   "password": "StrongPasswordEtherpadDB",
   "database": "etherpad_lite_db",
   "charset": "utf8mb4"
 },

Running Etherpad as a Systemd Service

Create a systemd service file to run Etherpad in the background and manage it efficiently:

sudo nano /etc/systemd/system/etherpad.service
[Unit]
Description=Etherpad-lite, the collaborative editor.
After=syslog.target network.target mariadb.service
[Service]
Type=simple
User=etherpad
Group=etherpad
WorkingDirectory=/opt/etherpad-lite
Environment=NODE_ENV=production
ExecStart=/usr/bin/node --experimental-worker /opt/etherpad-lite/node_modules/ep_etherpad-lite/node/server.js
Restart=always

[Install]
WantedBy=multi-user.target

Save the file. Then reload the systemctl daemon and start the etherpad service:

sudo systemctl daemon-reload
sudo systemctl start etherpad
sudo systemctl enable etherpad

running etherpad as a service

Verify the service status:

sudo systemctl status etherpad

Check that the etherpad service is running on localhost with port 9001 and that the port is in use:

check etherpad

ss -tulpn | grep 9001

checking port

Configuring Nginx as a Reverse Proxy

Create an Nginx server block to act as a reverse proxy for Etherpad:

sudo nano /etc/nginx/sites-available/etherpad.conf
server {
   listen 80;
   server_name etherpad.howtoforge.local;
access_log /var/log/nginx/eplite.access.log;
error_log /var/log/nginx/eplite.error.log;

location / {
proxy_pass http://127.0.0.1:9001;
proxy_buffering off;
proxy_set_header Host $host;
proxy_pass_header Server;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}

Activate the configuration and verify:

sudo ln -s /etc/nginx/sites-available/etherpad.conf /etc/nginx/sites-enabled/
sudo nginx -t

Restart Nginx to apply the changes:

sudo systemctl restart nginx

Verify by visiting your Etherpad domain in your web browser.

Securing Etherpad with SSL/TLS Certificates

Use Certbot to secure Etherpad with SSL/TLS certificates:

sudo apt install certbot python3-certbot-nginx

install certbot

Generate SSL/TLS certificates for your domain using Certbot:

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email user@howtoforge.local -d etherpad.howtoforge.local

Visit your Etherpad domain via HTTPS to confirm it’s working correctly. You can create and manage documents on your secure, self-hosted Etherpad instance.

etherpad as collaborative editor

Conclusion

Congratulations! You’ve installed Etherpad on your Debian 12 machine, configured it with MariaDB and Nginx, and secured it using Let’s Encrypt SSL certificates and UFW. Now you can use Etherpad as a collaborative editor with your team. Consider installing additional plugins to enhance functionality as per your needs.

FAQ

  • What is Etherpad?
    Etherpad is a real-time, web-based collaborative text editor allowing multiple users to simultaneously edit a document.
  • Why use Etherpad over other editors?
    Etherpad offers real-time collaborative editing, versioning, and is highly customizable with plugins.
  • Is it secure to use Etherpad?
    Yes, with SSL/TLS via Let’s Encrypt and a properly configured firewall, Etherpad can be quite secure.
  • Can Etherpad handle many users at once?
    Yes, Etherpad is designed for high collaboration, but performance may depend on server resources and network conditions.
  • What are the benefits of using Nginx as a reverse proxy with Etherpad?
    Nginx can handle load balancing, buffering, SSL termination, and provide security and performance features to Etherpad instance.