For my reference:
http://yakiloo.com/using-rvm/
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/
http://rvm.io/rvm/best-practices
For this installation I followed what’s called single user installation,
which is the recommended way of installation,
this is an isolated install within a user's $HOME, not for root.
Install RVM
1. Set rvm_path
$ echo 'rvm_path="$HOME/.rvm"' >> ~/.rvmrc
2. Install RVM as a single user ( background info:
https://rvm.io/rvm/install)
$ \curl -L https://get.rvm.io | bash -s stable
3. At this point, RVM should have been installed, check if rvm was installed correctly by loading it then checking it’s type:
$ source ~/.rvm/scripts/rvm
$ type rvm | head -n 1
rvm is a function
4. Make sure that the latest version is installed
$ rvm get stable
5. Run the rvm requirements to get all the dependencies for RVM,
this might prompt for your password when it needed to install missing packages:
$ rvm requirements
Checking requirements for fedora.
Installing requirements for fedora.
Updating system
Installing required packages: patch, gcc-c++, patch, readline-devel, zlib-devel, libyaml-devel, libffi-devel, openssl-devel, autoconf, automake, libtool, bisondelacs password required for '/usr/bin/env PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/local/bin/Aptana_Studio_3:/auto/home3/delacs/bin:/auto/home3/delacs/.rvm/bin:/sbin yum install -y patch gcc-c++ patch readline-devel zlib-devel libyaml-devel libffi-devel openssl-devel autoconf automake libtool bison':
....................................................................................................................................................................................................................
Requirements installation successful.
Install Ruby
6. Now let’s install Ruby:
$ rvm install 1.9.3
7. The above command should install RubyGems with it, if in case there is an issue such
that RubyGems was not able to install due to some checksum error,
go to one version below the latest, e.g.,
$ rvm rubygems 2.1.8
8. Let’s tell RVM to use Ruby 1.9.3 as our default
$ rvm use ruby-1.9.3-p448 --default
Using /auto/home3/delacs/.rvm/gems/ruby-1.9.3-p448
9. Let’s check the version of Ruby in our environment
$ ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]
Install Sinatra
10. First, let’s first set our gem environment, due to some contraints
(I think it’s our firewall preventing installation of certs)
Add these lines to your ~/.gemrc:
:sources:
- http://rubygems.org/
- http://gems.github.com
gem: --no-rdoc --no-ri
The last line is to not install rdoc and ri
11. Let’s install Sinatra. We wan’t to make use of GemSets so we can
easily manage versioning in our installs. Create a gemset:
$ rvm gemset create SinatraDev
gemset created SinatraDev => /auto/home3/delacs/.rvm/gems/ruby-1.9.3-p448@SinatraDev
12. Let’s use that GemSet:
$ rvm gemset use SinatraDev
Using ruby-1.9.3-p448 with gemset SinatraDev
Let’s check if we are using that gemset
$ rvm gemset name
SinatraDev
13. Now let’s install all gems that we need
$ gem install sinatra -v 1.4.3
$ gem install shotgun -v 0.9
14. To make use of this RVM environment, we can specify 2 files in the project’s root folder:
$ cat .ruby-gemset
SinatraDev
$ cat .ruby-version
ruby-1.9.3-p448
To learn more about RVM and its environment, refer to these posts:
http://yakiloo.com/using-rvm/
http://stackoverflow.com/questions/15708916/use-rvmrc-or-ruby-version-file-to-set-a-project-gemset-with-rvm
15. To make use of automatic install of rubies, you can specify a flag in ~/.rvmrc
rvm_install_on_use_flag=1
16. You also make bootstrapping a project happen via cd into the project directory, by adding this to ~/.rvmrc
export rvm_project_rvmrc=1
17. To access webrick from another system, firewall needs to be
opened up for port 9393 as follows:
$ sudo firewall-cmd --permanent --zone=public --add-port=9393/tcp
$ sudo systemctl restart firewalld.service
18. Start WEBrick using shotgun:
$ shotgun main.rb --host mymachine.domain.com