How to install GoAccess on CentOS 7

Install EPEL repository

Although we are going to install GoAccess from source, we need some dependencies that some of them is not provided by the official repository. So we need to install Epel release first with the command below:

yum install epel-release

After the installation process is finished, execute the following command to update the repositories list:

yum repolist

Install dependencies

As the GoAccess program is written in C language we need to install the following packages in order to compile it from the source:

yum install ncurses-devel gcc

Installing the following packages is recommended:

yum install geoip-devel tokyocabinet-devel

Download and Install the GoAccess

You can download the latest stable version of GoAccess from the official website: www.goaccess.io
We are going to install version 1.2 which is the latest at the time of writing this article:

wget http://tar.goaccess.io/goaccess-1.2.tar.gz

Extract the “tar” file using the command below:

tar xvzf goaccess-1.2.tar.gz

Configure and make the source easily by executing the following commands one by one:

cd goaccess-1.2
./configure --enable-utf8 --enable-geoip=legacy
make && make install

Create a Symlink of GoAccess binary file in your executable path using the command below:

ln -s /usr/local/bin/goaccess /usr/bin/goaccess

Using the GoAccess

GoAccess has many options to analyze your log files, the most simple way you can use to see your log file with GoAccess is below (we use boot.log as an example):

goaccess /var/log/boot.log

You can see the whole flags and capabilities of GoAccess with the command below:

goaccess --help

Get the HTML output

If you want to get the HTML output from the GoAccess you need a web server so you can see your HTML file with it from anywhere,
We are going to install Apache as our web server:

yum install httpd

After the installation process is finished, execute the following commands to start your Apache service and make it run at startup:

systemctl start httpd
systemctl enable httpd

Now you can make GoAccess save, the output of a log file into an HTML file.
For example, using the following command will create an analyzed HTML file from the Apache access log and place it in Apache’s default document root:

goaccess /var/log/httpd/access_log --log-format=COMBINED -a -o /var/www/html/report.html

Now you can open your browser, Enter your IP address or your Domain name and add “/report.html” in the end to see your HTML output.

Was this answer helpful? 0 Users Found This Useful (0 Votes)