How to Install GoatCounter on Windows 11

GoatCounter is a simple web analytics service that is self-hosted and lightweight. In this tutorial, we'll guide you through the steps to install GoatCounter on Windows 11.

Prerequisites

Before you can install GoatCounter on your Windows 11 machine, you need to ensure that you have the following prerequisites:

  1. Node.js installed on your machine. You can download Node.js from the official website.

  2. MySQL server installed on your machine. You can download MySQL server from the official website.

  3. Git installed on your machine. You can download Git from the official website.

Installing GoatCounter

Once you have the prerequisites installed, follow the steps below to install GoatCounter:

  1. Open Command Prompt and navigate to the directory where you want to install GoatCounter.

  2. Clone the GoatCounter repository by running the following command:

    git clone https://github.com/zgoat/goatcounter.git
    
  3. Once the repository is cloned, navigate to the cloned directory by running the following command:

    cd goatcounter
    
  4. Install the dependencies by running the following command:

    npm install
    
  5. Create a new database for GoatCounter by running the following command:

    mysql -u root -p -e "CREATE DATABASE goatcounter;"
    
  6. Create a new user for the GoatCounter database by running the following command:

    mysql -u root -p -e "CREATE USER 'goat'@'localhost' IDENTIFIED BY 'mypassword';"
    

    Replace 'mypassword' with your desired password.

  7. Grant the new user all privileges on the GoatCounter database by running the following command:

    mysql -u root -p -e "GRANT ALL PRIVILEGES ON goatcounter.* TO 'goat'@'localhost';"
    
  8. Copy the configuration file by running the following command:

    cp config_example.yml config.yml
    
  9. Edit the configuration file to match your setup by running the following command:

    notepad config.yml
    

    Replace the database settings with the following:

    db_url: mysql://goat:mypassword@localhost/goatcounter
    db_mask: 0x7FFFFFFFFFFFFFFF
    

    Replace 'mypassword' with the password you set for the 'goat' user.

  10. Start the GoatCounter server by running the following command:

    npm start
    

    You should see the server starting up and displaying the URL for accessing the GoatCounter dashboard.

  11. Access the GoatCounter dashboard by opening the URL displayed in the console.

That's it! You have successfully installed GoatCounter on your Windows 11 machine.

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!