How To Install Darkstat on Rocky Linux 9
In this tutorial, we will show you how to install Darkstat on Rocky Linux 9. For those of you who didn’t know, Darkstat is an open-source, web-based network traffic analyzer that captures and analyzes network traffic. Darkstat provides useful insights into network usage, network top talkers, and traffic breakdown by protocol. In addition, Darkstat offers various features for traffic filtering and statistics generation.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Darkstat open-source network traffic analyzer on Rocky Linux. 9.
Prerequisites
- A server running one of the following operating systems: Rocky Linux 9.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Darkstat.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Darkstat on Rocky Linux 9
Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:
sudo dnf check-update sudo dnf update
Step 2. Installing Darkstat Linux Network Traffic Analyzer on Rocky Linux 9.
By default, Darkstat is available on the Rocky Linux 9 base repository. Now we install the latest version of Darkstar using dnf
the command:
sudo dnf install darkstat
Step 3. Configuring Darkstat.
After installing Darkstat, we need to configure it to start automatically and capture traffic data. By default, Darkstat listens on port 666, and the network interface is set to eth0. We can modify these settings by editing the configuration file:
nano /etc/darkstat/init.cfg
Change the following lines:
START_DARKSTAT=yes INTERFACE="-i eth0" DIR="/var/lib/darkstat" PORT="-p 666" BINDIP="-b 0.0.0.0" DAYLOG="--daylog darkstat.log"
Save and close the file, then restart the Darkstat service to apply the changes:
sudo systemctl restart darkstat
Step 4. Configure Firewall.
If you’re using Firewalld on RHEL-based distros, you can do the following:
sudo firewall-cmd --zone=public --add-port=666/tcp sudo firewall-cmd --reload
Step 5. Accessing Darkstat Web Interface.
Once successfully installed, open your web browser and access Darkstat using the URL http://your-IP-address:666
. You will be redirected to the following page:
Step 6. Managing Darkstat from the Command Line.
Darkstat provides various command-line options to manage and configure the service. Here are some useful Darkstat command-line options:
- Setting the listening interface.
By default, Darkstat listens on all available network interfaces. However, you can specify a specific interface to listen on by using the -i
option. For example, to listen on the eth0
interface, use the following command:
sudo darkstat -i eth0
- Specifying the listening port.
By default, Darkstat listens on port 667. You can specify a different port by using the -p
option. For example, to listen on port 8080, use the following command:
sudo darkstat -p 8080
- Enabling traffic filtering.
Darkstat provides a feature to filter traffic based on various criteria such as source IP address, destination IP address, port number, and protocol. You can enable traffic filtering by using the -f
option followed by the filter criteria. For example, to filter traffic originating from IP address 192.168.77.21, use the following command:
sudo darkstat -f "src net 192.168.7.21"
For additional usage options, read through the Darkstat manpage:
man darkstat
Congratulations! You have successfully installed Darkstat. Thanks for using this tutorial for installing Darkstat web analytics on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Darkstat website.