countly is a free and open-source product analytics. Countly provides product analytics for web, mobile, and desktop
1. Prerequisites
2. Supported Operating Systems
This guide supports installation on:
3. Installation
RHEL/CentOS/Rocky Linux/AlmaLinux
# Install EPEL repository if needed
sudo dnf install -y epel-release
# Install countly
sudo dnf install -y countly
# Enable and start service
sudo systemctl enable --now countly
# Configure firewall
sudo firewall-cmd --permanent --add-port=6001/tcp
sudo firewall-cmd --reload
# Verify installation
countly --version
Debian/Ubuntu
# Update package index
sudo apt update
# Install countly
sudo apt install -y countly
# Enable and start service
sudo systemctl enable --now countly
# Configure firewall
sudo ufw allow 6001
# Verify installation
countly --version
Arch Linux
# Install countly
sudo pacman -S countly
# Enable and start service
sudo systemctl enable --now countly
# Verify installation
countly --version
Alpine Linux
# Install countly
apk add --no-cache countly
# Enable and start service
rc-update add countly default
rc-service countly start
# Verify installation
countly --version
openSUSE/SLES
# Install countly
sudo zypper install -y countly
# Enable and start service
sudo systemctl enable --now countly
# Configure firewall
sudo firewall-cmd --permanent --add-port=6001/tcp
sudo firewall-cmd --reload
# Verify installation
countly --version
macOS
# Using Homebrew
brew install countly
# Start service
brew services start countly
# Verify installation
countly --version
FreeBSD
# Using pkg
pkg install countly
# Enable in rc.conf
echo 'countly_enable="YES"' >> /etc/rc.conf
# Start service
service countly start
# Verify installation
countly --version
Windows
# Using Chocolatey
choco install countly
# Or using Scoop
scoop install countly
# Verify installation
countly --version
Initial Configuration
Basic Configuration
# Create configuration directory
sudo mkdir -p /etc/countly
# Set up basic configuration
# See official documentation for detailed configuration options
# Test configuration
countly --version
5. Service Management
systemd (RHEL, Debian, Ubuntu, Arch, openSUSE)
# Enable service
sudo systemctl enable countly
# Start service
sudo systemctl start countly
# Stop service
sudo systemctl stop countly
# Restart service
sudo systemctl restart countly
# Check status
sudo systemctl status countly
# View logs
sudo journalctl -u countly -f
OpenRC (Alpine Linux)
# Enable service
rc-update add countly default
# Start service
rc-service countly start
# Stop service
rc-service countly stop
# Restart service
rc-service countly restart
# Check status
rc-service countly status
rc.d (FreeBSD)
# Enable in /etc/rc.conf
echo 'countly_enable="YES"' >> /etc/rc.conf
# Start service
service countly start
# Stop service
service countly stop
# Restart service
service countly restart
# Check status
service countly status
launchd (macOS)
# Using Homebrew services
brew services start countly
brew services stop countly
brew services restart countly
# Check status
brew services list | grep countly
Windows Service Manager
# Start service
net start countly
# Stop service
net stop countly
# Using PowerShell
Start-Service countly
Stop-Service countly
Restart-Service countly
# Check status
Get-Service countly
Advanced Configuration
See the official documentation for advanced configuration options.
Reverse Proxy Setup
nginx Configuration
upstream countly_backend {
server 127.0.0.1:6001;
}
server {
listen 80;
server_name countly.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name countly.example.com;
ssl_certificate /etc/ssl/certs/countly.example.com.crt;
ssl_certificate_key /etc/ssl/private/countly.example.com.key;
location / {
proxy_pass http://countly_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Apache Configuration
<VirtualHost *:80>
ServerName countly.example.com
Redirect permanent / https://countly.example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName countly.example.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/countly.example.com.crt
SSLCertificateKeyFile /etc/ssl/private/countly.example.com.key
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:6001/
ProxyPassReverse / http://127.0.0.1:6001/
</VirtualHost>
HAProxy Configuration
frontend countly_frontend
bind *:80
bind *:443 ssl crt /etc/ssl/certs/countly.pem
redirect scheme https if !{ ssl_fc }
default_backend countly_backend
backend countly_backend
balance roundrobin
server countly1 127.0.0.1:6001 check
Security Configuration
Basic Security Setup
# Set appropriate permissions
sudo chown -R countly:countly /etc/countly
sudo chmod 750 /etc/countly
# Configure firewall
sudo firewall-cmd --permanent --add-port=6001/tcp
sudo firewall-cmd --reload
# Enable SELinux policies (if applicable)
sudo setsebool -P httpd_can_network_connect on
Database Setup
See official documentation for database configuration requirements.
Performance Optimization
System Tuning
# Basic system tuning
echo 'net.core.somaxconn = 65535' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_max_syn_backlog = 65535' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Monitoring
Basic Monitoring
# Check service status
sudo systemctl status countly
# View logs
sudo journalctl -u countly -f
# Monitor resource usage
top -p $(pgrep countly)
9. Backup and Restore
Backup Script
#!/bin/bash
# Basic backup script
BACKUP_DIR="/backup/countly"
DATE=$(date +%Y%m%d_%H%M%S)
mkdir -p "$BACKUP_DIR"
tar -czf "$BACKUP_DIR/countly-backup-$DATE.tar.gz" /etc/countly /var/lib/countly
echo "Backup completed: $BACKUP_DIR/countly-backup-$DATE.tar.gz"
Restore Procedure
# Stop service
sudo systemctl stop countly
# Restore from backup
tar -xzf /backup/countly/countly-backup-*.tar.gz -C /
# Start service
sudo systemctl start countly
6. Troubleshooting
Common Issues
1. Service won't start:
# Check logs
sudo journalctl -u countly -n 100
sudo tail -f /var/log/countly/countly.log
# Check configuration
countly --version
# Check permissions
ls -la /etc/countly
2. Connection issues:
# Check if service is listening
sudo ss -tlnp | grep 6001
# Test connectivity
telnet localhost 6001
# Check firewall
sudo firewall-cmd --list-all
3. Performance issues:
# Check resource usage
top -p $(pgrep countly)
# Check disk I/O
iotop -p $(pgrep countly)
# Check connections
ss -an | grep 6001
Integration Examples
Docker Compose Example
version: '3.8'
services:
countly:
image: countly:latest
ports:
- "6001:6001"
volumes:
- ./config:/etc/countly
- ./data:/var/lib/countly
restart: unless-stopped
Maintenance
Update Procedures
# RHEL/CentOS/Rocky/AlmaLinux
sudo dnf update countly
# Debian/Ubuntu
sudo apt update && sudo apt upgrade countly
# Arch Linux
sudo pacman -Syu countly
# Alpine Linux
apk update && apk upgrade countly
# openSUSE
sudo zypper update countly
# FreeBSD
pkg update && pkg upgrade countly
# Always backup before updates
tar -czf /backup/countly-pre-update-$(date +%Y%m%d).tar.gz /etc/countly
# Restart after updates
sudo systemctl restart countly
Regular Maintenance
# Log rotation
sudo logrotate -f /etc/logrotate.d/countly
# Clean old logs
find /var/log/countly -name "*.log" -mtime +30 -delete
# Check disk usage
du -sh /var/lib/countly
Additional Resources
---
Note: This guide is part of the HowToMgr collection. Always refer to official documentation for the most up-to-date information.