Skip to main content

Sentinel Hub Setup

Install the Go toolchain, open the gossip port, and build the sentinelhub binary.

Install Golang

First of all install some required packages

sudo apt install curl git jq make unzip gcc -y

You now have two methods for installing Golang.

Ubuntu

To install Go on Ubuntu, you can easily follow the steps provided.

Add the repository

sudo add-apt-repository ppa:longsleep/golang-backports

Install Golang

sudo apt install -y golang-go

Manually

This method should work on all Linux systems, although it is intended for more experienced users.

Get a copy of the last Golang version and unpack it

cd ~ && \
curl -OL https://golang.org/dl/goX.X.X.linux-amd64.tar.gz && \
tar -C ${HOME} -xvf goX.X.X.linux-amd64.tar.gz

Copy the extracted go into /usr/local/lib/go

sudo cp -r ${HOME}/go /usr/local/lib/go

Export Golang environment variables

Now that you've successfully installed Golang, it's essential to configure its environmental variables.

Open the .bashrc file

nano ${HOME}/.bashrc

Based on your installation type, set the GOROOT environment variable by choosing one of the following lines

# For Ubuntu installation
export GOROOT=/usr/lib/go

# For Manual installation
export GOROOT=/usr/local/lib/go

After setting the appropriate GOROOT environment variable, you can add the following lines

${HOME}/.bashrc
export GOPATH=${HOME}/go
export GOBIN=${GOPATH}/bin
export PATH=${PATH}:${GOROOT}/bin:${GOBIN}

Source the file to reflect changes in the current Terminal session.

source ${HOME}/.bashrc

Install Sentinel Hub

To install Sentinel Hub, clone the GitHub repository:

git clone https://github.com/sentinel-official/sentinelhub.git "${HOME}/sentinelhub"

Checkout to the latest tag:

cd ${HOME}/sentinelhub/ && \
commit=$(git rev-list --tags --max-count=1) && \
git checkout $(git describe --tags ${commit})

Build the Binary

make install

# For Ubuntu installation
sudo ln -s "${GOBIN}/sentinelhub" /usr/bin/sentinelhub

# For manual installation
sudo ln -s "${GOBIN}/sentinelhub" /usr/local/bin/sentinelhub