Learn How To Install Countly Analytics on Ubuntu 16.10

January 28, 2020

Table of Contents

If you are using a different system, please check our other tutorials.

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 Ubuntu 16.10.


  • An ITWeb.Services 64-bit Ubuntu 16.10 server instance with atleast 2GB RAM.
  • A sudo user.

Step 1: Perform a system update

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

sudo apt-get update
sudo apt-get -y upgrade

Step 2: Install Countly server

Countly server can be installed directly using the following command.

sudo apt-get install unzip
su -c "wget -qO- http://c.ly/install | bash"

The above command will download and install all of the required dependencies as well as the Countly server software.

Step 3: 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 add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get -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/sites-available/default

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_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_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    location ^~ /i/ {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    location = /o {
    location ^~ /o/ {
    location / {
        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.


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!

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!