In this guide I assume you want to use SQLite as storage mechanism. I used Ubuntu 18.04 but there should be no real differences between the different versions/distributions as long as it has systemd installed.
All commands are executed as root. If you do not want to do this, prefix them with sudo [command].
You'll need the tool unzip. If you didn't install it yet or don't know if it is installed just execute apt install -y unzip.
Parts of this guide are taken from this guide and are modified for Gotify.