How to Install Hastebin on Ubuntu 20.04

Install Hastebin on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure Hastebin on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Hastebin is an open-source pastebin software written in node.js, which is easily installable in any network. It can be backed by either Redis or filesystem and has a very easy adapter interface for other stores.

Install Hastebin on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install NodeJS on Ubuntu 20.04.

Add the application repository:

curl -sL https://deb.nodesource.com/setup_14.x | bash -

Then, install NodeJS using the following command:

sudo apt install nodejs

Step 3. Install Hastebin on the Ubuntu system.

  • Install Haste from GitHub repository.

Now clone the haste-server repository from GitHub using the following command:

git clone https://github.com/seejohnrun/haste-server.git
cd haste-server

Once done, installing the required packages with npm:

npm install
npm update
  • Install Haste from Snap packages.

Run the following command to install it:

sudo apt install snapd
sudo snap install haste-server --beta

Step 4. Configure Hastebin.

Once Hastebin installed, now change the default 7777 port to 80.

nano config.js

Change this line from 7777 to 80:

"port": "7777"

When finished, it should look like this:

"port": "80"

Finally install pm2 to manage the execution of Hastebin:

npm install pm2 -g

And now start the execution of Hastebin:

pm2 start server.js

Save the initial configurations and make it start with the system:

pm2 save
pm2 startup

Step 4. Test the Hastebin Server.

Navigate to your server’s IP address example: http://your-server-address in a browser to load an empty page, ready for you to paste code and you can now enjoy Hastebin.

That’s all you need to do to install Hastebin on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on Install Hastebin’s open-source server like Pastebin, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.