Knowledgebase

How to Install Countly Analytics on CentOS Print

  • 0

Countly is an open source web/mobile analytics and marketing platform. It comes with numerous features for collecting data from web, mobile, or game applications. It provides real time data updates and includes a plug-in based system. In this tutorial we will install Countly server on CentOS 7.

Prerequisites

  • A Rcs 64-bit CentOS 7 server instance with at least 2 GB RAM.
  • A sudo user.

Step 1: Perform a system update

Before installing any packages on the CentOS server instance, it is recommended to update the system. Login using the sudo user and run the following commands to update the system.

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

Once the system has finished rebooting, log in again as the sudo user and proceed to the next step.

Step 2: Install Countly server

Countly server can be installed directly using the following command.

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

You will need to provide your root password here. The above command will download and install all of the required dependencies as well as the Countly server software.

Step 3: Configure firewall

Allow the required ports through the system firewall.

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

You can check the status of the application using following command.

sudo countly status

Use the following commands to start/stop the Countly server as needed.

sudo countly start
sudo countly stop

Step 4: Secure server with Let's Encrypt SSL

Before installing Let's Encrypt, you must have a domain or subdomain pointed towards your IP address. Run the following commands to install Certbot on your system.

sudo yum -y install certbot

Initiate the Certbot script to obtain SSL certificates for you. Make sure to replace all occurrences of countly.example.com with your actual domain name. Also replace <user_name> with the current username.

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

The above command will ask for your email address and will generate the SSL certificates for countly.example.com.

Generate strong Diffie-Hellman parameters using following command.

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

Now you will need to modify the default Nginx configuration so that your website can be accessible using HTTPS. Run the following command to edit the default Nginx configuration file.

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

Replace the existing configuration with the following.

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;
    }
}

Now restart the Countly server and the Nginx web server.

sudo countly restart
sudo systemctl restart nginx

The installation of Countly Server is now finished, you can access the dashboard on the following address.

https://countly.example.com

You will be asked to create an administrator account as soon as you open the above link in browser. Once the administrator account has been created, you will be asked to add a new application into Countly for data collection. Enjoy your new Countly server!

Countly is an open source web/mobile analytics and marketing platform. It comes with numerous features for collecting data from web, mobile, or game applications. It provides real time data updates and includes a plug-in based system. In this tutorial we will install Countly server on CentOS 7. Prerequisites A Rcs 64-bit CentOS 7 server instance with at least 2 GB RAM. A sudo user. Step 1: Perform a system update Before installing any packages on the CentOS server instance, it is recommended to update the system. Login using the sudo user and run the following commands to update the system. sudo yum -y install epel-release sudo yum -y update sudo shutdown -r now Once the system has finished rebooting, log in again as the sudo user and proceed to the next step. Step 2: Install Countly server Countly server can be installed directly using the following command. su -c "wget -qO- http://c.ly/install | bash" You will need to provide your root password here. The above command will download and install all of the required dependencies as well as the Countly server software. Step 3: Configure firewall Allow the required ports through the system firewall. 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 You can check the status of the application using following command. sudo countly status Use the following commands to start/stop the Countly server as needed. sudo countly start sudo countly stop Step 4: Secure server with Let's Encrypt SSL Before installing Let's Encrypt, you must have a domain or subdomain pointed towards your IP address. Run the following commands to install Certbot on your system. sudo yum -y install certbot Initiate the Certbot script to obtain SSL certificates for you. Make sure to replace all occurrences of countly.example.com with your actual domain name. Also replace with the current username. sudo certbot certonly --webroot -w /home//countly/frontend/express/public -d countly.example.com The above command will ask for your email address and will generate the SSL certificates for countly.example.com. Generate strong Diffie-Hellman parameters using following command. sudo openssl dhparam -outform pem -out /etc/letsencrypt/live/countly.example.com/dhparam2048.pem 2048 Now you will need to modify the default Nginx configuration so that your website can be accessible using HTTPS. Run the following command to edit the default Nginx configuration file. sudo nano /etc/nginx/conf.d/default.conf Replace the existing configuration with the following. 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; } } Now restart the Countly server and the Nginx web server. sudo countly restart sudo systemctl restart nginx The installation of Countly Server is now finished, you can access the dashboard on the following address. https://countly.example.com You will be asked to create an administrator account as soon as you open the above link in browser. Once the administrator account has been created, you will be asked to add a new application into Countly for data collection. Enjoy your new Countly server!

Was this answer helpful?
Back

Powered by WHMCompleteSolution