title: Installing Rails on Ubuntu behind the proxy
body: <p>I am under Ubuntu 12.04 LTS.<br>
  I am behind the proxy.<br>
  I have installed rvm to manage ruby versions.
  I would like to install the rails but I have encountered the problem:</p>
  
  <pre><code>test@U205-UBUNTU:~$ gem install rails
  ERROR:  Could not find a valid gem 'rails' (&gt;= 0) in any repository
  ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
      bad response Forbidden 403 (http://rubygems.org/latest_specs.4.8.gz)
  </code></pre>
  
  <p>I have tried different ways to force gem to use proxy setting: </p>
  
  <pre><code>1. gem install rails --http-proxy=http://10.10.16.8:3128  
  
  2. gem install rails -p=http://10.10.16.8:3128  
  
  3. export http_proxy=http://10.10.16.8:3128  
  
  4. I have added to .bashrc lines:   
  export http_proxy=http://10.10.16.8:3128  
  export https_proxy=https://10.10.16.8:3128  
  
  5. I have added to /etc/environment lines:   
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"  
  http_proxy=http://10.10.16.8:3128  
  https_proxy=https://10.10.16.8:3128  
  </code></pre>
  
  <p><strong>But nothing helped me.<br>
  I am still getting the message:</strong>  </p>
  
  <pre><code>test@U205-UBUNTU:~$ gem install rails
      ERROR:  Could not find a valid gem 'rails' (&gt;= 0) in any repository
      ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
          bad response Forbidden 403 (http://rubygems.org/latest_specs.4.8.gz)
  </code></pre>
  
  <p>But <strong>apt-get</strong> and <strong>rvm</strong> work fine.</p>