Hello, friends. In this post, you will learn how to install on your computer or server Hastebin in Ubuntu 20.04.
According to the information provided by GitHub:
Haste 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.
Major design objectives:
- Be really pretty
- Be really simple
- And be easy to set up and use
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.
Install Hastebin on Ubuntu 20.04
In this post, 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
Now we have to install NodeJS on Ubuntu 20.04 and for this you have to add the application repository.
curl -sL https://deb.nodesource.com/setup_14.x | bash -
and then, install NodeJS by running
apt install nodejs
and check the installed versions with the commands:
node --version npm --version
After that, use git
to get the latest stable version of the application.
git clone https://github.com/seejohnrun/haste-server.git
Next, access the folder that is generated called haste-server
.
cd haste-server/
And from there, run the following command to start the installation:
npm install
Then run this other command to update the dependencies and their versions
npm update
Configuring Hastebin before using it
Now Hastebin will be installed, but it is convenient to change the default 7777
port to 80
.
To do this, edit the config.js
file.
nano config.js
And replace
"port": "7777",
by:
"port": "80",
Save the changes and close the text editor.
It is a good idea to 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] Saving current process list... PM2] Successfully saved in /root/.pm2/dump.pm2
pm2 startup
So, open your web browser and go to
http://your-server
and you can now enjoy Hastebin
Enjoy it.
Conclusion
Hastebin is an ideal tool to share code and other text quickly and easily. Its simple installation allows anyone to do it.