Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A provisioning script for Rails webapp on Ubuntu 14.04 LTS
### Install Git and build deps
sudo apt-get update
sudo apt-get install software-properties-common tmux htop curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev tcl8.5
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
### Install rbenv and ruby
git clone ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
git clone ~/.rbenv/plugins/rbenv-gem-rehash
rbenv install 2.3.2
rbenv global 2.3.1
### For js runtime
curl -sL | sudo -E bash -
sudo apt-get install -y nodejs
### For China
gem sources --remove
gem sources --add
### Bundler
gem install bundler
rbenv rehash
### Postgres
sudo sh -c "echo 'deb precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
wget --quiet -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y postgresql-common postgresql-9.5 libpq-dev
sudo -u postgres createuser $DBUSERNAME -s
# If you would like to set a password for the user, you can do the following
sudo -u postgres psql
postgres=# \password $DBUSERNAME
# TODO: to change your /etc/postgresql/9.5/main/pg_hba.conf from peer to md5
### Passenger + Nginx
sudo apt-key adv --keyserver hkp:// --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates
sudo sh -c 'echo deb trusty main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update
sudo apt-get install -y nginx-extras passenger
### Redis
sudo add-apt-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get install redis-server
redis-benchmark -q -n 1000 -c 10 -P 5
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.