How to Install Countly Server on CentOS 7

Countly is an open source analytics and marketing platform for web and mobile applications. It supports real-time data updates and uses a plugin-based architecture for extensibility. This guide will walk you through the process of installing the Countly server on a CentOS 7 machine.

Prerequisites

  • A 64-bit CentOS 7 server instance with a minimum of 2 GB RAM.
  • A user with sudo privileges.

Step 1: Update the System

Begin by logging in as the sudo user and updating your CentOS system packages using the commands below:

sudo yum -y install epel-release
sudo yum -y update
sudo shutdown -r now

Once the server reboots, log back in with your sudo credentials to continue the setup process.

Step 2: Install the Countly Server

Use the following command to install Countly and all required dependencies. The root password will be requested:

su -c "wget -qO- http://c.ly/install | bash"

Step 3: Open Firewall Ports

Allow necessary ports for HTTP, HTTPS, and SMTP through the system firewall using the following commands:

sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --add-service=smtp --permanent
sudo firewall-cmd --reload

To check Countly’s status, run:

You can also manually start or stop Countly:

sudo countly start
sudo countly stop

Step 4: Enable HTTPS with Let’s Encrypt

Before proceeding, ensure your domain or subdomain points to your server’s IP. Begin by installing Certbot:

sudo yum -y install certbot

Replace countly.example.com with your actual domain and <user_name> with your Linux username in the following command:

sudo certbot certonly --webroot -w /home/<user_name>/countly/frontend/express/public -d countly.example.com

Once the certificates are generated, enhance security by generating Diffie-Hellman parameters:

sudo openssl dhparam -outform pem -out /etc/letsencrypt/live/countly.example.com/dhparam2048.pem 2048

Next, update the default Nginx configuration by editing the following file:

sudo nano /etc/nginx/conf.d/default.conf

Replace the contents with this configuration:

server {
    listen 80;
    return 301 https://$host$request_uri;
}
server {
    listen   443;
    server_name  localhost;
    access_log  off;
    ssl on;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ciphers 'kEECDH+ECDSA+AES128 kEECDH+ECDSA+AES256 kEECDH+AES128 kEECDH+AES256 kEDH+AES128 kEDH+AES256 DES-CBC3-SHA +SHA !aNULL !eNULL !LOW !kECDH !DSS !MD5 !EXP !PSK !SRP !CAMELLIA !SEED';
    ssl_session_cache builtin:1000 shared:SSL:10m;
    ssl_stapling on;

    ssl_dhparam /etc/letsencrypt/live/countly.example.com/dhparam2048.pem;
    ssl_certificate /etc/letsencrypt/live/countly.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/countly.example.com/privkey.pem;

    location = /i {
        proxy_pass http://127.0.0.1:3001;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    }
    
    location ^~ /i/ {
        proxy_pass http://127.0.0.1:3001;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    }

    location = /o {
        proxy_pass http://127.0.0.1:3001;
    }
    
    location ^~ /o/ {
        proxy_pass http://127.0.0.1:3001;
    }

    location / {
        proxy_pass http://127.0.0.1:6001;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

To finalize everything, restart both Countly and Nginx services:

sudo countly restart
sudo systemctl restart nginx

You can now access your Countly dashboard at:

https://countly.example.com

On first access, you’ll be prompted to set up an administrator account. After that, you can begin adding applications for data collection and monitoring.

Conclusion

Countly is a powerful, open-source platform for analyzing user behavior across web and mobile apps. Its real-time data updates and modular plugin architecture make it a flexible and extensible choice for developers and marketers alike. With the successful installation and configuration on CentOS 7, you are now equipped to take full advantage of Countly’s comprehensive analytics capabilities.

Source: vultr.com

Create a Free Account

Register now and get access to our Cloud Services.

Posts you might be interested in:

Moderne Hosting Services mit Cloud Server, Managed Server und skalierbarem Cloud Hosting für professionelle IT-Infrastrukturen

Secure HTTPS Setup on Arch Linux with Apache or Nginx

Security, Tutorial

Linux file permissions with this comprehensive guide. Understand how to utilize chmod and chown commands to assign appropriate access rights, and gain insights into special permission bits like SUID, SGID, and the sticky bit to enhance your system’s security framework.