簡體   English   中英

在代理后面的Ubuntu上安裝Rails

[英]Installing Rails on Ubuntu behind the proxy

我在Ubuntu 12.04 LTS下。
我是代理人的幕后黑手。
我已經安裝了rvm來管理ruby版本。 我想安裝rails但我遇到了問題:

test@U205-UBUNTU:~$ gem install rails
ERROR:  Could not find a valid gem 'rails' (>= 0) in any repository
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    bad response Forbidden 403 (http://rubygems.org/latest_specs.4.8.gz)

我嘗試了不同的方法來強制gem使用代理設置:

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  

但沒有任何幫助我。
我仍然收到消息:

test@U205-UBUNTU:~$ gem install rails
    ERROR:  Could not find a valid gem 'rails' (>= 0) in any repository
    ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
        bad response Forbidden 403 (http://rubygems.org/latest_specs.4.8.gz)

apt-getrvm工作正常。

我的代理設置存在問題,限制了對Internet的訪問。 對不起,問題不對。 這里的解決方案是將(作為超級用戶)以下內容添加到文件/etc/environment

http_proxy=http://<proxy-host>:<proxy-port>

哪里

  • <proxy-host>是代理計算機的真實名稱(或IP地址)
  • <proxy-port>是您必須使用的端口號

您不必為Gem設置代理。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM