How to Install Etherpad on Ubuntu 18.04

In this tutorial, we will show you how to install Etherpad on an Ubuntu 18.04 VPS.

Etherpad is an open-source web based application that allows real-time collaborative editing of a document through a web browser. This allows users to simultaneously type out, edit, and review documents – even chat functionality is available, which further helps users collaborate on documents. Let’s begin with the installation.

Prerequisites

  • An Ubuntu 18.04 VPS (we’ll be using our SSD 2 VPS plan)
  • Node.js version 6.9.0 or higher (preferred version: Node.js 8.9 or higher)
  • Access to the root user account (or access to an admin account with root privileges)

Step 1: Log in to the Server & Update the Server OS Packages

Log in to your Ubuntu 18.04 server via SSH as the root user:

ssh root@IP_Address -p Port_number

You will need to replace ‘IP_Address‘ and ‘Port_number‘ with your server’s respective IP address and SSH port number. Additionally, replace ‘root’ with the username of the admin account if necessary.

Before we can start with the Etherpad installation, we have to make sure that all Ubuntu OS packages installed on the server are up to date. We can do this by running the following commands:

sudo apt-get update
sudo apt-get upgrade

Step 2: Install the Required Packages

Install the required packages that will help Etherpad run on our server:

sudo apt install libssl-dev pkg-config gcc g++ make build-essential

Etherpad also requires Node.js, so we will install the latest version (at the time of writing this tutorial), Node.js 10.15.3. The latest version of Node.js can be installed from the ‘nodesource’ repository. Once you have downloaded the tarball, extract it in a new directory at /opt/nodejs/.

cd /opt
wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xz
tar xJf node-v*-linux-x64.tar.xz
sudo mkdir /opt/nodejs/ && mv node-*-linux-x64/* /opt/nodejs

Step 3: Install MySQL and Create a MySQL Database

We’ll need MySQL in order to store the data that Etherpad creates and manipulates. Install MySQL using the following command:

apt-get install mysql-server mysql-client

Create a new MySQL user and database:

mysql> create database etherpad_db;
mysql> grant all privileges on etherpad_db.* to etherpad@localhost identified by 'Str0ngPa55w0rd';
mysql> flush privileges;
mysql> quit

Don’t forget to change Str0ngPa55w0rd with a real, strong password.

Step 4: Create Etherpad user

In order to create a new system user for the Etherpad instance, run the following commands:

sudo adduser --home /opt/etherpad --shell /bin/bash etherpad
sudo install -d -m 755 -o etherpad -g etherpad /opt/etherpad
sudo su - etherpad
PATH=$PATH:/opt/nodejs/bin
echo "PATH=$PATH:/opt/nodejs/bin" >> ~/.profile

Check the Node.js version:

etherpad@localhost:~$ node --version
v10.15.3

Now we can begin installing Etherpad.

Step 5: Install and Configure Etherpad

Clone the Etherpad repository from the GitHub page using the following command:

git clone git://github.com/ether/etherpad-lite.git ~/etherpad-lite

Go to the ‘etherpad-lite’ directory and run the ‘run.sh’ bash script to start Etherpad.

cd /opt/etherpad/etherpad-lite/
bin/run.sh

Copy the ‘settings.json.template’ file to a new file named ‘settings.json’:

cp settings.json.template settings.json

Then edit the settings.json file using your preferred text editor (we’ll be using ‘nano’):

nano settings.json

Add/modify the following:

    • Replace “ip”: “0.0.0.0” with “ip”: “127.0.0.1”
    • Remove the following lines:
"dbType" : "dirty",
  "dbSettings" : {
                   "filename" : "var/dirty.db"
                 },
    • Modify the lines about MySQL settings so they look like:
    "dbType" : "mysql",
    "dbSettings" : {
                    "user"    : "etherpad",
                    "host"    : "localhost",
                    "port"    : 3306,
                    "password": "Str0ngPa55w0rd",
                    "database": "etherpad_db"
                  },
    • Replace “trustProxy” : false with “trustProxy” : true
    • Set a password for the ‘admin’ user:
  "users": {
    "admin": {
      // "password" can be replaced with "hash" if you install ep_hash_auth
      "password": "Str0ngPa55w0rd",
      "is_admin": true
    },

Then save and exit the file once all changes have been made.

Run the following command to install all other dependencies and start the Etherpad service:

~/etherpad-lite/bin/installDeps.sh
~/etherpad-lite/bin/run.sh

To access Etherpad, open your web browser and type the server IP address with port ‘9001’: http://server_IP_address:9001/
You can stop the Etherpad process using CTRL + C.

Step 6: Set a Reverse Proxy in Apache

In order to access your Etherpad editor only by using your domain name, without the port number 9001 in the URL, we need to set it up behind a reverse proxy.
To do so, we need to enable some additional proxy modules in Apache. We can do this with the following commands:

a2enmod proxy
a2enmod proxy_http

Restart Apache for the changes to take effect:

systemctl restart apache2

Once ‘mod_proxy’ and ‘mod_proxy_http’ are enabled in Apache, create a new configuration file for your domain with the following command:

nano /etc/apache2/sites-available/your-domain.com.conf

And enter the following lines:

<VirtualHost *:80>
ServerName your-domain.com ServerAlias www.your-domain.com ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://127.0.0.1:9001/ ProxyPassReverse / http://127.0.0.1:9001/ <Location /> Order allow,deny Allow from all </Location> </VirtualHost>

Remember to replace your ‘your-domain.com‘ with your actual domain name. Save the file, close it and disable the default Apache configuration:

a2dissite 000-default

Enable the “your-domain.com.conf” configuration in Apache using:

a2ensite your-domain.com

Optionally, we can use this command to enable it:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
ln -s /etc/apache2/sites-available/your-domain.com.conf /etc/apache2/sites-enabled/your-domain.com.conf

Then restart Apache for the changes to take effect:

systemctl restart apache2

Step 7: Create a systemd service for Etherpad

We can also create a systemd service so we can start Etherpad like any other Ubuntu service. Create this file at the path /etc/systemd/system/etherpad.service:

nano /etc/systemd/system/etherpad.service

And add the following lines:

[Unit]
Description=Etherpad-lite, the collaborative editor.
After=syslog.target network.target

[Service]
Type=simple
User=etherpad
Group=etherpad
WorkingDirectory=/opt/etherpad/etherpad-lite
Environment=NODE_ENV=production

ExecStart=/opt/nodejs/bin/node /opt/etherpad/etherpad-lite/src/node/server.js

Restart=always 

[Install]
WantedBy=multi-user.target

Save the exit the file. After that, reload the files using this command:

sudo systemctl daemon-reload

You can now start the Etherpad service and enable Etherpad to automatically start on server boot:

sudo systemctl start etherpad.service
sudo systemctl enable etherpad.service

That’s it. If you followed all of the instructions properly you can now access your Etherpad editor using your domain name.


Of course, you don’t have to install and configure Etherpad on Ubuntu 18.04, if you use one of our Managed Ubuntu Hosting solutions, in which case you can simply ask our expert Linux admins to setup and configure Etherpad on Ubuntu 18.04 for you. They are available 24×7 and will take care of your request immediately. We also published a post on How to install Etherpad on Ubuntu 20.04.
PS. If you liked this post on how to install Etherpad on an Ubuntu 18.04 VPS, please share it with your friends on the social networks using the share buttons below, or simply leave a comment down in the comments section. Thanks.

2 thoughts on “How to Install Etherpad on Ubuntu 18.04”

  1. Hi,
    thanks for the manual. It worked so far but when I try to change the database from drity to mysql I keep on getting the following error:
    ERROR: Problem while initalizing the database
    Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
    Am I missing something?
    Regard
    Til

    Reply
    • this tutorial guides you for a new installation, if you are migrating you should check if the MySQL source is the same or older version than the destination

      Reply

Leave a Comment