Schort is a URL shortener that is open-source software. It is a simple and effective way to create short URLs to share and track links. In this tutorial, we will go through the steps to install Schort on Ubuntu Server Latest.
Before you can install Schort on Ubuntu Server Latest, there are some prerequisites that need to be installed on the server. Please make sure the server is updated and you have root access to install the following packages.
Use the following commands to install Git and Node.js:
sudo apt-get update
sudo apt-get install git
sudo apt-get install nodejs
sudo apt-get install npm
After the installation, check the version of Node.js installed on the server:
nodejs --version
Schort requires a database to store the URL data. We will use MongoDB, which is a NoSQL database. Run the following commands to install MongoDB:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org
After the installation, start the MongoDB service:
sudo systemctl start mongod.service
In this step, we will clone Schort from Github into the server. Use the following commands to go into the home directory and clone the repository:
cd ~/
git clone https://github.com/sqozz/schort.git
Schort uses NPM to manage its dependencies. Go into the Schort directory and install the dependencies using the following command:
cd schort/
npm install
Schort uses a configuration file to store its settings. Rename the config.example.json
to config.json
and change the settings to match your environment.
cp config.example.json config.json
nano config.json
Edit the config.json
file to match your environment.
{
"mongoUrl": "mongodb://localhost/schort",
"domain": "http://localhost:8080",
"port": 8080,
"keyLength": 7
}
mongoUrl
: This is the MongoDB URL for the database. The default is mongodb://localhost/schort
.domain
: This should be the domain name or IP address where Schort is installed.port
: This is the port that Schort will be running on. The default is 8080
.keyLength
: This is the length of the generated keys. The default is 7
.Now that Schort has been configured, it is ready to be started. Use the following command to start Schort:
npm start
You should get the following output:
> schort@0.0.1 start /home/user/schort
> node ./bin/www
Schort listening on port 8080
Schort is now installed and running. However, to run Schort as a daemon and start on system boot, you will need to configure it accordingly.
You can use forever
to run Schort as a daemon. Use the following command to install forever
:
sudo npm install -g forever
Use forever
to start Schort as a daemon:
forever start bin/www
Congratulations! You have successfully installed Schort on Ubuntu Server Latest. You can now use it as your own URL shortener.
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!