#!/bin/bash set -x set -e # add ubuntu repos echo "deb http://us.archive.ubuntu.com/ubuntu/ precise universe" >> /etc/apt/sources.list echo "deb http://us.archive.ubuntu.com/ubuntu/ precise multiverse" >> /etc/apt/sources.list # fixes locales locale-gen en_US.UTF-8 dpkg-reconfigure -fnoninteractive locales update-locale LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" LANGUAGE="en_US" export LANGUAGE=en_US export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 # replace init dpkg-divert --local --rename --add /sbin/initctl ln -s /bin/true /sbin/initctl apt-get -qy update apt-get install -qy curl git-core build-essential vim-tiny # add evrone repo mkdir -p /etc/apt/sources.list.d echo "deb http://download.opensuse.org/repositories/home:/dmexe/xUbuntu_12.04/ ./" > /etc/apt/sources.list.d/Evrone.list curl http://download.opensuse.org/repositories/home:/dmexe/xUbuntu_12.04/Release.key | apt-key add - apt-get -qy update # add packages apt-get install -qy libmysqlclient-dev libpq-dev imagemagick libmagickwand-dev \ libcurl4-openssl-dev nodejs libxml2-dev libxslt-dev \ openjdk-7-jre-headless libsqlite3-dev libgeos-dev ruby # install runit chmod 0000 /sbin/start apt-get -qy install runit chmod 0755 /sbin/start # set user password useradd -m ci echo "ci:ci" | chpasswd apt-get -qy install sudo echo "ci ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers # install ssh apt-get install -qy openssh-server mkdir -p /var/run/sshd sv-gen ssh "/usr/sbin/sshd -D -e" # install syslog apt-get install -qy rsyslog sv-gen rsyslogd "/usr/sbin/rsyslogd -c5 -n" root # install postgresql apt-get install -qy postgresql-9.1 postgresql-contrib-9.1 echo "local all all trust" > /etc/postgresql/9.1/main/pg_hba.conf echo "host all all all trust" >> /etc/postgresql/9.1/main/pg_hba.conf sv-gen postgresql "/usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf" postgres # install mysql apt-get install -qy mysql-server-5.5 sv-gen mysql "/usr/sbin/mysqld" mysql # install redis-server apt-get install -qy redis-server sed -i 's|daemonize yes|daemonize no|g' /etc/redis/redis.conf sv-gen redis-server "/usr/bin/redis-server /etc/redis/redis.conf" redis # install rabbitmq-server apt-get install -qy rabbitmq-server sv-gen rabbitmq-server "/usr/sbin/rabbitmq-server" root # install elasticsearch ES_PKG=elasticsearch-0.90.5.deb curl https://download.elasticsearch.org/elasticsearch/elasticsearch/$ES_PKG -o /tmp/$ES_PKG dpkg -i /tmp/$ES_PKG rm -f /tmp/$ES_PKG sv-gen elasticsearch "/usr/share/elasticsearch/bin/elasticsearch -f -Des.path.data=/var/lib/elasticsearch" elasticsearch # install phantomjs PH_PKG=phantomjs-1.9.2-linux-x86_64.tar.bz2 curl https://phantomjs.googlecode.com/files/$PH_PKG -o /tmp/$PH_PKG tar -jxf /tmp/$PH_PKG -C /usr/local rm -f /tmp/$PH_PKG ln -sf /usr/local/$(basename $PH_PKG .tar.bz2)/bin/phantomjs /usr/local/bin # add ruby apt-get install -qy rbenv rbenv-2.0.0-p195 rbenv-1.9.3-p448 rbenv-2.0.0-p247 rbenv-1.9.3-p392 apt-get install -qy ruby1.8 ruby1.8-dev rubygems # 1.8.7 env RBENV_VERSION=2.0.0-p247 rbenv exec gem install bundler --no-ri --no-rdoc env RBENV_VERSION=2.0.0-p195 rbenv exec gem install bundler --no-ri --no-rdoc env RBENV_VERSION=1.9.3-p448 rbenv exec gem install bundler --no-ri --no-rdoc env RBENV_VERSION=1.9.3-p392 rbenv exec gem install bundler --no-ri --no-rdoc env RBENV_VERSION=system rbenv exec gem install bundler --no-ri --no-rdoc rbenv rehash apt-get -qy clean autoremove sv-enable postgresql sv-enable ssh sv-enable mysql sv-enable redis-server sv-enable rsyslogd