title: Error while installing rails gem
body: <p>So I have ruby 2.2.0 installed on a VPS and I'm trying to install rails. The only problem is, when I do a gem install rails it fails. I tried it with the backtrace and the following is what I get:</p>
  
  <pre><code>usera@node3:~$ gem install --backtrace rails
  ERROR:  While executing gem ... (SocketError)
      getaddrinfo: Name or service not known
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:791:in `send'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:791:in `send'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:672:in `request'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:528:in `block in fetch_resource'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:1096:in `block (3 levels) in resolv'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:1094:in `each'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:1094:in `block (2 levels) in resolv'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:1093:in `each'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:1093:in `block in resolv'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:1091:in `each'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:1091:in `resolv'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:519:in `fetch_resource'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:509:in `each_resource'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/resolv.rb:490:in `getresource'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/remote_fetcher.rb:92:in `api_endpoint'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/source.rb:46:in `api_uri'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/source.rb:85:in `dependency_resolver_set'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/resolver/best_set.rb:23:in `block in pick_sets'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/source_list.rb:97:in `each'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/source_list.rb:97:in `each_source'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/resolver/best_set.rb:22:in `pick_sets'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/resolver/best_set.rb:28:in `find_all'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/resolver/installer_set.rb:151:in `find_all'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/resolver/installer_set.rb:54:in `add_always_install'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/dependency_installer.rb:463:in `resolve_dependencies'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/commands/install_command.rb:238:in `install_gem'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/commands/install_command.rb:299:in `block in install_gems'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/commands/install_command.rb:295:in `each'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/commands/install_command.rb:295:in `install_gems'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/commands/install_command.rb:202:in `execute'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/command.rb:307:in `invoke_with_build_args'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/command_manager.rb:168:in `process_args'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/command_manager.rb:138:in `run'
          /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/gem_runner.rb:54:in `run'
          /home/usera/.rbenv/versions/2.2.0/bin/gem:21:in `&lt;main&gt;'
  </code></pre>
  
  <p>I also ran <code>gem install --backtrace -p rails</code> and got the following</p>
  
  <pre><code>usera@node3:~$ gem install --backtrace -p rails
  ERROR:  While executing gem ... (OptionParser::InvalidArgument)
      invalid argument: -p rails
      /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/local_remote_options.rb:27:in `block in accept_uri_http'
      /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/command.rb:377:in `handle_options'
      /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/command.rb:298:in `invoke_with_build_args'
      /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/command_manager.rb:168:in `process_args'
      /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/command_manager.rb:138:in `run'
      /home/usera/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/gem_runner.rb:54:in `run'
      /home/usera/.rbenv/versions/2.2.0/bin/gem:21:in `&lt;main&gt;'
  </code></pre>
  
  <p>It seems to work fine on my other VPS so I'm a bit confused. </p>
  
  <p>Thanks in advance!</p>