-
Notifications
You must be signed in to change notification settings - Fork 138
/
rails-installer.sh
84 lines (62 loc) · 2.37 KB
/
rails-installer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
# A simple Script for installing Rails on Ubuntu 12.04 LTS / 12.10
# It will also install the dependencies required as well as the RVM
# Author: Ramesh Jha (ramesh at rameshjha.com),(http://blog.sudobits.com)
# License: MIT
RUBY_VERSION="1.9.3"
LOG_FILE="$HOME/install.log"
echo "Rails Installer started"
# Installing Dependencies
echo -n "Updating package cache..."
sudo apt-get update >>$LOG_FILE
echo "Done"
echo -n "Installing git..."
sudo apt-get -y install git >>$LOG_FILE
echo "Done..."
echo -n "Installing Curl..."
sudo apt-get -y install curl >>$LOG_FILE
echo "Done"
# Install RVM (Ruby Version Manager)
echo -n "Installing RVM..."
curl -Ls get.rvm.io | bash -s stable >>$LOG_FILE
# fallback for the above command (in case of certificates errors)
#if ($? !=0)
# then
# curl -kLs get.rvm.io | bash -s stable
#fi
echo "Done"
echo -n "Loading RVM..."
source ~/.rvm/scripts/rvm >>$LOG_FILE
echo "Done.."
# Install Additional Dependencies
echo -n "Installing additional dependencies (this is a big one)..."
sudo apt-get -y install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
# Install nodejs from the PPA
apt-add-repository -y ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get -y install nodejs
echo "Done"
# Install Latest version of Ruby
echo -n "Installing Ruby (v$RUBY_VERSION)..."
rvm install $RUBY_VERSION >>$LOG_FILE
echo "Done"
echo "If you want to install another version of ruby e.g 1.8.7"
echo "Then use the command 'rvm install 1.8.7' "
# Select and Set latest version of ruby as the default so that
# You won't have to select each time you start a terminal
echo -n "Setting the default version of Ruby..."
rvm --default use $RUBY_VERSION >>$LOG_FILE
echo "Done"
echo "Now, You are using Ruby $RUBY_VERSION by default"
echo "if you want to change that then use 'rvm --default <ruby_version>' "
# Install Latest version of Rails
echo -n "Installing Rails gem..."
gem install rails >>$LOG_FILE
echo "Done"
echo "######################################"
echo "###### Installation Completed ########"
echo "######################################"
if [ "$(which notify-send)" != "" ]; then
notify-send "Rails Install Complete"
fi
echo "if something went wrong then checkout the log file $LOG_FILE"