Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# debian count.ly install script
#!/bin/bash
# debian count.ly install script
# by: C. Bess (github.com/cbess), 2013
# Tested on wheezy (v7.1)
set -e
if [[ $EUID -ne 0 ]]; then
echo "Please execute Countly installation script with a superuser..." 1>&2
exit 1
fi
echo "
______ __ __
/ ____/___ __ ______ / /_/ /_ __
/ / / __ \/ / / / __ \/ __/ / / / /
/ /___/ /_/ / /_/ / / / / /_/ / /_/ /
\____/\____/\__,_/_/ /_/\__/_/\__, /
http://count.ly/____/
"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#update package index
apt-get update
apt-get -y install python python-software-properties
if !(command -v apt-add-repository >/dev/null) then
apt-get -y install software-properties-common
fi
apt-get -y install build-essential python-dev || (echo "Failed to install build-essential." ; exit)
# install cElementTree (faster XML parser)
wget -N http://effbot.org/media/downloads/cElementTree-1.0.5-20051216.tar.gz
tar xzvf cElementTree* && cd cElementTree*
python setup.py install
cd ..
# build node.js dpkg, install
apt-get install g++ make checkinstall
mkdir nodejs-src && cd $_
wget -N http://nodejs.org/dist/node-latest.tar.gz
tar xzvf node-latest.tar.gz && cd node-v*
./configure
# remove the "v" in front of the version number in
# the pkg build dialog, or the pkg won't build/validate
checkinstall
dpkg -i node_*
#add mongodb repo
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' | tee /etc/apt/sources.list.d/10gen.list
#update once more after adding new repos
apt-get update
#install nginx
apt-get -y install nginx || (echo "Failed to install nginx." ; exit)
#install node.js
#apt-get -y --force-yes install nodejs || (echo "Failed to install nodejs." ; exit)
#install mongodb
apt-get -y --force-yes install mongodb-10gen || (echo "Failed to install mongodb." ; exit)
#install supervisor
apt-get -y install supervisor || (echo "Failed to install supervisor." ; exit)
#install imagemagick
apt-get -y install imagemagick
#install sendmail
apt-get -y install sendmail-bin sendmail
#install time module for node
( cd $DIR/../api ; npm install time )
#configure and start nginx
cp /etc/nginx/sites-enabled/default $DIR/config/nginx.default.backup
cp $DIR/config/nginx.server.conf /etc/nginx/sites-enabled/default
/etc/init.d/nginx start
cp $DIR/../frontend/express/public/javascripts/countly/countly.config.sample.js $DIR/../frontend/express/public/javascripts/countly/countly.config.js
#kill existing supervisor process
pkill -SIGTERM supervisord
#create supervisor upstart script and start supervisord
(cat $DIR/config/countly-supervisor.conf ; echo "exec /usr/bin/supervisord --nodaemon --configuration $DIR/config/supervisord.conf") > /etc/init/countly-supervisor.conf
#create api configuration file from sample
cp $DIR/../api/config.sample.js $DIR/../api/config.js
#create app configuration file from sample
cp $DIR/../frontend/express/config.sample.js $DIR/../frontend/express/config.js
#finally start countly api and dashboard
# start countly-supervisor
echo 'You can now start using count.ly on http://localhost'
@cbess

This comment has been minimized.

Copy link
Owner Author

@cbess cbess commented Sep 13, 2013

If an unclean shutdown occurs and mongo won't start:
http://docs.mongodb.org/manual/tutorial/recover-data-following-unexpected-shutdown/

execute:
su -s /bin/bash -c "mongod --repair --dbpath /var/lib/mongodb/" mongodb

@truonguit2010

This comment has been minimized.

Copy link

@truonguit2010 truonguit2010 commented Dec 12, 2014

Can you change this file to support Centos 6.5?

Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile

  • base: mirrors.123host.vn
  • epel: mirrors.123host.vn
  • extras: mirrors.vonline.vn
  • updates: mirrors.vonline.vn
    No package software-properties-common available.
    Error: Nothing to do

Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile

  • base: mirrors.123host.vn
  • epel: mirrors.123host.vn
  • extras: mirrors.vonline.vn
  • updates: mirrors.vonline.vn
    Package python-2.6.6-52.el6.x86_64 already installed and latest version
    No package python-software-properties available.
@Afondevi

This comment has been minimized.

Copy link

@Afondevi Afondevi commented Jul 23, 2018

@cbess
Hello ! Can you tell me if it work with debian 9 please ? you can save my day, month maybe year :) Thanks !

@tx7

This comment has been minimized.

Copy link

@tx7 tx7 commented Sep 25, 2019

I tried this script on Debian, but it didn't work.

@cbess

This comment has been minimized.

Copy link
Owner Author

@cbess cbess commented Sep 25, 2019

I tried this script on Debian, but it didn't work.

This script is only here for archiving purposes. Countly has been significantly updated since I originally wrote this script. You'd be better off creating an issue in the github project: https://github.com/Countly/countly-server#installing-and-upgrading-countly-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.