Ubuntu 14.04 LTS 一键安装countly
前言,前几天老总喊在服务器上面部署个Countly统计系统,于是googel了下,也请教了下@邓哥。几经周转,最后把countly服务搭建起来了。下面把apt-get源,以及一键安装shell贴上。
#!/bin/bash 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-software-properties if !(command -v apt-add-repository >/dev/null) then apt-get -y install software-properties-common fi #add node.js repo echo | apt-add-repository ppa:chris-lea/node.js #add mongodb repo echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" > /etc/apt/sources.list.d/mongodb-10gen-countly.list apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 #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-org || (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 #install iptables apt-get -y install iptables apt-get -y install build-essential || (echo "Failed to install build-essential." ; exit) #drop packages coming from 0/0 going through mongodb port #allow those coming from localhost iptables -A INPUT -m state --state NEW -p tcp --destination-port 27019 -s localhost -j ACCEPT iptables -A INPUT -m state --state NEW -p tcp --destination-port 27019 -s 0/0 -j DROP #install iptables-persistent apt-get -y install iptables-persistent #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 restart 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 (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
apt源我用的是ubuntu官方源+网易apt源
#网易部分 deb http://mirrors.163.com/ubuntu/ precise-updates main restricted deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted deb http://mirrors.163.com/ubuntu/ precise universe deb-src http://mirrors.163.com/ubuntu/ precise universe deb http://mirrors.163.com/ubuntu/ precise-updates universe deb-src http://mirrors.163.com/ubuntu/ precise-updates universe deb http://mirrors.163.com/ubuntu/ precise multiverse deb-src http://mirrors.163.com/ubuntu/ precise multiverse deb http://mirrors.163.com/ubuntu/ precise-updates multiverse deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse #ubuntu官方源部分 deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted deb http://us.archive.ubuntu.com/ubuntu/ trusty universe deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse deb http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu trusty-security main restricted deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted deb http://security.ubuntu.com/ubuntu trusty-security universe deb-src http://security.ubuntu.com/ubuntu trusty-security universe deb http://security.ubuntu.com/ubuntu trusty-security multiverse deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse
正文,附件我会放上一键安装包,准备好上面的apt源之后,直接运行(bin/countly.install.sh
) 即可。
备注,由于上传文件受大于2M限制,一键安装脚本已上传51CTO下载中心 :)
本文出自 “静如夜风” 博客,请务必保留此出处http://siliotto.blog.51cto.com/8887165/1623741
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。