How to install Glances on Rocky Linux 9.4

To Install Glances Monitoring Tool On Rocky Linux 9.4

Introduction:

Glances is a versatile monitoring tool designed to efficiently display a wide range of essential system information through a command line or web-based interface. It provides details on memory usage, CPU performance, Disk IO, file system status, system uptime, running processes, network interfaces, alerts, and various other system metrics.

Procedure Steps:

Step 1: Check the OS version by using the below command.

[root@linuxhelp ~]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.4 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.4"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.4 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.4"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.4"

Step 2: Enable the EPEL and CRB Repository by using the below command.

 [root@linuxhelp ~]# dnf install epel-release
Last metadata expiration check: 1:29:26 ago on Wednesday 05 June 2024 07:54:21 AM.
Dependencies resolved.
=================================================================================================================
 Package                       Architecture            Version                     Repository               Size
=================================================================================================================
Installing:
 epel-release                  noarch                  9-7.el9                     extras                   19 k
Transaction Summary
=================================================================================================================
Install  1 Package
Total download size: 19 k
Installed size: 26 k
Is this ok [y/N]: y
Downloading Packages:
epel-release-9-7.el9.noarch.rpm                                                   83 kB/s |  19 kB     00:00    
-----------------------------------------------------------------------------------------------------------------
Total                                                                             15 kB/s |  19 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                         1/1 
  Installing       : epel-release-9-7.el9.noarch                                                             1/1 
  Running scriptlet: epel-release-9-7.el9.noarch                                                             1/1 
Many EPEL packages require the CodeReady Builder (CRB) repository.
It is recommended that you run /usr/bin/crb enable to enable the CRB repository.
Verifying        : epel-release-9-7.el9.noarch                                                             1/1 
Installed:
  epel-release-9-7.el9.noarch                                                                                    
Complete!

[root@linuxhelp ~]# /usr/bin/crb enable
Enabling CRB repo
CRB repo is enabled and named: crb

Step 3: Install required packages by using the below command.

[root@linuxhelp ~]# dnf install python3 python3-jinja2 python3-psutil python3-setuptools hddtemp python3-pip lm_sensors
Extra Packages for Enterprise Linux 9 - x86_64                                   5.9 MB/s |  21 MB     00:03    
Extra Packages for Enterprise Linux 9 openh264 (From Cisco) - x86_64             680  B/s | 2.5 kB     00:03    
Rocky Linux 9 - BaseOS                                                           3.3 kB/s | 4.1 kB     00:01    
Rocky Linux 9 - AppStream                                                        3.8 kB/s | 4.5 kB     00:01    
Rocky Linux 9 - CRB                                                              1.3 MB/s | 2.4 MB     00:01    
Package python3-3.9.18-3.el9.x86_64 is already installed.
Package python3-psutil-5.8.0-12.el9.x86_64 is already installed.
Package python3-setuptools-53.0.0-12.el9.noarch is already installed.
Dependencies resolved.
=================================================================================================================
 Package                        Architecture       Version                           Repository             Size
=================================================================================================================
Installing:
 hddtemp                        x86_64             0.3-0.50.beta15.el9               epel                   57 k
 lm_sensors                     x86_64             3.6.0-10.el9                      appstream             134 k
 python3-jinja2                 noarch             2.11.3-5.el9                      appstream             227 k
 python3-pip                    noarch             21.2.3-8.el9                      appstream             1.7 M
Installing dependencies:
 python3-babel                  noarch             2.9.1-2.el9                       appstream             5.8 M
 python3-markupsafe             x86_64             1.1.1-12.el9                      appstream              32 k
 python3-pytz                   noarch             2021.1-5.el9                      appstream              47 k
 usermode                       x86_64             1.114-4.el9                       baseos                175 k
Transaction Summary
=================================================================================================================
Install  8 Packages

Total download size: 8.2 M
Installed size: 38 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): usermode-1.114-4.el9.x86_64.rpm                                           439 kB/s | 175 kB     00:00    
(2/8): hddtemp-0.3-0.50.beta15.el9.x86_64.rpm                                    132 kB/s |  57 kB     00:00    
-----------------------------------------------------------------------------------------------------------------
Total                                                                            1.9 MB/s | 8.2 MB     00:04     
Extra Packages for Enterprise Linux 9 - x86_64                                   1.6 MB/s | 1.6 kB     00:00    
Importing GPG key 0x3228467C:
 Userid     : "Fedora (epel9) <epel@fedoraproject.org>"
 Fingerprint: FF8A D134 4597 106E CE81 3B91 8A38 72BF 3228 467C
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                         1/1 
  Installing       : python3-markupsafe-1.1.1-12.el9.x86_64                                                  1/8 
Created symlink /etc/systemd/system/multi-user.target.wants/lm_sensors.service → /usr/lib/systemd/system/lm_sensors.service.
Verifying        : hddtemp-0.3-0.50.beta15.el9.x86_64                                                      1/8 
 Verifying        : usermode-1.114-4.el9.x86_64                                                             2/8 
Installed:
  hddtemp-0.3-0.50.beta15.el9.x86_64  lm_sensors-3.6.0-10.el9.x86_64          python3-babel-2.9.1-2.el9.noarch 
  python3-jinja2-2.11.3-5.el9.noarch  python3-markupsafe-1.1.1-12.el9.x86_64  python3-pip-21.2.3-8.el9.noarch  
  python3-pytz-2021.1-5.el9.noarch    usermode-1.114-4.el9.x86_64            
Complete!

Step 4: Check if there are any updates available by using the below command.

[root@linuxhelp ~]# dnf update -y
Last metadata expiration check: 0:01:32 ago on Wednesday 05 June 2024 09:26:50 AM.
Dependencies resolved.
Nothing to do.
Complete!

Step 5:- Install Glances by using the below command

[root@linuxhelp ~]# dnf install glances -y
Last metadata expiration check: 0:02:04 ago on Wednesday 05 June 2024 09:26:50 AM.
Dependencies resolved.
=================================================================================================================
 Package                          Architecture         Version                     Repository               Size
=================================================================================================================
Installing:
 glances                          noarch               3.3.1-2.el9                 epel                    594 k
Installing dependencies:
 double-conversion                x86_64               3.1.5-6.el9                 appstream                48 k
 python3-bottle                   noarch               0.12.21-2.el9               epel                     96 k
 python3-defusedxml               noarch               0.7.1-3.el9                 epel                     50 k
 python3-future                   noarch               0.18.3-3.el9                epel                    731 k
 python3-ujson                    x86_64               5.8.0-1.el9                 epel                     33 k
Transaction Summary
=================================================================================================================
Install  6 Packages
Total download size: 1.5 M
Installed size: 6.5 M
Downloading Packages:
(1/6): python3-defusedxml-0.7.1-3.el9.noarch.rpm                                 214 kB/s |  50 kB     00:00    
(2/6): python3-bottle-0.12.21-2.el9.noarch.rpm                                   297 kB/s |  96 kB     00:00    
-----------------------------------------------------------------------------------------------------------------
Total                                                                            546 kB/s | 1.5 MB     00:02     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                         1/1 
  Installing       : double-conversion-3.1.5-6.el9.x86_64                                                    1/6 
  Installing       : python3-ujson-5.8.0-1.el9.x86_64                                                        2/6 
Installed:
 double-conversion-3.1.5-6.el9.x86_64   glances-3.3.1-2.el9.noarch          python3-bottle-0.12.21-2.el9.noarch 
  python3-defusedxml-0.7.1-3.el9.noarch  python3-future-0.18.3-3.el9.noarch  python3-ujson-5.8.0-1.el9.x86_64    
Complete!

Step 6:- Add a firewall rule for Glances web port so that the web console would be accessible using the below command.

[root@linuxhelp ~]# firewall-cmd --zone=public --add-port=61208/tcp --permanent
success
[root@linuxhelp ~]# firewall-cmd --reload
success

Step 7: Run the below glances command to monitor your local machine.

[root@linuxhelp ~]# glances

Step 8: If you want to remotely monitor your machine, from any device with a web browser, just run the glances with the -w option.

For this to work, we need to install the Bottle module -- you can install this module using pip command.
[root@linuxhelp ~]# pip3 install bottle
Requirement already satisfied: bottle in /usr/lib/python3.9/site-packages (0.12.21)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Step 9: Run the below command to remotely monitor a machine

[root@linuxhelp ~]# glances -w

Glances Web User Interface started on http://0.0.0.0:61208/ Copy the above URL and paste in your web browser. Web mode will only be active if the above command is running. You can quit the web mode by stopping the web mode with Ctrl + C.

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install Glances Monitoring Tool on Rocky Linux 9.4. Your feedback is much welcome.

FAQ
Q
What are the dependencies for installing Glances?
A
Glances require Python and some optional dependencies like psutil for extended functionality.
Q
How do I update Glances to the latest version?
A
If installed via pip, update using: pip install --upgrade glances
Q
Can I access Glances via a web browser?
A
Yes, start Glances in web mode:
glances -w
Then, access it at http://:61208.
Q
Is there a way to install Glances on macOS?
A
Yes, you can install Glances on macOS using Homebrew: brew install glances
Q
Can I install Glances using Python's package manager?
A
Yes, install Glances using pip: pip install glances