Glances is a cross-platform monitoring tool that provides a real-time overview of system resources such as CPU, memory, disk I/O, and network activity. In this guide, we will walk you through the installation of Glances on Ubuntu 22.04. Whether you are deploying it on a local server or using a Windows VPS UK, this tutorial covers all the necessary steps.
Step 1: Update Your System
Before installing Glances, ensure your system is up to date. Run the following commands:
sudo apt update && sudo apt upgrade -y
Keeping your system updated is crucial for security and performance, whether you're setting it up locally or on a VPS Windows Servers platform.
Step 2: Install Python and Pip
Glances is written in Python, so you need to install Python and pip. You can do this by running:
sudo apt install python3 python3-pip -y
Step 3: Install Glances
You can install Glances using pip with the following command:
sudo pip3 install glances
This command will download and install Glances along with its dependencies.
Step 4: Run Glances
After installation, you can run Glances using the following command:
glances
Glances will start and you will see a terminal dashboard displaying real-time system metrics.
Step 5: Running Glances as a Web Server (Optional)
You can also run Glances in web server mode to access it from a web browser. To do this, use the following command:
glances -w
By default, Glances will run a web server on port 61208. Open your web browser and navigate to:
http://your_server_ip:61208
You should see the Glances web interface.
Step 6: Configure Glances to Start on Boot (Optional)
If you want Glances to start automatically at boot, you can create a systemd service. Create a new service file:
sudo nano /etc/systemd/system/glances.service
Add the following content to the file:
[Unit]
Description=Glances Service
After=network.target
[Service]
ExecStart=/usr/local/bin/glances -w
Restart=always
User=root
[Install]
WantedBy=multi-user.target
Save and exit the file, then enable and start the Glances service:
sudo systemctl enable glances
sudo systemctl start glances