美文网首页Linux学习资料收集
ubuntu下各类代理安装使用笔记

ubuntu下各类代理安装使用笔记

作者: forrestsun | 来源:发表于2017-01-14 23:33 被阅读0次

    安装shadowsocks


    1. 安装
    sudo apt-get install python-pip
    sudo pip install shadowsocks
    
    1. 编辑配置文件
    sudo nano /etc/shadowsocks.json
    
    {
        "server":"server_ip",
        "server_port":8000,
        "local_address": "127.0.0.1",
        "local_port":1080,
        "password":"password",
        "timeout":300,
        "method":"aes-256-cfb",
        "fast_open": false
    }
    
    1. 启动
    $sslocal -c  /etc/shadowsocks.json
    
    1. 开机启动
    sudo nano /etc/rc.local
    ##在rc.local下追加以下内容
    sslocal -c /etc/shadowsocks.json -d start
    

    socket5 转 http


    1. 安装polipo
    sudo apt-get install polipo
    
    1. 配置
    sudo nano /etc/polipo/config
    
    # This file only needs to list configuration variables that deviate
    # from the default values.  See /usr/share/doc/polipo/examples/config.sample
    # and "polipo -v" for variables you can tweak and further information.
    # This file only needs to list configuration variables that deviate
    # from the default values.  See /usr/share/doc/polipo/examples/config.sample
    # and "polipo -v" for variables you can tweak and further information.
    logSyslog = false
    logFile = "/var/log/polipo/polipo.log"
    socksParentProxy = "127.0.0.1:5080"
    socksProxyType = socks5
    chunkHighMark = 50331648
    objectHighMark = 16384
    serverMaxSlots = 64
    serverSlots = 16
    serverSlots1 = 32
    proxyAddress = "0.0.0.0"
    proxyPort = 8123
    
    1. 启动
    sudo service polipo
    
    1. 配置别名
    nano ~/.bashrc
    
    alias hp="http_proxy=http://localhost:8123"
    export http_proxy=http://localhost:8123
    
    1. 测试
    $curl ip.gs
    当前 IP:61.135.194.100 来自:中国北京北京 联通
    $source ~/.bashrc
    $curl ip.gs
    当前 IP:104.207.151.141 来自:美国加利福尼亚州圣何塞 choopa.com
    

    Docker 使用代理


    1. 创建文件
    $ mkdir /etc/systemd/system/docker.service.d
    
    1. 配置代理文件
     sudo nano /etc/systemd/system/docker.service.d/http-proxy.conf
    
    [Service]
    Environment="HTTP_PROXY=http://127.0.0.1:8123"
    
    1. 更新配置
    sudo systemctl daemon-reload
    
    1. 校验
    systemctl show --property=Environment docker
    Environment=HTTP_PROXY=http://127.0.0.1:8123
    
    1. 重启Docker
    $ sudo systemctl restart docker
    

    Git代理


    1. 直接利用参数
    git clone https://github.com/forrestsun/gogs.git  --config http.proxy=localhost:8123
    
    1. 配置使用
    nano ~/.bashrc
    
    gp=" --config http.proxy=localhost:8123"
    
    $source ~/.bashrc
    
    git clone https://github.com/forrestsun/gogs.git $gp
    

    Go Get


     hp go get -v -u labix.org/v2/mgo
    

    ubuntu update 代理 (暂未测试)


    sudo nano /etc/apt/apt.conf
    Acquire::http::proxy "http://10.1.3.1:8080/";
    

    Android SDK 代理

    1. 启动 Android SDK Manager ,打开主界面,依次选择「Tools」「Options...」,弹出『Android SDK Manager - Settings』窗口;
    2. 『Android SDK Manager - Settings』窗口中,在「HTTP Proxy Server」和「HTTP Proxy Port」输入框内填入
    mirrors.neusoft.edu.cn
    

    80
    ,并且选中「Force https://... sources to be fetched using http://...」
    复选框。设置完成后单击「Close」按钮关闭『Android SDK Manager - Settings』窗口返回到主界面;

    1. 依次选择「Packages」「Reload」

    参考资料

    相关文章

      网友评论

        本文标题: ubuntu下各类代理安装使用笔记

        本文链接:https://www.haomeiwen.com/subject/oahybttx.html