How to Install GoatCounter on Ubuntu Server Latest

In this tutorial, you will learn how to install GoatCounter, which is a simple web analytics service written in Go, on Ubuntu Server Latest.

Prerequisites

Before starting the installation, you need to make sure that:

Step 1: Download the Binary

Go to the official GoatCounter website and navigate to the downloads page. Then, copy the link to the latest version of the binary for your machine's architecture.

$ sudo apt-get update
$ sudo apt-get install wget

Use wget to download the GoatCounter binary:

$ sudo wget <link-to-goatcounter-binary>

Step 2: Install GoatCounter

Create a new directory for GoatCounter:

$ sudo mkdir /opt/goatcounter/

Move the downloaded binary to the newly created directory:

$ sudo mv goatcounter /opt/goatcounter/

Allow execution permission to the GoatCounter binary:

$ sudo chmod +x /opt/goatcounter/goatcounter

Step 3: Set Up GoatCounter

Before starting the GoatCounter service, you'll need to create a configuration file. To do so, navigate to the directory where you want to store your config file and create a new file:

$ sudo mkdir /etc/goatcounter/
$ cd /etc/goatcounter/
$ sudo touch config.yml

Now, open the config.yml file and paste in the following configuration:

listen: "localhost:8080"
db: "sqlite3:goatcounter.sqlite3"
email: "you@example.com"
from: "GoatCounter <no-reply@goatcounter.com>"
default_site: "My website"

Update the email and from values with your desired email address and sender name.

Next, navigate to the previously downloaded GoatCounter binary directory and start the service:

$ cd /opt/goatcounter/
$ sudo ./goatcounter serve /etc/goatcounter/config.yml

You should see the following output in the terminal indicating successful start-up:

Listening on http://0.0.0.0:8080/

To test that GoatCounter is running correctly, open your web browser and navigate to http://localhost:8080/. You should see the GoatCounter interface.

Conclusion

You have successfully installed GoatCounter on your Ubuntu Server Latest machine. Remember to configure your GoatCounter tracker on your website to start collecting data.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!