zoukankan      html  css  js  c++  java
  • docker容器的ubuntu系统中设置apt-get代理和apt-get源

    docker容器的ubuntu系统中设置apt-get代理安装软件

    有时候虚拟机不能安装软件,需要设置代理才能正常连接网络安装软件

    Ubuntu中给apt-get设置代理
    进入docker-haproxy服务
    docker exec -it h1 /bin/bash

    编辑文件: /etc/apt/apt.conf
    在您的apt.conf文件中加入下面这行(根据你的实际情况替换yourproxyaddress和proxyport)
    Acquire::http::Proxy "http://yourproxyaddress:proxyport";
    Acquire::https::proxy "http://yourproxyaddress:proxyport";

    Acquire::http::Proxy "http://10.11.0.148:808";
    Acquire::https::proxy "http://10.11.0.148:808";

    容器没有编辑器,只能通过echo写入的方式设置代理
    设置apt-get的代理
    cd /etc/apt
    echo 'Acquire::http::Proxy "http://10.11.0.148:808";' >> apt.conf
    echo 'Acquire::https::proxy "http://10.11.0.148:808";' >> apt.conf
    或者
    cd /etc/apt/apt.conf.d
    echo 'Acquire::http::Proxy "http://10.11.0.148:808";' >> proxy.conf
    echo 'Acquire::https::proxy "http://10.11.0.148:808";' >> proxy.conf

    # 系统升级,安装vim编辑器
    # apt-get update
    root@f9ee51b26ac0:/etc/apt/apt.conf.d# apt-get install vim

    # 安装keepalived和ping命令
    apt-get install keepalived
    apt-get install net-tools
    apt-get install iputils-pinp

    aliyun的镜像站

    https://developer.aliyun.com/mirror/

    ubuntu的香港中文大学源,如果是香港线路可以设置如下

    deb http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty main restricted universe multiverse
    deb http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security main restricted universe multiverse
    deb http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-updates main restricted universe multiverse
    deb http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-proposed main restricted universe multiverse
    deb http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-backports main restricted universe multiverse
    deb-src http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty main restricted universe multiverse
    deb-src http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security main restricted universe multiverse
    deb-src http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-updates main restricted universe multiverse
    deb-src http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-proposed main restricted universe multiverse
    deb-src http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-backports main restricted universe multiverse

    报错
    W: GPG error: http://ftp.cuhk.edu.hk/pub/Linux/ubuntu trusty Release:

    解决:
    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 出现的字符串

    # apt-get update
    # 安装软件
    apt-get install iputils-ping --allow-unauthenticated -y


    cd /usr/redis/src/
    ./redis-server ../redis.conf

  • 相关阅读:
    Unity 游戏性能优化 学习
    常用网站
    Unity3d插件开发与SDK对接实战 学习
    Unity3D常用网络框架与实战解析 学习
    问题:grid卸载后重新安装时ASM磁盘识别不到了
    问题:oracle 12c rac数据库服务器的home目录丢失问题解决2018-06-25 18:30
    Linux启动报:UNEXPECTED INCONSISTENCY: RUN fsck MANUALLY问题解决
    linux下网卡bonding配置(转)
    热扩容LVM形式的/(根)分区(无损增大、缩小LVM分区)
    LVM逻辑卷管理
  • 原文地址:https://www.cnblogs.com/reblue520/p/13404537.html
Copyright © 2011-2022 走看看