Introduction
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
sudo -i
- 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
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-16_46_55-Greenshot-1024x645.png)
- 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 -
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-16_47_35-Greenshot-1024x653.png)
- And then, install NodeJS by running
sudo apt-get install -y nodejs
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-16_51_37-Greenshot-1024x336.png)
- In addition to check the installed versions with the commands:
node --version
npm --version
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-16_51_53-Greenshot.png)
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
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-16_52_17-Greenshot.png)
- Change to the haste-server directory and install all required packs.
# cd haste-server
# npm install
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-16_53_16-Greenshot-1024x544.png)
- Update the packages with npm.
# npm update
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-16_53_39-Greenshot-1024x274.png)
- Hastebin defaults to port 7777. Please change it to HTTP port 80.Edit config.jsÂ
# vim config.js
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-16_55_39-Greenshot.png)
- Change this line from 7777 to 80:“port”: “7777”, When finished, it should look like this: “port”: “80”, Save and exit the file.
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-16_56_01-Greenshot.png)
Install PM2
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
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-16_56_57-Greenshot-1024x206.png)
- Start your Hastebin server.
# pm2 start server.js
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-16_57_49-Greenshot.png)
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-16_57_53-Greenshot.png)
- So Save your PM2 configuration, and ask it to run at startup.
# pm2 save
# pm2 startup
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-16_58_25-Greenshot-1024x639.png)
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.
![](http://unixcop.com/wp-content/uploads/2021/07/2021-07-01-17_05_09-Greenshot-1024x457.png)