Installing EtherPad on CentOS 7 VPS

In this tutorial, we will show you how to install EtherPad on a CentOS 7 VPS. EtherPad is an open source online editor with real-time collaborative mode. This tutorial should work on other Linux VPS systems, but was tested and written for CentOS 7 VPS. Login to your VPS via SSH

ssh [email protected]

Update the system and install the required packages

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

Install MariaDB

MariaDB 5.5 ships by default with repository on CentOS 7, to install it, just run:

[furious]$ sudo yum install mariadb-server

To start the MariaDB service and enable it to autostart, run the following commands:

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

Run the following command to secure your database:

[furious]$ sudo mysql_secure_installation

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

[furious]$ 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 version of Node.js

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

In order to check that everything is done correctly, use the command node --version… The output should be similar to the following:

[furious]$ node --version
v0.10.38

Create EtherPad User

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

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

Install EtherPad

The following commands are executed by the EtherPad user. To switch to EtherPad user:

[furious]$ sudo su - etherpad

Cloning EtherPad Source Code into Directory /opt/etherpad/etherpad-lite

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

Copy the default configuration configuration file:

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

and change / add:

  • "ip": "0.0.0.0" on "ip": "127.0.0.1"
  • Comment out the “dirty” section
  • Add to MySQL config
 "dbType" : "mysql",
    "dbSettings" : {
                    "user"    : "etherpaduser",
                    "host"    : "localhost",
                    "password": "etherpaduser_passwd",
                    "database": "etherpad"
                  },

  • "trustProxy" : false change to true
  • Add admin user
   "users": {
         "admin": {
         "password": "__yourAdminPassword__",
         "is_admin": true
         }
        },

Run the following command to install dependencies:

~/etherpad-lite/bin/installDeps.sh

Launch EtherPad for the first time:

~/etherpad-lite/bin/run.sh

If there are no errors, you can proceed to the next step.

Create Systemd Service

To create a new Systemd service for EtherPad, open an editor of your choice as root or Sudo user and create a new file:

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

and add the following lines of code:

[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 at boot:

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

To check it works, type journalctl -f -u etherpad.service and you should see something like below:

[furious]$ 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.

Installing and configuring Nginx

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

[furious]$ sudo apt-get install nginx

Then create a new Nginx server block:

[furious]$ 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:

[furious]$ sudo systemctl restart nginx

In the future, when you want to update EtherPad to the latest version, just run

/opt/etherpad/etherpad-lite && git pull origin

and restart the EtherPad service:

systemctl restart etherpad

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

PS … If you liked this post, please share it with your friends on social media using the buttons on the left side of the post, or just leave a comment below. Thank you in advance.

Sidebar