How to install Hackpad on CentOS 7

install-hackpad-on-a-centos-7-vpsIn this tutorial, we will explain how to install Hackpad on a Centos 7 VPS with nginx as a reverse proxy. Hackpad is a web-based real-time wiki, based on the open source EtherPad collaborative editor. This guide should work on other Linux VPS systems as well but was tested and written for a Centos 7 VPS.

Login to your VPS via SSH

ssh root@vps

Update the system and install necessary packages

[root]$ yum -y update
[root]$ yum install git wget

Create a new system user

Create a new user for the Hackpad:

[root]$ adduser \
   --comment 'Hackpad User' \
   --home-dir /home/hackpad \
   hackpad

Install Oracle JDK 7

Hackpad requires JDK 7. Use the command below to download the latest Oracle JDK 7 from the command line using wget:

[root]$ wget --no-cookies \
    --no-check-certificate \
    --header "Cookie: oraclelicense=accept-securebackup-cookie" \
    "http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.rpm" \
    -O jdk-7u80-linux-x64.rpm

Once the rpm package is downloaded, install it with:

[root]$ yum install jdk-7u80-linux-x64.rpm

To check if JAVA has been properly installed on your CentOS box run java -version, and the output should be similar to the following:

[root]$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

Install Scala

To download and install the latest scala version from the official website, run:

[root]$ wget http://downloads.typesafe.com/scala/2.11.7/scala-2.11.7.rpm

Once the rpm package is downloaded, install it with:

[root]$ yum install scala-2.11.7.rpm

Now if you run scalac -version, you should get something like this:

[root]$ scalac -version
Scala compiler version 2.11.7 -- Copyright 2002-2013, LAMP/EPFL

Install MariaDB

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

[root]$ yum install mariadb-server

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

[root]$ systemctl start mariadb.service
[root]$ systemctl enable mariadb.service

Run the following command to secure your installation:

[root]$ mysql_secure_installation

Install Hackpad

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

[root]$ sudo su - hackpad

Clone the Hackpad source code to the /home/hackpad/hackpad directory.

[hackpad]$ git clone https://github.com/dropbox/hackpad.git ~/hackpad

Edit the file ~/hackpad/bin/exports.sh as follows:

...
export SCALA_HOME="/usr/share/scala/"
export SCALA="$SCALA_HOME/bin/scala"
export SCALA_LIBRARY_JAR="$SCALA_HOME/lib/scala-library.jar"
...
export JAVA_HOME="/usr/java/jdk1.7.0_80"
export JAVA="/usr/bin/java"
...
export MYSQL_CONNECTOR_JAR="/home/hackpad/hackpad/lib/mysql-connector-java-5.1.34-bin.jar"
...

and run:

[hackpad]$ cd ~/hackpad
[hackpad]$ bin/build.sh

To create a database for our Hackpad instance, run:

[hackpad]$ contrib/scripts/setup-mysql-db.sh

And enter MySQL root password when prompted.

Copy the default settings configuration file etherpad/etc/etherpad.localdev-default.properties to etherpad/etc/etherpad.local.properties and set the etherpad.superUserEmailAddresses and topdomains, for example:

etherpad.isProduction = true
etherpad.superUserEmailAddresses = name1@example.com,name2@example.com
topdomains = yourdomainname.com,localhost

Start hackpad for the first time:

[hackpad]$ 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 Hackpad, open your editor of choice as a root or sudo user and create a new file:

[root]$ vim /etc/systemd/system/hackpad.service

and add the following code lines:

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

[Service]
Type=simple
User=hackpad
Group=hackpad
ExecStart=/home/hackpad/hackpad/bin/run.sh
Restart=always

[Install]
WantedBy=multi-user.target

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

[root]$ systemctl enable hackpad.service
[root]$ systemctl start hackpad.service

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

[root]$ journalctl -f -u hackpad.service
Aug 22 10:42:09 vps run.sh[3080]: dropbox: 2015-08-22 10:42:09.375-0500        Starting dropbox sync
Aug 22 10:42:09 vps run.sh[3080]: dropbox: 2015-08-22 10:42:09.382-0500        Done with dropbox sync

Install and configure Nginx

Nginx is not available by default in CentOS 7 so we will use the official Nginx repository:

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
[root]$ wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
[root]$ yum install nginx-release-centos-7-0.el7.ngx.noarch.rpm
[root]$ yum install nginx

Next, create a new Nginx server block:

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

server {
  server_name yourdomainname.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:9000/;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
  }
}

Activate the server block by restarting Nginx:

[user]$ systemctl restart nginx

That’s it. You have successfully installed your Hackpad. To access it, open http://yourdomainname.com/ in your browser. For more information about Hackpad, please refer to the official Hackpad website.

 

Update:

Hackpad was acquired by Dropbox and it seems that the project is not maintanined anymore. Since Hackpad is based on the EtherPad collaborative document editor, our recommendation is to install and use Etherpad as described at https://www.rosehosting.com/blog/install-etherpad-on-a-centos-7-vps/


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.

11 thoughts on “How to install Hackpad on CentOS 7”

  1. Any hints on a “Incorrect key file for table ‘pro_accounts_auto_signin’; try to repair it” error that comes up when running bin/run.sh?

    Reply
    • You can try to repair the table using the following command: REPAIR TABLE pro_accounts_auto_signin; and then run bin/run.sh again. Thanks.

      Reply
  2. I try to understand, if we use Apache, we can “skip” the nginx part and use the port 9000 no ?

    We can also configure apache for use with a good DNS ?

    Thanks in advance.

    Reply
  3. Yes, you can access your Hackpad on port 9000 and you can use Apache instead of Nginx. For more info about how to configure your Apache as a reverse proxy please check: https://www.rosehosting.com/blog/how-to-install-and-configure-exo-platform-with-java-and-apache-as-a-reverse-proxy/

    Reply
  4. It’s a great guide, but, after 3 try. I always finish in the same step. I have a the webpage, but, without CSS I presume, it’s weird and I can’t do anything, I just see google, facebook and twitch login, but nothing works at all.

    Any idea ?

    Reply
      • Strangely, I see nothing, all seems to works well on the script (or by journalctl -f -u hackpad.service)

        I really don’t understand why it doesn’t work. I retry again another install, but don’t understand my error :(…

        Reply
      • Ok I saw that I have problem with undefined/static/compressed/c5eb903f3b950933be16d8c24e2eae58.css and a lot of undefined folder for css.

        I use domain like foo.domain.com. Maybe it’s why it doesn’t work ?

        Reply
          • It seems that this project is not maintained anymore. You can try to install and use Etherpad instead. Please read this tutorial: https://www.rosehosting.com/blog/install-etherpad-on-a-centos-7-vps/

Leave a Comment