linux下各种代理的设置
http://los-vmm.sc.intel.com/wiki/OpenStack_New_Hire_Guide#Apply_JIRA_account
Set up your proxy.
The bellow proxies as follow:
(1) http-proxy: proxy.xxx.com port: 911
(3) socks5-proxy: proxy.xxx.com port: 1080
Set the bash proxy environment value
$ echo "declare -x http_proxy=\"http://proxy-shz.glb.intel.com:911\"
declare -x https_proxy=\"http://proxy-shz.glb.intel.com:911\"
declare -x no_proxy=\"`hostname`,localhost,127.0.0.1,127.0.1.1,.local,10.238.154.0/24,10.248.2.5,10.239.27.228,172.17.6.9,172.16.0.1,192.168.253.10,192.168.253.11,192.168.253.12,192.168.253.13,192.168.253.14,192.168.253.15,192.168.253.16,192.168.253.17,192.168.253.18,/usr/bin/wpp192.168.253.19,192.168.253.20,192.168.253.21,192.168.253.22,192.168.253.23,192.168.253.24,192.168.253.25,192.168.253.26,192.168.253.27,192.168.253.28,192.168.253.29,192.168.253.30\"
declare -x GIT_PROXY_COMMAND=\"/bin/socks-gw\"" >> ~/.bashrc
$ echo "http_proxy=\"http://proxy-mu.intel.com:911/\"
socks_proxy=\"socks://proxy.ir.intel.com:1080/\"" >> /etc/environment
Set the proxychains proxy
you can use proxychains to run some application that need to access the internet. Such as 'tox' for Open Stack test.
$ sudo echo 'socks5 10.7.211.16 1080' >> /etc/proxychains.conf
$ sudo echo '#!/bin/bash
sudo https_proxy= http_proxy= HTTP_PROXY= HTTPS_PROXY= proxychains $@ ' >> /usr/bin/myproxychains
$ sudo chmod a+x /usr/bin/myproxychains
Then you can run tox by:
$ myproxychains tox -e py27
Set the tsocks proxy
$ echo "server = 10.7.211.16
# Server type defaults to 4 so we need to specify it as 5 for this one
server_type = 5
# The port defaults to 1080 but I've stated it here for clarity
server_port = 1080" >> /etc/tsocks.conf
Set up the pip proxy
$ cp /usr/local/bin/pip /usr/local/bin/pip.org
$ echo '#!/bin/bash
/usr/bin/pip.org --proxy=http://proxy-shz.glb.intel.com:911 $*' > /usr/local/bin/pip.proxy
$ sudo chmod a+x /usr/local/bin/pip.proxy
$ sudo rm /usr/local/bin/pip
$ ln -s /usr/local/bin/pip /usr/local/bin/pip.proxy
Set up the git proxy
$ sudo echo '#!/bin/bash
connect -H "proxy-mu.intel.com:911" -S "proxy.ir.intel.com:1080" $@' > /bin/socks-gw
$ sudo chmod a+x /bin/socks-gw
$ echo "declare -x GIT_PROXY_COMMAND=\"/bin/socks-gw\"" >> ~/.bashrc
if you hit git review bug error as follow:
taget@taget-2012-Client-Platform:/opt/stack/nova$ git review -d 142975
Cannot query patchset information
The following command failed with exit code 255
"ssh -x gerrit query --format=JSON --current-patch-set change:142975"
ERROR: You must specify the destination port correctly.
usage: connect [-dnhst45] [-p local-port][-R resolve] [-w timeout]
[-H proxy-server[:port]] [-S [user@]socks-server[:port]]
[-T proxy-server[:port]]
[-c telnet-proxy-command]
host port
ssh_exchange_identification: Connection closed by remote host ==
refer: http://www.mediawiki.org/wiki/Gerrit/git-review#.22Cannot_query_patchset_information.22
or try this:
[global] index-url="http://otccloud06.sc.intel.com/pypi/simple" [easy_install] index-url=http://otccloud06.sc.intel.com/pypi/simple
Set up the ssh proxy
$ sudo echo 'ProxyCommand socks-gw %h %p' >> ~/.ssh/config
maybe some site do not need proxy.
$ cat ~/.ssh/config
Host github.com
ProxyCommand /usr/local/bin/socks-gw %h %p
Host openstack.org
ProxyCommand /usr/local/bin/socks-gw %h %p
HostName review.openstack.org
User shaohefeng
Port 29418
$ cat /usr/local/bin/socks-gw
#!/bin/bash
case $1 in
*.intel.com|192.168.*|127.0.*|localhost|10.*)
PROXY=
# METHOD="-X connect"
;;
*)
PROXY='-H proxy-mu.intel.com:911 -S proxy.ir.intel.com:1080'
# METHOD="-X 5 -x proxy-mu.intel.com:1080"
;;
esac
# /bin/nc $METHOD $*
#/bin/nc.openbsd $METHOD $*
connect $PROXY $*
Test:
$ ssh user@localhost
$ ssh user@review.openstack.org -p 29418
Set up the apt
You can either setup to proxy for apt
$ sudo echo '
Acquire::http::proxy "http://proxy-mu.intel.com:911/";
Acquire::socks::proxy "socks://proxy.jf.intel.com:1080/"; ' >> /etc/apt/apt.conf
or you can use the local apt mirrors http://linux-ftp.sh.intel.com/pub/mirrors/ubuntu/ by modifying the /etc/apt/sources.list
Set up the openstack pip local source repository
$ wget https://raw.githubusercontent.com/taget/mybin/master/openstack-tools/create_dir.sh
$ sed -i -e 's/\(^\s\+\)pip/\1myproxychains pip/' create_dir.sh
$ grep usage -n4 create_dir.sh
$ sudo chmod a+x create_dir.sh && sudo mv create_dir.sh /usr/bin/
$ sudo echo '[global]
# proxy=http://proxy-shz.intel.com:911
index-url=http://127.0.0.1:7799/tmp
# index-url=http://pypi.douban.com/simple
cache-dir=/home/shhfeng/.pipcache/pip
# [install]
# use-mirrors = true
# index-url=http://pypi.douban.com/simple' > ~/.pip/pip.conf
$ sudo echo "sudo sed -i -e 's/^\s\?\(index-url\)/# \1/' ~/.pip/pip.conf" > /usr/bin/en_pip_url
$ sudo echo "sudo sed -i -e 's/^#\s\?\(index-url\)/\1/' /home/shhfeng/.pip/pip.conf" > /usr/bin/dis_pip_url
$ sudo chmod a+x /usr/bin/en_pip_url /usr/bin/dis_pip_url
$echo 'Listen 7799
<VirtualHost *:7799>
ServerName localhost
DocumentRoot /var/www
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/pip_error.log
</VirtualHost> ' > /etc/apache2/sites-available/pip.conf
$ ln -s /etc/apache2/sites-available/pip.conf /etc/apache2/sites-enabled/pip.conf
$ sudo service apache2 restart
$ sudo echo '#!/bin/bash
for x in `ls /opt/stack/`
do
if [ -f /opt/stack/$x ]; then
continue
fi
if [ -e "/opt/stack/$x/.git" ]; then
create_dir.sh $x
fi
done' > /usr/bin/create_pip
$ sudo chmod a+x /usr/bin/create_pip
you can also ref this link: https://www.berrange.com/posts/2014/11/14/faster-rebuilds-for-python-virtualenv-trees/
linux下各种代理的设置的更多相关文章
- [转载]Linux下终端字体颜色设置方法
原文地址:Linux下终端字体颜色设置方法作者:router 网上类似的文章有很多,但是都是转来转去的,没有经过测试,按照很多文章的方法会造成你设置之后的终端在换行和删除输入字符时终端显示会乱七八糟, ...
- Linux下网卡混杂模式设置和取消
工作中发现一个网卡工作状态不对了,查看了一下,发现这个网卡和正常工作的网卡 信息不一样,它显示的居然是混杂模式,而正常工作的是 running 模式 ,所以来了解下混杂模式怎么取消... 下文来自 ...
- 环境变量解释以及在Linux下的环境变量设置
一.环境变量解释 环境变量是什么? 引用百度百科里面的解释:环境变量是操作系统中一个具有特定名字的对象,它包含了一个或者多个应用程序所将使用到的信息.例如Windows系统中的path环境变量,当要求 ...
- Linux 下配置 hosts 并设置免密登录
Linux 下配置 hosts 并设置免密登录 作者:Grey 原文地址: 博客园:Linux 下配置 hosts 并设置免密登录 CSDN:Linux 下配置 hosts 并设置免密登录 说明 实现 ...
- Linux下安装 Posgresql 并设置基本参数
在Linux下安装Postgresql有二进制格式安装和源码安装两种安装方式,这里用的是二进制格式安装.各个版本的Linux都内置了Postgresql,所以可直接通过命令行安装便可.本文用的是Cen ...
- Linux 下三种方式设置环境变量
1.在Windows 系统下,很多软件安装都需要配置环境变量,比如 安装 jdk ,如果不配置环境变量,在非软件安装的目录下运行javac 命令,将会报告找不到文件,类似的错误. 2.那么什么是环境变 ...
- (转)Linux下tomcat JVM内存设置步骤
java.lang.OutOfMemoryError: PermGen space java.lang.OutOfMemoryError: Java heap space -------------- ...
- 转:// LINUX下为ORACLE数据库设置大页--hugepage
一.在解释什么情况下需要开启大页和为啥需要开启大页前先了解下Linux下页的相关的知识:以下的内容是基于32位的系统,4K的内存页大小做出的计算1)目录表,用来存放页表的位置,共包含1024个目录en ...
- Linux下使用 xrandr 命令设置屏幕分辨率
最近在Linux下修改屏幕分辨率的时候,发现了一个非常有用的命令:xrandr 使用这个命令,可以方便的设置您显示器的的分辨率.尤其是当你使用了一些需要或者会自动改动您屏幕分辨率的程序以后. 您可以使 ...
随机推荐
- NodeJS学习笔记(一)——搭建开发框架Express,实现Web网站登录验证
JS是脚本语言,脚本语言都需要一个解析器才能运行.对于写在HTML页面里的JS,浏览器充当了解析器的角色.而对于需要独立运行的JS,NodeJS就是一个解析器.每一种解析器都是一个运行环境,不但允许J ...
- Keil MDK下如何设置非零初始化变量
一些工控产品,当系统复位后(非上电复位),可能要求保持住复位前RAM中的数据,用来快速恢复现场,或者不至于因瞬间复位而重启现场设备.而keil mdk在默认情况下,任何形式的复位都会将RAM区的非初始 ...
- 文本导出到pdf文件
程序中数据导出是经常有的需求,今天学习把文本导出到pdf文件.主要是用QPrinter,QPainter TextEditToPdf::TextEditToPdf(QWidget *parent, Q ...
- 在linux下读取bmp文件头的完整代码。
呵呵,贴在这里记录一下. [cpp] view plaincopy #include<stdio.h> #include<string.h> #include<sys/t ...
- POJ 3481 Double Queue STLmap和set新学到的一点用法
2013-08-08 POJ 3481 Double Queue 这个题应该是STL里较简单的吧,用平衡二叉树也可以做,但是自己掌握不够- -,开始想用两个优先队列,一个从大到小,一个从小到大,可是 ...
- 打开网页自动弹出QQ临时会话 (打开网站弹出QQ聊天) qq.js文件代
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35 ...
- 借助bootstrap框架模仿airbnb写的网页
View HTML .nav a { color: #5a5a5a; font-size: 11px; font-weight: bold; padding: 14px 10px; text-tran ...
- CodeForces463C Gargari and Bishops(贪心)
CodeForces463C Gargari and Bishops(贪心) CodeForces463C 题目大意: 在国际象棋的棋盘上放两个主教,这个两个主教不能攻击到同一个格子,最后的得分是这 ...
- 使用Vitamio打造自己的Android万能播放器(1)——准备
前言 虽然Android已经内置了VideoView组件和MediaPlayer类来支持开发视频播放器,但支持格式.性能等各方面都十分有限,这里与大家一起利用免费的Vitamio来打造属于自己的And ...
- HNU 12850 Garage
长为H的格子里面放n个长为h的格子 最多会有n+1个空隙 要使每一个空隙长度都小于h (H-h*n)/(n+1)<h n>(H/h-1)/2 #include<bits/stdc++ ...