Gotify is a self-hosted server for pushing notifications. In this tutorial, we will guide you on how to install Gotify on Ubuntu Server.
Before starting, ensure you have the following:
Firstly, you need to update your Ubuntu Server’s packages to the latest version. To do so, follow the below commands:
sudo apt update
sudo apt upgrade
Gotify requires some dependencies to be installed on the system. Run the following command to install these dependencies:
sudo apt install curl git
Gotify requires the Go language to run on the system. Follow the below steps to install Go:
Go to the official Go website (https://golang.org/dl/) and download the latest version of Go in tar.gz format.
Extract the downloaded file to the /usr/local directory using the following command:
sudo tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
We need to set the PATH environment variable to the 'Go bin' path. To do so, add the following line in the '/etc/profile.d/go.sh' file using a text editor:
export PATH=$PATH:/usr/local/go/bin
Load the changes to the system using the following command:
source /etc/profile.d/go.sh
Verify the Go installation by running the following command:
go version
Follow the below steps to install and configure the Gotify server:
Download the latest stable release of Gotify from the official website (https://github.com/gotify/server/releases/latest).
curl -LJO https://github.com/gotify/server/releases/latest/download/gotify-linux-amd64.zip
Extract the downloaded file to the '/opt' directory using the following command:
sudo unzip -d /opt gotify-linux-amd64.zip
Create a new system user to run the Gotify server.
sudo useradd --home-dir /var/lib/gotify --shell /usr/sbin/nologin --system gotify
Change the ownership of the '/opt/gotify' directory to the newly created 'gotify' user.
sudo chown -R gotify:gotify /opt/gotify
Create a new systemd service file to control the Gotify server using the following command:
sudo vi /etc/systemd/system/gotify.service
Copy the following contents to the file:
[Unit]
Description=Gotify Push Notification Server
[Service]
User=gotify
Group=gotify
WorkingDirectory=/opt/gotify
ExecStart=/opt/gotify/gotify serve
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
Reload the systemd system.
sudo systemctl daemon-reload
Start the Gotify service and enable it to start automatically at system boot.
sudo systemctl enable --now gotify
Verify the Gotify service's status.
sudo systemctl status gotify
By default, the firewall blocks the ports that the Gotify server uses. We need to allow ports 80, 443 and 6789 for HTTP, HTTPS, and Gotify respectively. Run the following commands:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 6789/tcp
sudo ufw enable
Congratulations! You have successfully installed and configured the Gotify server on your Ubuntu Server. You can now easily send push notifications from your application through the Gotify server.
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!