#!/usr/bin/env bash
sed -i "s/us\./cn\./g" /etc/apt/sources.list
apt-get update
##安装nginx
apt-get -y install nginx
if [ "$?" != "0" ]; then
echo "error! nginx is not installed correctly"
exit 1;
fi
##安装php
apt-get -y install php5
if [ "$?" != "0" ]; then
echo "error! php is not installed correctly"
exit 2;
fi
##安装pecl
apt-get -y install php-pear
if [ "$?" != "0" ]; then
echo "error! pecl is not installed correctly"
exit 3;
fi
##安装mongo扩展
apt-get -y install make
pecl install mongo-1.3.4
if [ "$?" != "0" ]; then
echo "error! mongo is not installed correctly"
exit 4;
fi
echo "extension=mongo.so" > /etc/php5/conf.d/mongo.ini
##安装yar扩展
apt-get -y install libcurl4-openssl-dev
pecl install yar-1.2.3
if [ "$?" != "0" ]; then
echo "error! yar is not installed correctly"
exit 5;
fi
echo "extension=yar.so" > /etc/php5/conf.d/yar.ini
##安装yaf扩展
apt-get -y install libpcre3-dev
pecl install yaf-2.2.9
if [ "$?" != "0" ]; then
echo "error! yar is not installed correctly"
exit 6;
fi
echo "extension=yaf.so" > /etc/php5/conf.d/yaf.ini
##安装xhprof扩展
pecl install xhprof-0.9.4
if [ "$?" != "0" ]; then
echo "error! xhprof is not installed correctly"
exit 7;
fi
echo "extension=xhprof.so" > /etc/php5/conf.d/xhprof.ini
##安装msgpack扩展
pecl install msgpack-0.5.5
if [ "$?" != "0" ]; then
echo "error! msgpack is not installed correctly"
exit 8;
fi
echo "extension=msgpack.so" > /etc/php5/conf.d/msgpack.ini
##安装gearman扩展
apt-get -y install libgearman-dev
pecl install gearman-1.1.0
if [ "$?" != "0" ]; then
echo "error! gearman is not installed correctly"
exit 9;
fi
echo "extension=gearman.so" > /etc/php5/conf.d/gearman.ini
##安装apc扩展
pecl install APC-3.1.6
if [ "$?" != "0" ]; then
echo "error! APC is not installed correctly"
exit 10;
fi
echo "extension=apc.so" > /etc/php5/conf.d/apc.ini
##安装rabbitmq服务器端
cd /tmp
wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
apt-key add rabbitmq-signing-key-public.asc
echo "deb http://www.rabbitmq.com/debian/ testing main" > /etc/apt/sources.list.d/rabbitmq.list
apt-get update
apt-get -y install rabbitmq-server
rm /tmp/rabbitmq-signing-key-public.asc
#安装 rabbitmq client端
apt-get -y install librabbitmq-dev git bzr
if [ $? != "0" ]; then
echo "error! rabbitmq is not installed correctly."
exit 11;
fi
cd /tmp
git clone git://github.com/alanxz/rabbitmq-c.git
cd rabbitmq-c
git submodule init
git submodule update
autoreconf -i && ./configure && make && make install
rm -rf /tmp/rabbitmq-c
#pecl安装 amqp 扩展
pecl install amqp-1.2.0
if [ $? != "0" ]; then
echo "error,amqp is not installed correctly!"
exit 12;
fi
echo "extension=amqp.so" > /etc/php5/conf.d/amqp.ini