HedgeDoc (formerly known as HackMD) is an open-source, collaborative markdown editor that is designed to facilitate note-taking and writing tasks. In this tutorial, we will guide you through the installation process of HedgeDoc on Elementary OS Latest.
Before we begin, make sure you have the following prerequisites:
sudo
privileges.Before we install any new packages, let's update and upgrade our system packages to ensure that we have the latest version available.
Type the following command in your terminal emulator to update and upgrade the system packages:
sudo apt update
sudo apt upgrade -y
HedgeDoc requires Node.js to run. To install Node.js, execute the following commands one by one in your terminal:
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get update
sudo apt-get install -y nodejs
Verify that Node.js is installed by typing node -v
in your terminal emulator. If Node.js is successfully installed, you should see the version of Node.js printed on the screen.
HedgeDoc requires a relational database management system (RDBMS) to store its data, and PostgreSQL is the recommended RDBMS for HedgeDoc. To install PostgreSQL, execute the following command in your terminal emulator:
sudo apt-get install postgresql postgresql-client -y
PostgreSQL is now installed on your system. We will configure it in the next step.
By default, PostgreSQL only allows local connections. To allow remote connections and create a new database and user for HedgeDoc, follow these steps:
Change the authentication method used by PostgreSQL:
sudo nano /etc/postgresql/13/main/pg_hba.conf
Replace peer
with md5
for the following two lines under IPv4 local connections
:
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
Restart the PostgreSQL service:
sudo systemctl restart postgresql
Login to the PostgreSQL interactive terminal:
sudo su postgres
psql
Create a new user and database for HedgeDoc:
CREATE USER hedge WITH PASSWORD 'your-password';
CREATE DATABASE hedgedoc WITH OWNER hedge;
Replace your-password
with a strong password of your choice.
Quit the PostgreSQL interactive terminal:
\q
exit
Now that we have installed and configured all the necessary prerequisites, we can finally install HedgeDoc. Follow these steps:
Clone the HedgeDoc repository:
git clone https://github.com/hedgedoc/hedgedoc.git
Navigate to the cloned repository:
cd hedgedoc/
Install the dependencies:
npm install
Copy the sample config file:
cp .env.sample .env
Edit the .env
file:
nano .env
Update the following configuration options:
DATABASE_URL=postgresql://hedge:your-password@localhost/hedgedoc
ENVIRONMENT=production
Replace your-password
with the password you chose in Step 4. Save your changes and exit.
Build the app:
npm run build
Start the app:
NODE_ENV=production npm start
If everything was successful, you should see a message letting you know that the HedgeDoc server has started.
By default, HedgeDoc will listen on port 3000. To access HedgeDoc from a web browser, navigate to http://your-server-ip:3000
(replacing your-server-ip
with the IP address of your Elementary OS Latest machine).
You should now have a working installation of HedgeDoc. Enjoy collaborative markdown editing!
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!