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

How to change default editor in Ubuntu Linux Mint Debian or any other distrubutions

Welcome and Thank you for your support!
Support this website by leaving Comments

1.VIM – As I prefer Vim always! 🙂

ami@amios:~$ which vim
/usr/bin/vim

ami@amios:~$ export EDITOR=/usr/bin/vim

OR do it by .bashrc

ami@amios:~$ echo “export EDITOR=vim” >> ~/.bashrc
ami@amios:~$ cat .bashrc | grep vim
export EDITOR=vim

Yes 😉

check your env (environment variables)

root@amios:/home/ami# env | grep EDITOR
EDITOR=/usr/bin/vim

2. Nano editor

export EDITOR=”nano”
export VISUAL=”nano”

3. Other options

update-alternatives –config editor

Upgrading WordPress – This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php

Error in WordPress can very ennoying and they can be fixed as follow:

This may happenned whey you are trying to use the auto update button to upgrade to WordPress to the lastest version 3.8.1 (01/02/2014).

eg. Exampe of the error – This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php

Sometimes the solution is very simple.

Run the following command

ps aux | grep apache (if you run the apache server) WordPress require that the owner of the files is equil to the user who runs the web server eg apache.
in this case my user is

root@amios:/home/wordpress/public_html# ps aux | grep apacche
root 28868 0.0 0.1 9392 896 pts/0 S+ 16:54 0:00 grep –color=auto apacche
root@amios:/home/wordpress/public_html# ps aux | grep apache
root 7368 0.0 2.9 298460 14836 ? Ss Jan22 0:55 /usr/sbin/apache2 -k start
www-data 28840 0.0 1.7 298616 8660 ? S 16:53 0:00 /usr/sbin/apache2 -k start
www-data 28841 1.1 7.6 328132 38624 ? S 16:53 0:01 /usr/sbin/apache2 -k start
www-data 28842 0.0 1.7 298616 8660 ? S 16:53 0:00 /usr/sbin/apache2 -k start
www-data 28843 0.0 1.7 298616 8660 ? S 16:53 0:00 /usr/sbin/apache2 -k start
www-data 28844 0.0 1.7 298616 8660 ? S 16:53 0:00 /usr/sbin/apache2 -k start
www-data 28846 0.0 1.7 298616 8660 ? S 16:53 0:00 /usr/sbin/apache2 -k start
www-data 28850 0.0 1.7 298616 8660 ? S 16:53 0:00 /usr/sbin/apache2 -k start
www-data 28852 3.4 7.5 326708 37904 ? S 16:53 0:02 /usr/sbin/apache2 -k start
www-data 28853 0.0 1.7 298616 8660 ? S 16:53 0:00 /usr/sbin/apache2 -k start
www-data 28862 0.0 1.7 298616 8660 ? S 16:54 0:00 /usr/sbin/apache2 -k start
root 28870 0.0 0.1 9392 892 pts/0 S+ 16:54 0:00 grep –color=auto apache

then run the following command on your wordpress installation
You are changing the user who owns the wordpress installation to

root@amios:/home/wordpress/public_html# chown -R www-data /home/wordpress/

then you can upgrade your wordpress and change the user back if you prefer.

Enjoy!