“ubuntu教程”ubuntu 14.04 lts 一键安装countly

来源: 电脑维修教程 阅读:     发表时间:

http://siliotto.blog.51cto.com/8887165/1623741 媒介,前几天老总喊在服务器上脸部署个countly统计系统,因而googel了下,也就教了下@邓哥。几经周转,最后把countly服

http://siliotto.blog.51cto.com/8887165/1623741

媒介,前几天老总喊在服务器上脸部署个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下载中间 :)

以上是:解决“ubuntu教程”ubuntu 14.04 lts 一键安装countly问题的详细资料教程