How to Install Glances on Debian 11 or 10


Glances is an open-source, cross-platform system monitoring tool that can provide detailed information about a system’s resources in real-time. When installed on a Debian Linux system, it can benefit the user by providing a quick overview of the system’s performance and identifying potential issues.

Features of Glances include:

  • Real-time monitoring of system resources such as CPU, memory, network usage, and more.
  • Color-coded alerts to indicate the status of various system resources.
  • Customizable and user-friendly interface.
  • Support for multiple platforms, including Linux, BSD, and Windows.
  • A wide range of plugins can be used to extend the tool’s functionality.
  • Cross-platform compatibility allows it to be used on different operating systems.
  • Support for remote monitoring allows you to monitor multiple systems from a single location.
  • Easy installation and configuration process.

These are just a few examples of the many features that Glances has to offer. Its powerful monitoring capabilities and user-friendly interface can be a valuable addition to any Debian Linux system. The following tutorial will teach you how to install and configure Glances on Debian 11 Bullseye or Debian 10 Buster system.

Step 1: Update Debian

Before installing Glances on your Debian system, it is important to ensure that all existing packages are up to date. To do this, you can update your Debian operating system using the command.

sudo apt update && sudo apt upgrade

This will ensure that your system has installed the latest packages and security updates, making it more secure and stable.

Step 2: Install Glances

Before installing Glances, you must have Python and Pip (the package installer for Python) installed on your system. Run the following command to install the packages required.

sudo apt install python3 python3-dev python3-jinja2 python3-psutil python3-setuptools psensor psensor-server python3-pip lm-sensors -y

To install the Glances System Monitor on Debian, you can use PIP3 by running the command.

sudo pip3 install glances

Verify the installation by checking the Glances build:

glances --version

Example output:

Glances v3.3.1.1 with PsUtil v5.9.4
Log file: /home/joshua/.local/share/glances/glances.log

Step 3: Back Up Glances Configuration File

Before you continue to modify the default configuration settings of Glances on a Debian system, one can make changes to the configuration file located at /usr/local/share/doc/glances/glances.conf. However, it is important to back up the original configuration file before making any changes. This can be done by creating a copy of the file in a different location, such as using the command “cp /usr/local/share/doc/glances/glances.conf /usr/local/share/doc/glances/glances.conf.bak”.

Once a backup of the original configuration file has been made, you can then open the file using a text editor and make the desired changes.

Additional Commands & Tips

Glances Color-Coded Alters Explained

Color-coded alerts to indicate the status of various system resources. The colors used in the alerts can indicate whether a resource is normal, a warning, or critical.

  1. GREEN: OK (good)
  2. BLUE: CAREFUL (attention)
  3. VIOLET: WARNING (alert)
  4. RED: CRITICAL (critical)

The default threshold levels for the various system resources in Glances are as follows:

  • CPU usage: The normal threshold is set at 80%, the warning threshold is set at 90%, and the critical threshold is set at 95%.
  • Memory usage: The normal threshold is set at 80%, the warning threshold is set at 90%, and the critical threshold is set at 95%.
  • Network usage: The normal threshold is set at 1000Kbps, the warning threshold is set at 5000Kbps, and the critical threshold is set at 10000Kbps.

It’s worth noting that these thresholds are customizable, and users can adjust them to suit their needs and system environment better.

See also
How to Install Wine on Linux Mint 21 or 20

The next step is to open the main configuration file, located at /usr/local/share/doc/glances/glances.conf, using a text editor. One way to do this is by using the nano text editor. You can open the file by running the command.

sudo nano /usr/local/share/doc/glances/glances.conf

When you open the main configuration file, /usr/local/share/doc/glances/glances.conf, using a text editor, you can view and modify various settings for the color-coded alters.

Example:

Once you have located the settings options in the configuration file, you can change them by adjusting the numbers. Be mindful that the default values are usually acceptable for most user setups, so you should only edit them if you strongly disagree with the values. After making the changes, you can save the file by pressing “CTRL+O” and exit the text editor by pressing “CTRL+X.” This will ensure that your changes are saved and applied to the Glances configuration.

Glances Terminal Command Options

Here are ten quick examples of Glances terminal commands that may be useful in your day-to-day operations with Glances.

Start Glances in terminal mode.

glances

Start Glances in web server mode.

glances -w

Start Glances in CSV output mode.

glances -C

Start Glances in JSON output mode.

glances -J

Display system information for a specific process by name.

glances -p <process_name>

Display information for a specific process by PID.

glances -P <PID>

Display information for a specific process by the user.

glances -u <user_name>

Display information for a specific process by name and sort by CPU usage.

glances -p <process_name> --sort-by cpu_percent

Start Glances in quiet mode.

glances -q

Help on Glance’s command line options.

glances --help

These are just a few examples of the many commands and options available to customize Glances.

Run Glances in Web Browser

With Glances, you can monitor your system performance and resource usage in a web browser of your choice without the need to install additional dependencies. To start the Glances web interface, run the following command in the terminal.

glances -w

When you run the command “glances -w” to initiate the web interface feature, you may see a message in the terminal that says, “Glances Web User Interface started on http://0.0.0.0:61208” This message might be confusing because it shows the IP address “0.0.0.0” instead of the actual IP of your server. This is because the IP address “0.0.0.0” is a placeholder that means “all available IP addresses on the host,” this way, you can access the web interface from any device on the same network. You can access the web interface by replacing “0.0.0.0” with the server’s IP address and the same port number, 61208.

Now set a password for the Glances web-based monitor; you can use the following command.

glances --web-password=yourpassword

Note that you will need to replace ‘your password’ with the password you want to set. This will enable password protection for the web interface and prompt users to enter the password before accessing the web interface.

Access the Glances web interface in a browser; you can enter the IP address of the server running Glances and the default port 61208 in the address bar of your web browser. For example: “http://192.168.1.100:61208” This will open the web interface in your browser, where you can monitor your system performance and resource usage.

http://<ip address>:61209

To keep Glances running in the background on your primary client, you can use the following command:

glances -w &

By running the command “glances &, “you have started the Glances process in the background, but it is still attached to the terminal. To detach the process from the terminal, you can use the “disown” command as follows:

disown %1

This will remove the process from the shell’s job control and make it run independently of the terminal. This way, even if you close the terminal, the Glances process will continue running in the background.

See also
How to Install PHP 8.2, 8.1, 8.0, or 7.4 on Debian 11 or 10

You can use the following command to stop the Glances process from running in the background.

pkill -f glances

This command will kill all active Glances processes running in the background. Please be aware that this command will also kill any other processes running in the background that contain the string “glances” in their command.

Run Glances Client Mode

Glances’s client-server architecture is an important feature of Glances, which allows you to monitor multiple remote servers from a central location. With this feature, you can run Glances on multiple servers and connect them to a primary client. However, it is important to note that Glances must be installed on all servers you want to monitor.

Start Glances in server mode on the server machine by running the command.

glances -s <ip:port>

For example, if the server’s IP address is 192.168.1.100 and the port is 61208.

glances -s 192.168.1.100:61208

Start Glances in client mode on the client machine by running the command.

glances -c <ip:port>

For example, if the server’s IP address is 192.168.1.100 and the port is 61208.

glances -c 192.168.1.100:61208

Glances will connect to the server and display real-time information about the server’s system performance and resource usage.

Note: The IP address and port of the server can be found by checking the output of the command “glances -s ip:port” executed on the server machine.

For example, you can also use the –client-password option to connect with a password.

glances --client-password=<your_password> -c <ip:port>

This way, you can securely monitor the performance of multiple systems from a central location.

Update Glances with PIP3

This command will check for the latest version of Glances and upgrade the package if a newer version is available. It’s also a good practice to run this command within a virtual environment to prevent conflicts with other installed packages.

pip3 install --upgrade glances
pip3 install --upgrade psutil

The command “pip3 install –upgrade glances” will update the program’s main components. However, for a more comprehensive update, it is recommended to run the following command.

pip3 list --outdated

This command will list all the outdated packages, and you can update them by running the command with the package name.

pip3 install <package_name> --upgrade

This will ensure that all the dependencies and packages associated with Glances are updated to the latest version.

Remove (Uninstall) Glances

To remove Glances, you can use the following command.

pip3 uninstall glances

Alternatively, you can run this command instead.

pip3 remove glances

This will remove the Glances package and all its dependencies from your system.

If you installed Glances using a virtual environment, you can activate the virtual environment first and then use the command above.

It’s also a good practice to check the configuration files and remove any additional files or folders created during the Glances installation. You can check the installation path by running the command.

pip3 show glances

This command will show the package’s location, and you can remove the associated files.

Please note that uninstalling Glances will remove all the data and configuration you set during the installation. To keep this data, you should back it up before uninstalling the program.

Conclusion

Installing Glances on a Debian system is a simple process. Once installed, Glances provides real-time information about the system’s resources, including CPU, memory, and network usage, displayed in a terminal window. The tool also provides color-coded alerts to indicate the status of various system resources, making it easy for users to identify and address any potential issues with their system quickly. Glances helps monitor and manage a system’s resources on Debian and other platforms.

Leave a Comment

Share to...