Install Etherpad on a CentOS 7 VPS

install-etherpad-on-a-centos-7-vps In this tutorial, we will explain how to install Etherpad on a CentOS 7 VPS. Etherpad is an Open Source online editor providing collaborative real-time editing. This guide should work on other Linux VPS systems as well but was tested and written for CentOS 7 VPS.

Login to your VPS via SSH

ssh user@vps

Update the system and install necessary packages

[user]$ sudo yum -y upgrade
[user]$ sudo yum install curl vim gcc-c++ make

Install MariaDB

MariaDB 5.5 is shipped in the default CentOS 7 repository, to install it just run:

[user]$ sudo yum install mariadb-server

To start the MariaDB service and enable it to start on boot, execute the following commands:

[user]$ sudo systemctl start mariadb.service
[user]$ sudo systemctl enable mariadb.service

Run the following command to secure your installation:

[user]$ sudo mysql_secure_installation

Next, we need to create a database for our Etherpad instance.

[user]$ mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE etherpad;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON etherpad.* TO 'etherpaduser'@'localhost' IDENTIFIED BY 'etherpaduser_passwd';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

Install the latest Node.js

[user]$ curl -sL https://rpm.nodesource.com/setup | sudo bash -
[user]$ sudo yum install -y nodejs

To verify everything is done correctly, use the command node --version.
The output should be similar to the following:

[user]$ node --version
v0.10.38

Create Etherpad user

To create a new system user for our Etherpad instance run the following commands:

[user]$ sudo adduser --home /opt/etherpad --shell /bin/bash etherpad
[user]$ sudo install -d -m 755 -o etherpad -g etherpad /opt/etherpad

Install Etherpad

The following commands are run as etherpad user. To switch to etherpad user run:

[user]$ sudo su - etherpad

Clone the Etherpad source code to the /opt/etherpad/etherpad-lite directory.

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

Copy the default settings configuration file:

[user]$ cp ~/etherpad-lite/settings.json.template ~/etherpad-lite/settings.json

and change/add:

  • "ip": "0.0.0.0" to "ip": "127.0.0.1"
  • Comment the “dirty” section
  • Add the MySQL Configuration
        "dbType" : "mysql",
        "dbSettings" : {
                        "user"    : "etherpaduser",
                        "host"    : "localhost",
                        "password": "etherpaduser_passwd",
                        "database": "etherpad"
                      },
    
    
  • "trustProxy" : false to "trustProxy" : true
  • Add admin user
          "users": {
             "admin": {
             "password": "__yourAdminPassword__",
             "is_admin": true
             }
            },
    

Run the following command to install dependencies:

~/etherpad-lite/bin/installDeps.sh

Start Etherpad for the first time:

~/etherpad-lite/bin/run.sh

If there are no errors, you may continue with the next step.

Create a systemd service

To create a new systemd service for Etherpad, open your editor of choice as a root or sudo user and create a new file:

[user]$ sudo vim /etc/systemd/system/etherpad.service

and add the following code lines:

[Unit]
Description=Etherpad
After=syslog.target network.target

[Service]
Type=simple
User=etherpad
Group=etherpad
ExecStart=/opt/etherpad/etherpad-lite/bin/run.sh
Restart=always

[Install]
WantedBy=multi-user.target

Start the Etherpad service and set it to start automatically on boot:

[user]$ sudo systemctl enable etherpad.service
[user]$ sudo systemctl start etherpad.service

To verify the unit started, run journalctl -f -u etherpad.service and you should see something like below:

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
[user]$ journalctl -f -u etherpad.service
May 09 11:02:08 vps systemd[1]: Starting etherpad.service...
May 09 11:02:08 vps systemd[1]: Started etherpad.service.
May 09 11:02:08 vps run.sh[23118]: Ensure that all dependencies are up to date...  If this is the first time you have run Etherpad please be patient.

Install and configure Nginx

Installing Nginx is pretty easy, just run the following command:

[user]$ sudo apt-get install nginx

Next, create a new Nginx server block:

[user]$ sudo vim /etc/nginx/sites-available/myPad.com.conf
map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

server {
  server_name myPad.com;

  location / {
    proxy_set_header  X-Real-IP  $remote_addr;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header  Host $host;
    proxy_redirect off;
    proxy_read_timeout 300;
    proxy_pass http://localhost:9001/;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
  }
}

Activate the server block by restarting Nginx:

[user]$ sudo systemctl restart nginx

In the future, whenever you want to update the Etherpad to the latest version, just run /opt/etherpad/etherpad-lite && git pull origin and restart the Etherpad service with systemctl restart etherpad.

That’s it. You have successfully installed Etherpad on your Centos VPS. For more information about Etherpad, please refer to the Etherpad website.


Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

3 thoughts on “Install Etherpad on a CentOS 7 VPS”

  1. Thanks for the guide, just wanted to let you know the NGINX portion at the end seems to be focused on ubuntu rather than centos.

    Reply

Leave a Comment