Comprehensive Guide to Installing Etherpad on Ubuntu

Etherpad is a highly customizable, open-source online editor providing collaborative editing in real-time. This guide will walk you through the process of installing Etherpad on Ubuntu 20.04, allowing you to host your own collaborative writing platform.

Prerequisites

Before we begin, ensure you have:

  1. An Ubuntu 20.04 server
  2. A non-root user with sudo privileges
  3. A domain name pointed to your server’s IP address (optional, but recommended)

Need a reliable server to host your Etherpad instance? Check out Servers Guru for high-performance servers optimized for web applications.

Step 1: Update Your System

First, let’s ensure your system is up-to-date:

sudo apt update
sudo apt upgrade -y

Step 2: Install Node.js

Etherpad requires Node.js to run. We’ll install it using the NodeSource repository:

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt install -y nodejs

Verify the installation:

node --version
npm --version

Step 3: Install Additional Dependencies

Etherpad requires some additional packages:

sudo apt install -y gzip git curl python3 libssl-dev pkg-config build-essential

Step 4: Create a Dedicated User

It’s a good practice to run Etherpad under a dedicated user:

sudo useradd --create-home --shell /bin/bash --user-group etherpad

Step 5: Install Etherpad

Switch to the etherpad user and clone the Etherpad repository:

sudo su - etherpad
git clone --branch master https://github.com/ether/etherpad-lite.git

Step 6: Configure Etherpad

Create a settings file:

cd ~/etherpad-lite
cp settings.json.template settings.json

Edit the settings file:

nano settings.json

Modify the following settings:

{
  "title": "Your Etherpad Instance",
  "ip": "0.0.0.0",
  "port": 9001,
  "showSettingsInAdminPage": true,
  "dbType": "dirty",
  "dbSettings": {
    "filename": "var/dirty.db"
  },
  "defaultPadText": "Welcome to Your Etherpad Instance!",
  "padOptions": {
    "noColors": false,
    "showControls": true,
    "showChat": true,
    "showLineNumbers": true,
    "useMonospaceFont": false,
    "userName": false,
    "userColor": false,
    "rtl": false,
    "alwaysShowChat": false,
    "chatAndUsers": false,
    "lang": "en-gb"
  },
  "passwordHash": "REPLACE_THIS_WITH_A_HASH",
  "password": "REPLACE_THIS_WITH_A_PASSWORD"
}

Generate a password hash:

~/etherpad-lite/bin/etherpad-lite --hash-password YOUR_CHOSEN_PASSWORD

Replace REPLACE_THIS_WITH_A_HASH with the generated hash, and REPLACE_THIS_WITH_A_PASSWORD with your chosen password.

Step 7: Create a Systemd Service

Exit the etherpad user session:

exit

Create a systemd service file:

sudo nano /etc/systemd/system/etherpad.service

Add the following content:

[Unit]
Description=Etherpad collaborative text editor
After=network.target

[Service]
Type=simple
User=etherpad
WorkingDirectory=/home/etherpad/etherpad-lite
ExecStart=/usr/bin/node /home/etherpad/etherpad-lite/node_modules/ep_etherpad-lite/node/server.js
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Step 8: Start and Enable Etherpad

Start the Etherpad service:

sudo systemctl start etherpad

Enable it to start on boot:

sudo systemctl enable etherpad

Step 9: Set Up Nginx as a Reverse Proxy (Optional)

If you want to use a domain name and HTTPS, you can set up Nginx as a reverse proxy:

Install Nginx:

sudo apt install nginx

Create a new Nginx configuration file:

sudo nano /etc/nginx/sites-available/etherpad

Add the following content (replace your_domain.com with your actual domain):

server {
    listen 80;
    server_name your_domain.com;

    location / {
        proxy_pass http://localhost:9001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Enable the configuration:

sudo ln -s /etc/nginx/sites-available/etherpad /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

Step 10: Secure with Let’s Encrypt (Optional)

If you’ve set up Nginx, you can secure your Etherpad instance with a free SSL certificate from Let’s Encrypt:

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d your_domain.com

Follow the prompts to complete the certificate installation.

Optimizing Your Etherpad Instance

For the best performance:

  1. Allocate Sufficient Resources: Ensure your server has enough CPU and RAM. Servers Guru offers a range of high-performance options suitable for hosting collaborative applications like Etherpad.

  2. Use a Production-ready Database: For larger installations, consider using MySQL or PostgreSQL instead of the default “dirty” database.

  3. Implement Caching: Use Redis for session storage and caching to improve performance.

  4. Regular Backups: Implement a robust backup strategy for your Etherpad data and database.

  5. Keep Updated: Regularly update Etherpad and all its dependencies to ensure security and performance.

By following this guide, you now have your own Etherpad instance running on Ubuntu. This setup allows for real-time collaborative editing, perfect for team projects, brainstorming sessions, and more. Remember to keep your instance updated and secure.

Enjoy your new collaborative editing platform!