How to Install Countly Community Edition on Linux Mint
In this tutorial, we will be installing Countly Community Edition on Linux Mint. Countly is a free, open-source, and real-time analytics platform that helps businesses track user behavior and gain insights into their applications' performance.
Prerequisites
- A Linux Mint system with a user account having sudo privileges.
- A web server (such as Apache or Nginx) installed and running on the system.
- A MongoDB database installed and running on the system.
Step 1: Install Node.js
Countly requires Node.js to be installed on the system. If you don't have it installed yet, you can install it by following these steps:
Using apt Package Manager
Open the terminal and run the following commands:
$ sudo apt update
$ sudo apt install nodejs
Using nvm (Node Version Manager)
If you prefer to use nvm to manage Node.js versions, you can install it by running the following command:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
Then, close and re-open the terminal, and install the latest LTS version of Node.js by running:
$ nvm install --lts
Step 2: Install Countly
To install Countly, follow these steps:
Step 2.1: Download Countly
Download the latest Countly version from the official website using the wget command:
$ wget https://codeload.github.com/Countly/countly-server/tar.gz/master -O countly.tar.gz
Extract the downloaded archive to the /opt directory:
$ sudo tar -xzvf countly.tar.gz -C /opt/
Rename the extracted directory:
$ sudo mv /opt/countly-server-master /opt/countly
Set the correct permissions for the Countly directory:
$ sudo chown -R www-data:www-data /opt/countly
Step 2.2: Install Countly dependencies
Navigate to the Countly directory:
$ cd /opt/countly
Install the Countly dependencies by running the following command:
$ npm install
Step 2.3: Configure Countly
Copy the example production configuration file to the main configuration file:
$ sudo cp config.sample.js config.js
Edit the configuration file to reflect your environment:
$ sudo nano config.js
Change the following settings:
- Set
dbs.mongodb.hosttolocalhostif you're running MongoDB on the same server. Otherwise, set it to the MongoDB server's IP address or domain. - Set
appNameto any name you want to give your application. - Set
ssl.enabletofalseif you want to access Countly over HTTP. Set it totrueif you want to access Countly over HTTPS.
Save the configuration file and exit the text editor.
Step 2.4: Start Countly
Start Countly by running the following command:
$ npm run start
Countly will start on port 6001 by default. If you want to change the port, edit the frontend > port setting in the config.js file.
Step 3: Access Countly
To access Countly, open your web browser and navigate to:
http://localhost:6001
If you set ssl.enable to true in the config.js file, access Countly over HTTPS:
https://localhost:6001
Conclusion
In this tutorial, you learned how to install Countly Community Edition on Linux Mint. With Countly, you can track user behavior and get insights into your application's performance.