RVM Installation issue : Public Key download issue

You might have gone through the RVM installation and tried this command

$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

This command actually downloads the verified public key and verifies the integrity of the installer script file.


$ gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3

gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
gpg: keyserver timed out
gpg: keyserver receive failed: keyserver error



Despite of that error, you execute the following command

$ \curl -sSL https://get.rvm.io | bash -s stable --ruby

# Output 

Downloading https://github.com/rvm/rvm/archive/1.27.0.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.27.0/1.27.0.tar.gz.asc
gpg: Signature made मंगलबार 29 मार्च 2016 using RSA key ID BF04FF17
gpg: Can't check signature: No public key
Warning, RVM 1.26.0 introduces signed releases and automated check of signatures when GPG software found.
Assuming you trust Michal Papis import the mpapis public key (downloading the signatures).

GPG signature verification failed for '/home/john/.rvm/archives/rvm-1.27.0.tgz' - 'https://github.com/rvm/rvm/releases/download/1.27.0/1.27.0.tar.gz.asc'!
try downloading the signatures:

gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

or if it fails:

command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -

the key can be compared with:


The solution is there in the error message. Try

$ gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

If it fails, try this

$ curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -

And try this again

$ \curl -sSL https://get.rvm.io | bash -s stable --ruby


You are done,

Thanks for visiting


RVM : The program ‘rails’ can be found in the following packages:

Sometime I see this message though I have proper versions of rails / ruby installed in my system.

john@john-Inspiron-7347:~/projects/thepact (drug_test_final)$ rails c
The program 'rails' can be found in the following packages:
 * ruby-railties-3.2
 * ruby-railties-4.0
Try: sudo apt-get install <selected package>

Solution (Not best solution)

john@john-Inspiron-7347:~/projects/thepact (drug_test_final)$ cd ../
john@john-Inspiron-7347:~/projects$ cd thepact/

make sure you have the proper version of ruby as default

$ rvm list
=* ruby-2.1.0 [ x86_64 ]
   ruby-2.2.1 [ x86_64 ]


Answer suggested by Prakash Poudel in comments

seems like problem in selection of appropriate version of ruby!
in my case i have added following code into .bashrc

[[ -s “$HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/rvm” # Load RVM into a shell session *as a function*

Installation Guide: Ruby On Rails: Ubuntu 14.04

Installing Ruby

RVM is the best Tool to manage multiple versions in your system.

# Update your package manager first:

$ sudo apt-get update
# Install dependencies for ruby
# This installs CURL, Git and other dependencies

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
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
# To get the signature
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

if it fails:

 command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -L https://get.rvm.io | bash -s stable
For all in one installation append --rails or --ruby or --ruby=1.9.3
Note: RVM might not be available right after installation is complete. Restart the terminal once after installation is completed.
#[ rvm install ruby ] installs latest version of ruby
rvm install 2.1.2
rvm use 2.1.2 --default

# Check the version of ruby installed
ruby -v
git config --global color.ui true
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR@EMAIL.com"

# Create SSH Key
ssh-keygen -t rsa -C "YOUR@EMAIL.com"

# Now you need to add this public key to your github account
# You need to copy and paste the content of ~/.ssh/id_rsa.pub file to https://github.com/settings/ssh
# after clicking Add SSH Key buttton
# Once you have done this, you have to type following command to check
# if it worked

ssh -T git@github.com
# Hopefully, you will get this echoed

"Hi excid3! You've successfully authenticated, but GitHub does not provide shell access."

We need to install javascript runtime like NodeJS. This will let you use CoffeeScript and Gems you use to minify your javascripts (such as uglifier).

To install NodeJS, we need to add it using a PPA repository:

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
gem install rails
# Check the version of rails installed

rails -v
# Rails 4.1.6
sudo apt-get install mysql-server mysql-client libmysqlclient-dev

Installing the libmysqlclient-dev gives you the necessary files to compile the mysql2 gem which is what Rails will use to connect to MySQL when you setup your Rails app.