In this tutorial, we'll setup Glances Web Mode on Ubuntu 24.04 server.
Introduction
Keeping our servers monitored in real time is essential for reliability and performance. Instead of relying on heavy dashboards or complex agents, Glances gives us a lightweight, web-based monitoring interface that displays system metrics like CPU, memory, disk, network, and running processes — all in a single view.
In this guide, we’ll set up Glances Web Mode on Ubuntu 24.04, run it securely behind Apache, protect it using Basic Authentication, and enable HTTPS with Let’s Encrypt (Certbot) for encrypted access.
Prerequisites
Before we begin, ensure we have the following:
- An Ubuntu 24.04 on dedicated server or KVM VPS.
- Basic Linux Command Line Knowledge.
- A domain pointing A DNS record to server IP.
Set Up Glances Web Mode on Ubuntu 24.04
Step 1: Update and Upgrade the Server
Always start by updating the system packages to ensure we’re using the latest stable versions.
sudo apt update && sudo apt upgrade -y
Step 2: Install Python, Pip, and Venv
Ubuntu 24.04 prevents global pip installations for security reasons. So we’ll install Python and create an isolated environment for Glances.
sudo apt install python3 python3-pip python3-venv -y
Step 3: Create and Activate a Virtual Environment
Create a working directory for Glances and activate a Python virtual environment inside it.
mkdir ~/glances && cd ~/glances
python3 -m venv venv
source venv/bin/activate
The (venv) prefix in your terminal confirms that the virtual environment is active.
Step 4: Install Glances
Now install Glances inside this virtual environment:
pip install glances fastapi uvicorn jinja2
Verify installation:
glances -V
If the version appears, installation was successful.
Step 5: Install Optional Dependencies
To enhance Glances with sensor and temperature data, install the recommended packages:
sudo apt install lm-sensors python3-psutil smartmontools -y
Detect sensors:
sudo sensors-detect
Answer YES to all prompts.
You can test disk temperature (using SMART) with:
sudo smartctl -A /dev/sda | grep -i temperature
Step 6: Start Glances in Web Mode
Now start the Glances web dashboard:
glances -w
You’ll see:
Glances Web User Interface started on http://0.0.0.0:61208/
Check it in your browser:
http://<server_ip>:61208
You’ll get a real-time dashboard showing CPU, memory, disk, and network usage.
Step 7: Create a Systemd Service for Glances
We’ll make Glances run automatically at startup.
sudo nano /etc/systemd/system/glances-web.service
Paste:
[Unit]
Description=Glances Web Interface
After=network.target
[Service]
User=root
WorkingDirectory=/root/glances
ExecStart=/root/glances/venv/bin/glances -w
Restart=on-failure
[Install]
WantedBy=multi-user.target
Save and close.
Now enable and start it:
sudo systemctl daemon-reload
sudo systemctl enable glances-web
sudo systemctl start glances-web
Check the status:
sudo systemctl status glances-web
If it says active (running), it’s working.
Step 8: Install and Configure Apache
Install Apache web server:
sudo apt install apache2 -y
sudo systemctl enable apache2
sudo systemctl start apache2
Enable the required modules:
sudo a2enmod proxy proxy_http rewrite headers auth_basic
sudo systemctl restart apache2
Step 9: Create an Apache Virtual Host for Glances
Create a dedicated Apache configuration file:
sudo nano /etc/apache2/sites-available/glances.conf
Paste the following configuration:
<VirtualHost *:80>
ServerName glances.yourdomain.com
ServerAdmin admin@yourdomain.com
# Proxy to Glances
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:61208/
ProxyPassReverse / http://127.0.0.1:61208/
# Authentication
<Location />
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /etc/apache2/.glances_htpasswd
Require valid-user
</Location>
# Security Headers
Header always set X-Content-Type-Options "nosniff"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-XSS-Protection "1; mode=block"
ErrorLog ${APACHE_LOG_DIR}/glances_error.log
CustomLog ${APACHE_LOG_DIR}/glances_access.log combined
</VirtualHost>
Replace glances.yourdomain.com
with your domain name.
Step 10: Create HTTP Basic Authentication
Install Apache utilities and create a password file:
sudo apt install apache2-utils -y
sudo htpasswd -c /etc/apache2/.glances_htpasswd admin
Enter a strong password when prompted.
This will create /etc/apache2/.glances_htpasswd
with user admin.
Step 11: Enable the Glances Site and Reload Apache
Enable the configuration:
sudo a2ensite glances.conf
sudo systemctl reload apache2
Disable the default site if you prefer Glances to run on port 80:
sudo a2dissite 000-default.conf
sudo systemctl reload apache2
Step 12: Secure the Dashboard with HTTPS
Install Certbot and its Apache plugin:
sudo apt install certbot python3-certbot-apache -y
Obtain and install a free SSL certificate:
sudo certbot --apache -d glances.yourdomain.com
Certbot automatically modifies your Apache config for HTTPS and sets up auto-renewal.
To test renewal:
sudo certbot renew --dry-run
Step 13: Adjust the Firewall
Allow Apache and HTTPS traffic:
sudo ufw allow 'Apache Full'
sudo ufw reload
Step 14: Access the Glances Dashboard Securely
Now visit:
https://glances.yourdomain.com
You’ll be prompted for your username and password.
After login, you’ll see your live Glances dashboard served securely via HTTPS.
Step 15: Optional – Remote Monitoring
If we want to monitor another system with Glances running, connect remotely:
glances -c <server_ip>
This pulls live stats from the remote Glances instance.
Why We Use This Setup
- Secure Access – Protected with HTTP Basic Auth and HTTPS.
- No Port Exposure – Runs behind Apache reverse proxy.
- Modern Compliance – Works with Ubuntu 24.04’s managed Python environment.
- Automated SSL – Let’s Encrypt keeps your dashboard encrypted and up to date.
- Lightweight Monitoring – Minimal CPU and memory usage even on small VPS instances.
Final Thoughts
With this configuration, our Ubuntu 24.04 server gains a powerful, secure, real-time monitoring dashboard using Glances — fully integrated with Apache and protected with HTTPS.
It’s fast, easy to maintain, and production-safe — perfect for VPS, dedicated servers, or internal infrastructure monitoring.