[英]Installing Rails on Ubuntu behind the proxy
I am under Ubuntu 12.04 LTS. 我在Ubuntu 12.04 LTS下。
I am behind the proxy. 我是代理人的幕后黑手。
I have installed rvm to manage ruby versions. 我已经安装了rvm来管理ruby版本。 I would like to install the rails but I have encountered the problem:
我想安装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)
I have tried different ways to force gem to use proxy setting: 我尝试了不同的方法来强制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
But nothing helped me. 但没有任何帮助我。
I am still getting the message: 我仍然收到消息:
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)
But apt-get and rvm work fine. 但apt-get和rvm工作正常。
There was a problem with my proxy settings that restrict an access to Internet. 我的代理设置存在问题,限制了对Internet的访问。 Sorry for incorrect question).
对不起,问题不对。 The solution here is to add (as a superuser) the following to the file
/etc/environment
: 这里的解决方案是将(作为超级用户)以下内容添加到文件
/etc/environment
:
http_proxy=http://<proxy-host>:<proxy-port>
where 哪里
<proxy-host>
is the real name of your proxy machine (or the ip address) <proxy-host>
是代理计算机的真实名称(或IP地址) <proxy-port>
is the port number you have to use <proxy-port>
是您必须使用的端口号 You don't have to set the proxy then for Gem. 您不必为Gem设置代理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.