Compiling GoAccess
People often ask to have packages installed on the shared server. Installing anything globally on a shared server is undesirable for reasons I won't get into. Instead, let's compile a package from it's source and install it in our home folder.
Get The Source Code
The source code for popular packages is usually easy to find. It may be on the developer's website or available in a public git repository like GitHub.
We are going to install GoAccess, which is a tool to parse ugly server access logs into a pretty report.
I do all my compiling in a single folder called sourcecache
to keep things neat. cd
into the folder you'll be compiling
in and download the source. The GoAccess website provides a link to
download the source as a tarball.
$ mkdir ~/sourcecache
$ cd ~/sourcecache
$ curl -O https://tar.goaccess.io/goaccess-1.4.1.tar.gz
Unpack It
Expand the .tar.gz and cd
into the folder containing the
source code.
$ tar -xzf goaccess-1.4.1.tar.gz
$ cd goaccess-1.4.1
Compiling The Source Code
The steps of compiling are configure
, make
, make test
, and make install
.
Sometimes steps are unnecessary or not implemented. make test
(sometimes make check
) is a good habit, but often skipped.
First read over the installation instructions. Then take a look at the configuration help.
$ less INSTALL
$ ./configure --help
Configure
The goal is to install the package somewhere we have write-access.
Consensus is to install into ~/.local/
. That will be the PREFIX.
OpenSSL is widely used so if it's an option to compile with OpenSSL support then do it.
$ ./configure --prefix=$HOME/.local --with-openssl
If it configures without any errors it's ready to make.
Make && Make Install
We'll make it and install it all at once. make
compiles
the files and make install
moves them into
~/.local/.
$ make && make install
Now the goaccess
binary should be at ~/.local/bin/goaccess.
Try the version and help command to verify that it was installed.
$ ~/.local/bin/goaccess --version
GoAccess - 1.4.1.
For more details visit: https://goaccess.io/
Copyright (C) 2009-2020 by Gerardo Orellana
Build configure arguments:
--with-openssl
Real-Time Report
With goaccess installed it's time to use it. Access logs are stored at /logs/example_user/access.log in the COMBINED format.
Start a real-time report with the command:
$ goaccess /logs/example_user/access.log \
-o ~/public_html/access-report.html --log-format=COMBINED --real-time-html
View the report at http://example.com/access-report.html. Access the site in another browser window and you should see the report update automatically.

Considerations
Reports should be protected or removed so that they aren't public.
Long running processes will be killed so the real-time report can't be left running indefinitely.
Uninstall
GoAccess can be uninstalled by going to the source folder and running
the make uninstall
command. make uninstall
isn't always implemented, in which case, you would have to delete the
files yourself.
GoAccess does support the uninstall command.
$ cd ~/sourcecache/goaccess-1.4.1/
$ make uninstall