Install rvm Ruby on Rails and Ruby on Kali Linux

It’s not as simple as described on the rvm website. By some reason it’s just does not work on Kali Linux.

1. Clean up your system first

$apt-get autoremove

2.whereis ruby – we will install a new version and overwrite the existing version instead of removing it.

ruby: /usr/bin/ruby /usr/lib/ruby /usr/bin/X11/ruby /usr/share/man/man1/ruby.1.gz

If you still want to remove it by any reason then you can use these commands if you want but it’s not recommended ;). Try do $apt-get remove ruby

If ruby are installed from source then you need to do the following to remove them.

rm -rf /usr/local/lib/ruby
rm -rf /usr/lib/ruby
rm -f /usr/local/bin/ruby
rm -f /usr/bin/ruby
rm -f /usr/local/bin/irb
rm -f /usr/bin/irb
rm -f /usr/local/bin/gem
rm -f /usr/bin/gem

3. apt-get install build-essential zlib1g zlib1g-dev libreadline6 libreadline6-dev libssl-dev

This is for root user installation.

$\curl -L https://get.rvm.io | bash -s -- --ignore-dotfiles --autolibs=0 --ruby

Searching for binary rubies, this might take some time.
No binary rubies available for: debian/Kali_Linux_1/x86_64/ruby-2.1.0.
Continuing with compilation. Please read ‘rvm help mount’ to get more information on binary rubies.
Installing Ruby from source to: /home/ami/.rvm/rubies/ruby-2.1.0, this may take a while depending on your cpu(s)…
ruby-2.1.0 – #downloading ruby-2.1.0, this may take a while depending on your connection…
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100 11.4M  100 11.4M    0     0   397k      0  0:00:29  0:00:29 –:–:–  968k
ruby-2.1.0 – #extracting ruby-2.1.0 to /home/ami/.rvm/src/ruby-2.1.0.
ruby-2.1.0 – #applying patch /home/ami/.rvm/patches/ruby/2.1.0/changeset_r44327.diff.
ruby-2.1.0 – #applying patch /home/ami/.rvm/patches/ruby/GH-488.patch.
ruby-2.1.0 – #configuring…………………………………………….
ruby-2.1.0 – #post-configuration.
ruby-2.1.0 – #compiling…………………………………………………………………………..
ruby-2.1.0 – #installing……………………………
ruby-2.1.0 – #making binaries executable.
ruby-2.1.0 – #downloading rubygems-2.2.2
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100  404k  100  404k    0     0   707k      0 –:–:– –:–:– –:–:–  884k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.0 – #extracting rubygems-2.2.2.
ruby-2.1.0 – #removing old rubygems.
ruby-2.1.0 – #installing rubygems-2.2.2……………
ruby-2.1.0 – #gemset created /home/ami/.rvm/gems/ruby-2.1.0@global
ruby-2.1.0 – #importing gemset /home/ami/.rvm/gemsets/global.gems

This will install latest ruby 2.1.0 in writing this post.

root@amiOs:/home/ami# source /etc/profile.d/rvm.sh
root@amiOs:/home/ami# type rvm | head -n 1
rvm is a function

Yes it’s installed correctly!

This is quite important

root@amiOs:/home/ami# ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]

Ruby is now also installed to the correct version.

Now switch to global and update your gems.

root@amiOs:/home/ami# rvm gemset use global
Using ruby-2.1.0 with gemset global
root@amiOs:/home/ami# gem outdated
bigdecimal (1.2.3 < 1.2.5)
minitest (4.7.5 < 5.2.2)
psych (2.0.2 < 2.0.4)
rake (10.1.0 < 10.1.1)
rdoc (4.1.0 < 4.1.1)
test-unit (2.1.0.0 < 2.5.5)
root@amiOs:/home/ami# gem update

Updating installed gems
Updating installed gems
Updating bigdecimal
Fetching: bigdecimal-1.2.5.gem (100%)
Building native extensions.  This could take a while…
Successfully installed bigdecimal-1.2.5
Parsing documentation for bigdecimal-1.2.5
Installing ri documentation for bigdecimal-1.2.5
Installing darkfish documentation for bigdecimal-1.2.5
Done installing documentation for bigdecimal after 1 seconds
………….

$echo “gem: –no-document” >> ~/.gemrc

This is to speed up gem installation as we don’t need docs files.

We will create a gemset now.

root@amios:/home/ami# rvm use ruby-2.1.0@rails4.0 –create (two dashes this need to be –create instead of -create)

It’s time to install Rails

root@amiOs:/home/ami# gem install rails
Fetching: atomic-1.1.14.gem (100%)
Building native extensions.  This could take a while…
Successfully installed atomic-1.1.14
Fetching: thread_safe-0.1.3.gem (100%)
Successfully installed thread_safe-0.1.3
Fetching: tzinfo-0.3.38.gem (100%)
Successfully installed tzinfo-0.3.38
Fetching: multi_json-1.8.4.gem (100%)
Successfully installed multi_json-1.8.4
Fetching: i18n-0.6.9.gem (100%)
Successfully installed i18n-0.6.9
Fetching: activesupport-4.0.2.gem (100%)
Successfully installed activesupport-4.0.2
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: rack-1.5.2.gem (100%)
Successfully installed rack-1.5.2
Fetching: rack-test-0.6.2.gem (100%)
Successfully installed rack-test-0.6.2
Fetching: builder-3.1.4.gem (100%)
Successfully installed builder-3.1.4
Fetching: actionpack-4.0.2.gem (100%)
Successfully installed actionpack-4.0.2
Fetching: activerecord-deprecated_finders-1.0.3.gem (100%)
Successfully installed activerecord-deprecated_finders-1.0.3
Fetching: arel-4.0.2.gem (100%)
Successfully installed arel-4.0.2

after 658 seconds
27 gems installed
root@amiOs:/home/ami# rails
Usage:
rails new APP_PATH [options]

root@amiOs:/home/ami# rvm gemset list

gemsets for ruby-2.1.0 (found in /home/ami/.rvm/gems/ruby-2.1.0)
(default)
global
=> rails4.0

root@amiOs:/home/ami# rvm gemset use rails4.0
Using ruby-2.1.0 with gemset rails4.0
root@amiOs:/home/ami#

Well done to you?

Think I can improve it? Post your comments!

SSD Hosting for 5 dollars a month https://www.digitalocean.com/?refcode=71a52388956e

Advertisements

Transaction Check Error: file /usr/lib64/audit from install of glibc-2.16-30.fc18.x86_64 conflicts with file from package audit-2.2.1-2.fc18.x86_64

Transaction Check Error:
file /usr/lib64/audit from install of glibc-2.16-30.fc18.x86_64 conflicts with file from package audit-2.2.1-2.fc18.x86_64

This may come up during the RVM install on fresh Fedora 18 once you check your rvm requirements

The solution is simple to this problem 🙂

run the following command

yum update audit

then go back to installing rmv requirements

Have FUn!

Other things to try:

Thanks for lettings us know mathlasse

I did ‘yum remove audit’ and then ‘yum update’ worked again.

My recommendation for the best book for Linux Beginners

A Practical Guide to Linux Commands, Editors, and Shell Programming (3rd Edition)