According to the GitHub:
HASTE is an open-source pastebin software written in nodeJS, 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
Major design objectives:
Some important steps to get ready to install Hastebin
This way we can install a client that we can use in almost any system or server to have a particular instance ourselves, so you can implement it in personal projects or internal networks.
- In addition to We will run the commands using the root user. So, open a terminal or via SSH and run
- After typing the password, make sure to update the operating system
apt update && apt upgrade
- After that, install the packages needed for the tutorial:
apt install software-properties-common git curl -y
- So Now we have to install NodeJS on Ubuntu 21.04 and for this you have to add the application repository.
curl -sL https://deb.nodesource.com/setup_16.x | bash -
- And then, install NodeJS by running
sudo apt-get install -y nodejs
- In addition to check the installed versions with the commands:
node --version npm --version
Install Hastebin Server
- SSH to your server as root.
- Clone the haste-server repository from GitHub.
# git clone https://github.com/seejohnrun/haste-server.git
- Change to the haste-server directory and install all required packs.
# cd haste-server# npm install
- Update the packages with npm.
# npm update
- Hastebin defaults to port 7777. Please change it to HTTP port 80.Edit config.js
# vim config.js
- Change this line from 7777 to 80:“port”: “7777”, When finished, it should look like this: “port”: “80”, Save and exit the file.
PM2 is a process manager for Node.JS applications. PM2 monitors and restarts your application if it goes offline.
- Install PM2.
# npm install pm2 -g
- Start your Hastebin server.
# pm2 start server.js
- So Save your PM2 configuration, and ask it to run at startup.
# pm2 save # pm2 startup
Test the Hastebin Server
Navigate to your server’s IP address in a browser to load an empty page, ready for you to paste code.