How to Install Goshorly on Ubuntu Server Latest

Goshorly is a Go program that can shorten your URLs. It is available on git repositories. In this tutorial, we will help you install Goshorly on Ubuntu Server Latest.

Prerequisites

  • Ubuntu Server Latest
  • Root user access or user with sudo permission
  • Internet connection

Step 1 - Install Git

The first step is to install git, which is required to download open-source packages from Git repositories. Run the following command to install git:

sudo apt update
sudo apt install git

Step 2 - Clone the Goshorly Repository

After installing Git, clone the Goshorly repository to your Ubuntu server using the following command:

git clone https://gitea.hackmi.ch/Phil/goshorly.git

Step 3 - Install Go

Goshorly is a Go program, so you will need to install Go on your Ubuntu server. Run the following commands to install the latest version of Go:

sudo apt install curl
curl -O https://dl.google.com/go/go1.15.6.linux-amd64.tar.gz
sudo tar -xvf go1.15.6.linux-amd64.tar.gz
sudo mv go /usr/local

Step 4 - Set Go Path Variables

Next, set the Go environment variables by adding the following lines to the /etc/profile file:

sudo nano /etc/profile

Add the following lines to the end of the file:

export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

Save and close the /etc/profile file.

Step 5 - Build and Install Goshorly

Now that you have downloaded the Goshorly repository and set up the Go environment variables, navigate to the cloned repository's directory using the following command:

cd goshorly

To build and install Goshorly, run the following command:

sudo go install

Step 6 - Test Goshorly

Once the installation is complete, run the Goshorly command to see if it works.

goshorly -h

This command should display the Goshorly help message.

Conclusion

You have successfully installed Goshorly on your Ubuntu server. You can now use Goshorly to shorten URLs on your device.