System monitoring is essential for maintaining a stable operation, be it for personal or professional use. Many tools offer in-depth system monitoring for users. These tools help users remain up-to-date with their systems. Furthermore, they help users make future decisions based on hard facts. Such monitoring tools are most welcome on Linux, which lacks a native solution for them.
Today we are talking about Glances. It is a Python-based tool that monitors several aspects of your system. Not only that, but you can also monitor remote systems using the Glances API. Thus, it is paramount to understand how to install Glances on Linux devices.
Table Of Contents
What is Glances?
As mentioned above, Glances is a Python-based monitoring tool capable of performing across platforms. It is an open-source project that allows real-time insight into your system. It monitors and provides information on various aspects of the system, such as the CPU, memory, disk usage, network, and I/O. Furthermore, the tool can also manage different container systems, such as Docker and LXC. The information is presented in a text-based interface, which is quite easy to understand.
System Requirements
Before starting with the installation, ensure the following requirements are met:
- Python version 2.7 or up or Python 3.4
- Latest Version of Psutil (at least version 5.3.0)
- The defusedxml package on PyPI (to monkey patch ‘xmlrpc’)
- uJSON (which is an alternative to the standard JSON module)
How to Install Glances on Linux?
If you visit the official Git page of Glances, you will find out that the preferred method to install the tool is using the Auto Install Script. It is supported on most GNU/Linux distros. We’ve provided the list of supported distros below. You can run the following commands in the terminal window to directly install Glances in seconds.
- Alpine
- Arch
- CentOS
- CentOS minimal based
- Debian
- elementary OS
- Fedora
- LinuxMint
- macOS
- OpenSuse
- Oracle EL
- Raspbian
- Redhat
- Redhat Enterprise Server
- Scientific aka SL
- Ubuntu
Method 1. Install Glances On Linux Using Auto Install Script
To install Glances via this method, all you have to do is run the terminal window using Ctrl+Alt+T and enter the following command:
curl -L https://bit.ly/glances | /bin/bash
Or,
wget -O- https://bit.ly/glances | /bin/bash
Method 2. Build Glances From Source
As always, you can build/compile the tool from the source, as it provides much more versatility. However, it is only recommended for advanced users:
Step 1. Fetch the Source from Git:
wget https://github.com/nicolargo/glances/archive/vX.Y.tar.gz
tar xz vX.Y.tar.gz
Step 2. Navigate to the Directory
cd glances
Step 3. Install it.
python setup.py install
Method 3. Glances on FreeBSD
If you are running FreeBSD, you can still enjoy Glances, by simply installing the Binary package and then installing Glances via ports:
Step 1. First, install the binary package:
pkg install py38-glances
Step 2. Now install Glances from ports:
cd /usr/ports/sysutils/py-glances/
make install clean
However, you can still install Glances on different Linux distributions. Here’s how:
For Ubuntu Systems
Now, let us talk about systems running Ubuntu. Although the methods mentioned above can easily install Glances on your device, if you are still having trouble then worry not as we have provided a few more alternate solutions:
Solution 1. Using APT Repository
The easiest way is to use the APT repo, as Glances is available on most of the native Linux archives.
Step 1. Open a terminal window (Ctrl+Alt+T).
Step 2. Now, update your package
sudo apt update
Step 3. Finally, install Glances:
sudo apt install glances
Solution 2. Using Pip (Python Package Index)
Another method is to use the Python Package Index or Pip, and it is actually recommended, as the tool requires the latest version of Python to function. Using it makes you far less likely to get stuck later on.
Step 1. Start by installing pip if you haven’t already:
sudo apt install python3-pip
Step 2. Now, install Glances via pip:
sudo pip3 install glances
Solutions 3. Install Glances on Linux Using Docker Images
You can also run Glances in a Docker container, all you have to do is:
Step 1. Install Docker on your device. For this, you will have to proceed with adding the official GPG key:
Step 1.1. First, update the APT repo
sudo apt-get update
Step 1.2. Now, download the dependencies and import the key:
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
Step 1.3. Now, run the APT repo and update it:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Step 1.4. Then, install the Docker packages (latest version)
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Step 2. Now, pull the Glances Docker image:
sudo docker pull nicolargo/glances
Step 3. Finally, run Glances as a Docker container:
sudo docker run --rm -ti --pid host --network host -v /var/run/docker.sock:/var/run/docker.sock nicolargo/glances
Solution 4. Building From Source
Covered above, but this method is for Ubuntu, although you can also build on other distros by using the appropriate commands:
Step 1. Start by installing the dependencies:
sudo apt update
sudo apt install git python3-pip
Step 2. Then, clone the Glances Repository from Git:
wget git clone https://github.com/nicolargo/glances.git
Step 3. Now, navigate to the Glances Directory:
cd glances
Step 4. Finally, install Glances:
sudo pip3 install
For Debian Systems
Now, for Linux systems running Debian, all you have to do is:
Solution 1. Using APT Repo
The steps are similar to those mentioned on Ubuntu. The commands are as follows:
sudo apt update
sudo apt install glances
Solution 2. Install Glances on Linux Using Snap
You can also use Snap for Ubuntu, and really most Linux distros. But we will demonstrate it for Debian systems.
Step 1. First, you have to enable Snap:
Step 1.1. Check if it is enabled:
sudo systemctl status snapd.service
Step 1.2. If not, enable enable it using the following command:
sudo systemctl enable --now snapd.service
Step 2. Then, install Glances via Snap:
sudo snap install glances
Solution 3. Building Glances From Source
There is an official Debian repo for the latest and stable version of Glances, thus you can also use it to install it:
Step 1. Start by importing the Glances GPG key.
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 89EB5CC636332F1A
Step 2. Now, add the Glances repository to your source
echo "deb http://white.rawgit.com/nicolargo/glances/master/conf/debian/ $(lsb_release -cs) main"
sudo tee /etc/apt/sources.list.d/nicolargo-glances.list
Step 3: Lastly, update the APT package and install Glances.
sudo apt update
sudo apt install glances
For CentOS Systems
Now, let us install Glances on systems running CentOS:
Solution 1. Install Glances on Linux Using YUM
Step 1. Update the YUM repo
sudo yum check-update
Step 2. Then, install Glances:
sudo yum install glances
Solution 2. Using The EPEL Repository
EPEL Repo also offers Glances. Use it to install the tool:
Step 1. Update the YUM repo:
sudo yum update
Step 2. Now install EPEL:
Step 2.1. You can find the latest version of EPEL on the official website. Get it for your system.
wget https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
Step 2.2. Then install the EPEL package:
sudo yum install epel-release-7-11.noarch.rpm
Step 3. Finally, install Glances:
sudo yum install glances
Solution 3. Using Python (PIP)
Yes, the recommended method is still using Pip, as such:
Step 1. Install the latest version of Python:
sudo yum groupinstall 'Development Tools'
sudo yum install python3 python3-pip
Step 2. Install Glances with PIP:
sudo pip3 install glances
For Fedora Systems
Finally, we have systems running Fedora. You can install Glances on Linux running Fedora by doing the following:
Solution 1. Using DNF
Step 1. Update your DNF package
sudo dnf check-update
Step 2. Now, install Glances:
sudo dnf install glances
Solution 2: Install Glances on Linux Using Flatpak
Just like Snap, you can use Flatpak on almost any Linux distro.
Step 1. Install Flatpak on your device:
Step 1.1. First, check if it is already installed or not:
flatpak --version
Step 1.2. If not
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Step 2. Install Glances using Flatpak:
flatpak install flathub.org.glances