How to Install ntfy on Ubuntu Server Latest?

ntfy is an open-source notification system for the command-line interface. It sends notifications about various system events like command completion, file downloads, system failures, etc. In this tutorial, we will explain how to install ntfy on the latest version of Ubuntu Server.

Prerequisites

Before installing ntfy, you must have the following:

Installing Python and Required Packages

ntfy is written in Python and needs some Python packages to function correctly. Therefore, we need to install Python and other required packages.

  1. Open the terminal by pressing Ctrl+Alt+T.

  2. Update the system by running the following command.

$ sudo apt update && sudo apt upgrade -y
  1. Install Python 3 and Python package manager pip by executing the following command.
$ sudo apt install python3 python3-pip -y
  1. Install required Python packages using pip.
$ sudo pip3 install notify2 psutil requests

Downloading and Installing ntfy

After installing required Python packages, we can now download and install ntfy.

  1. Download the latest version of ntfy using the following command.
$ sudo curl -L https://github.com/dschep/ntfy/releases/download/v2.1.0/ntfy-2.1.0.tar.gz -o ntfy.tar.gz

You can visit the ntfy releases page to download the latest version.

  1. Extract the downloaded archive.
$ sudo tar xzf ntfy.tar.gz
  1. Go to the extracted directory.
$ cd ntfy-2.1.0
  1. Install ntfy by running the following command.
$ sudo python3 setup.py install

Now you have successfully installed ntfy on your Ubuntu Server.

Using ntfy

To use ntfy, we just need to run a command and it will take care of the rest. For example, to get notifications about completion of long-running commands, we can use the following command.

$ ntfy long-running-command

ntfy will send you a system notification when the command completes.

There are many other use cases for ntfy. You can visit the ntfy GitHub page to learn more.

Conclusion

ntfy is a powerful command-line notification system that can help notify you about important system events. In this tutorial, we learned how to install ntfy on Ubuntu Server latest version. We also explained how to use it to get notifications about commands completion.

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!