Install Ruby on Rails with rbenv on Ubuntu
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
exec $SHELL
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile
exec $SHELL
// Logout putty session and try // --> Required
rbenv install 2.2.1
ubuntu@ip-172-31-15-122:~$ rbenv install 2.2.1
Downloading ruby-2.2.1.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5a4de38068eca8919cb087d338c0c2e3d72c9382c804fb27ab746e6c7819ab28
Installing ruby-2.2.1...
Installed ruby-2.2.1 to /home/ubuntu/.rbenv/versions/2.2.1
// rbenv uninstall 2.1.2 // --> Optional If Required
rbenv global 2.2.1 --> In case not working try below commands
//or//
ubuntu@ip-172-31-15-122:~$ sudo apt-get install rbenv global 2.2.1
// Logout putty session and try // --> --> Optional If Required
ubuntu@ip-172-31-15-122:~$ ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
ubuntu@ip-172-31-15-122:~$
echo "gem: --no-document" > ~/.gemrc
gem install bundler
gem install rails -v 4.2.0
rbenv rehash
ubuntu@ip-172-31-15-122:~$ rails -v
Rails 4.2.0
ubuntu@ip-172-31-15-122:~$
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
// Ruby on Rails is now installed on your system //
//Create a Test Application//
cd ~
ubuntu@ip-172-31-15-122:~$ rails new sample
Installing web-console 2.1.2
Bundle complete! 12 Gemfile dependencies, 55 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
run bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted
ubuntu@ip-172-31-15-122:~$
ubuntu@ip-172-31-15-122:~$cd sample
ubuntu@ip-172-31-15-122:~/sample$ rake db:create
ubuntu@ip-172-31-15-122:~/sample$
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
172.31.15.122
fe80::814:6aff:fe1c:dd2b
rails server --binding=172.31.15.122 --> Private IP address
ubuntu@ip-172-31-15-122:~/sample$ rails server --binding=172.31.15.122
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://172.31.15.122:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Started GET "/" for 103.8.194.117 at 2015-04-11 17:23:28 +0000
Cannot render console from 103.8.194.117! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by Rails::WelcomeController#index as HTML
Rendered /root/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/templates/rails/welcome/index.html.erb (1.2ms)
Completed 200 OK in 13ms (Views: 5.6ms | ActiveRecord: 0.0ms)
Started GET "/" for 103.8.194.117 at 2015-04-12 07:15:56 +0000
Cannot render console from 103.8.194.117! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by Rails::WelcomeController#index as HTML
Rendered /home/ubuntu/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/templates/rails/welcome/index.html.erb (1.1ms)
Completed 200 OK in 14ms (Views: 6.4ms | ActiveRecord: 0.0ms)
^C[2015-04-12 07:16:05] INFO going to shutdown ...
[2015-04-12 07:16:06] INFO WEBrick::HTTPServer#start done.
Exiting