Back

linu - 在无法联网的ubuntu上使用 git , apt, rbenv , gems 的方式(可累死我了)

发布时间: 2018-12-06 06:15:00

对于军工企业,很多机器是不允许联网的. 

所以我们需要知道如何安装.

git 代理: 在 .bashrc中设置  http_proxy, https_proxy
还需要在  .gitconfig中设置:
[http]
        proxy = http://192.168.1.118:8888
        sslverify = false
[https]
        proxy = https://192.168.1.118:8888
        sslverify = false

用这个方式来安装rbenv
ALL_PROXY=http://192.168.1.118:8888 RUBY_BUILD_CURL_OPTS=-k rbenv install 2.2.4

first of all, ruby-2.2.4.tar.bz2

RUBY_BUILD_MIRROR_URL=file:///opt/app/ruby-2.2.4.tar.bz2# rbenv install 2.2.4


gems:
gem sources --remove https://rubygems.org/
gem sources --add http://gems.ruby-china.com
gem sources 

vim ~/.gemrc
---
:backtrace: false
:bulk_threshold: 1000
:sources:
- http://gems.ruby-china.com
:update_sources: true
:verbose: true
http_proxy: http://192.168.1.118:8888

安装gems:

1. 先在可以联网的机器:  bundle install 
2. bundle package (打包到 vendor/cache
3. 在另一台不能联网的机器: $ bundle install --local


apt-get 使用代理:  略

Back