I\'m trying to install Ruby on Ubuntu 16.04. However when I enter to following command to terminal:
$ \\curl -sSL https://get.rvm.io | bash -s stable --ruby
This appear a port issue, Try this:
gpg --keyserver hkp://keys.gnupg.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
I had the same issue but on Debian and I took an alternate approach. In the error message, it says this: "Try to install GPG v2 and then fetch the public key:" with a gpg2
command after it. I went and installed gpg2 first and ran the command it told me to and it worked for me.
sudo apt-get install gnupg2
sudo apt-get install dirmngr
gpg2 --recv-keys <key>
# <Run curl command to install rvm>
After trying many ways. I did succeed to install rails as follows:
$ \curl -sSL https://get.rvm.io | bash
$ source /home/<user>/.rvm/scripts/rvm
$ rvm -v
$ rvm install ruby
$ ruby -v
$ sudo apt-get install rubygems
$ gem update
$ sudo apt-get install ruby-dev zlib1g-dev liblzma-dev build-essential patch
$ rvm gemset list
$ gem install rails
$ rails -v
Where "user" is my username
In addition to the previous answers, if you are behind a firewall, the following command might not work for you.
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
In that case, you can use the following command to get the keys -
sudo apt-key adv --keyserver hkp://keys.gnupg.net:80 --recv-keys <<key>> <<key>>
I am just posting an update solution for it as I faced the same issue in Ubuntu 18.04 while trying to fetch keys for RVM.
The following method is provided by RVM.
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
If it doesn't work out and you try to install rvm directly, the process will fail and provides three suggestions to receive keys. One of which have a step to receive the keys with gpg2.
Install gpg2 in your system before that.
sudo apt install gnupg2
The command is
gpg2 --recv-keys 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
But this command too will not work. So here's an alternative. Just replace the gpg from the older command to gpg2 which worked for me.
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
I had issues in receiving the server keys and switched the key server to an alternative list mentioned in https://rvm.io/rvm/security