Last active
August 29, 2015 14:19
-
-
Save jackbit/4d5b1b73f1d880215bf3 to your computer and use it in GitHub Desktop.
Installation script for Ubuntu Trusty 14 with rbenv, haproxy, monit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Installation script for Ubuntu Trusty 14 with rbenv, haproxy, monit | |
# Author: Yacobs Reinhart <yacobus.reinhart@gmail.com> | |
set -e | |
CURRENT=`pwd` | |
echo "..... UPDATE UBUNTU PACKAGES ....." | |
apt-get update | |
apt-get install -y --force-yes build-essential curl git | |
apt-get install -y --force-yes zlib1g-dev libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt-dev | |
apt-get clean | |
echo "..... INSTALL HAPROXY ....." | |
apt-get install -y haproxy | |
echo "..... INSTALL MONIT ....." | |
apt-get install -y monit | |
echo "..... INSTALL RBENV ....." | |
RBENV_ROOT=/usr/local/rbenv | |
RBENV_VERSION=2.2.2 | |
read -p "Please enter rbenv version (default: 2.2.2): " input_rbenv_version | |
if [ ! -z "$input_rbenv_version" ];then | |
RBENV_VERSION=$input_rbenv_version | |
fi | |
read -p "Please enter rbenv path (default: $RBENV_ROOT): " input_rbenv_root | |
if [ ! -z "$input_rbenv_root" ];then | |
RBENV_ROOT=$input_rbenv_root | |
fi | |
echo "Install rbenv to $RBENV_ROOT with install $RBENV_VERSION..." | |
if [ -d $RBENV_ROOT ]; then | |
echo rbenv is already installed. So updating... | |
cd $RBENV_ROOT | |
git pull | |
cd plugins/ruby-build | |
git pull | |
else | |
mkdir -p $RBENV_ROOT | |
cd $RBENV_ROOT | |
git clone https://github.com/sstephenson/rbenv.git . | |
mkdir -p plugins | |
git clone https://github.com/sstephenson/ruby-build.git plugins/ruby-build | |
fi | |
cd $CURRENT | |
export RBENV_ROOT | |
export RBENV_VERSION | |
$RBENV_ROOT/bin/rbenv install $RBENV_VERSION | |
$RBENV_ROOT/bin/rbenv rehash | |
echo Install bundler... | |
$RBENV_ROOT/bin/rbenv exec gem install bundler | |
usermod -a -G staff root | |
chgrp -R staff $RBENV_ROOT | |
chmod -R g+w $RBENV_ROOT | |
if [ ! $(which rbenv) ]; then | |
echo " | |
Seems you still have not added 'rbenv' to the load path: | |
# ~/.bash_profile: | |
RBENV_ROOT=$RBENV_ROOT | |
if [ -d \$RBENV_ROOT ]; then | |
export RBENV_ROOT | |
PATH="\$RBENV_ROOT/bin:$PATH" | |
eval \"\$(rbenv init -)\" | |
fi | |
" | |
fi | |
echo "Please add your user as staff to shared rbenv, the command:" | |
echo "sudo usermod -a -G staff your_user" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment