UbuntuUbuntu Based

How To Install GoAccess on Ubuntu 24.04 LTS

Install GoAccess on Ubuntu 24.04

In the ever-evolving landscape of web server management, having access to real-time log analysis is crucial for maintaining optimal performance and security. GoAccess, a powerful and versatile web log analyzer, offers system administrators and website owners an invaluable tool for monitoring and understanding their web traffic. This comprehensive guide will walk you through the process of installing GoAccess on Ubuntu 24.04 LTS, enabling you to harness its capabilities for in-depth log analysis and visualization.

Ubuntu 24.04 LTS, the latest long-term support release, provides a stable and secure foundation for running GoAccess. By combining the robustness of Ubuntu with the analytical prowess of GoAccess, you’ll be well-equipped to gain actionable insights from your web server logs. Whether you’re managing a small personal website or overseeing a large-scale enterprise application, this tutorial will help you set up GoAccess efficiently and effectively.

Prerequisites

  • A server running one of the following operating systems: Ubuntu and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • Basic familiarity with the terminal and command-line interface.
  • 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.
  • An Ubuntu 24.04 system with root access or a user with sudo privileges.

Install GoAccess on Ubuntu 24.04

Step 1. Updating the Package Repository.

Keeping your system up-to-date is a fundamental best practice in Linux system administration. Before installing any new software, it’s crucial to ensure that all existing packages are current. This step helps prevent potential conflicts and ensures compatibility with the latest security patches. To update your system, open a terminal and run the following commands:

sudo apt update
sudo apt upgrade

The first command refreshes the package lists, while the second upgrades all installed packages to their latest versions. You may be prompted to confirm the upgrades; if so, type ‘Y’ and press Enter to proceed.

Step 2. Installing GoAccess.

While Ubuntu’s default repositories offer a wide range of software, they may not always contain the most recent version of GoAccess. To ensure you’re installing the latest release with all its features and improvements, it’s recommended to add the official GoAccess repository.

First, import the GPG key used to sign the packages:

wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key add -

Next, add the repository to your system’s sources list:

echo "deb http://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list

With the repository added, you’re now ready to install GoAccess. First, update your package list to include the new repository:

sudo apt update

Then, install GoAccess using the following command:

sudo apt install goaccess

After the installation completes, it’s important to verify that GoAccess was installed correctly and is accessible from the command line. To do this, run:

goaccess --version

This command should display the version information for GoAccess, confirming a successful installation. You’ll see output similar to the following:

GoAccess - 1.X.X
Built with:
GeoIP support
UTF-8 support
Memory mapping
TLS/SSL support

Step 5. Basic Configuration.

GoAccess offers a high degree of customization to suit various needs. The configuration file allows you to set default behaviors and customize the tool’s output. To locate the default configuration file, run:

goaccess --dcf

This command will display the path to the default configuration file, typically /etc/goaccess/goaccess.conf.

To begin customizing GoAccess, make a copy of this file in your home directory:

cp /etc/goaccess/goaccess.conf ~/.goaccessrc

Now you can edit this file using your preferred text editor. Some common configuration options include:

    • Setting the default log format
    • Enabling real-time HTML report generation
    • Customizing date and time formats
    • Configuring output options

For example, to set the default log format to Apache Combined Log Format, add or uncomment the following line in your configuration file:

log-format COMBINED

Step 6. Analyze Web Server Logs.

With GoAccess installed and configured, you’re ready to start analyzing your web server logs. GoAccess supports various log formats, including Apache, Nginx, and Amazon S3, among others. To analyze an Apache access log and generate an HTML report, use a command similar to this:

goaccess /var/log/apache2/access.log --log-format=COMBINED -a -o /var/www/html/report.html

This command does the following:

    • Specifies the log file to analyze (/var/log/apache2/access.log)
    • Sets the log format to COMBINED
    • Enables terminal output (-a)
    • Generates an HTML report at /var/www/html/report.html

After running this command, you can access the HTML report by navigating to http://your-server-ip/report.html in a web browser.

Congratulations! You have successfully installed GoAccess. Thanks for using this tutorial for installing the GoAccess real-time web log analyzer and interactive viewer on the Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official GoAccess website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button