• Linux_Best Practice_01_Ubuntu_set prox_set Repositories


    Setting proxy from terminal

    1. For gtk3 programs such as rhythmbox and online accounts:

    First you need to enter proxy settings in network settings (along with authentication):

    Then apply system wide.

    2. For apt,software center etc

    edit the file /etc/apt/apt.conf

    And then replace all the existing text by the following lines

    1. Acquire::http::proxy "http://username:password@host:port/";
    2. Acquire::ftp::proxy "ftp://username:password@host:port/";
    3. Acquire::https::proxy "https://username:password@host:port/";

    configure proxy for apt in ubuntu 18.04

    Creating  an Apt Proxy Conf File

    Apt loads all configuration files under /etc/apt/apt.conf.d. We can create a configuration specifically for our proxy there, keeping it separate from all other configurations.

    1. Create a new configuration file named proxy.conf.
      sudo touch /etc/apt/apt.conf.d/proxy.conf
    2. Open the proxy.conf file in a text editor.
      sudo vi /etc/apt/apt.conf.d/proxy.conf
    3. Add the following line to set your HTTP proxy.
      Acquire::http::Proxy "http://user:password@proxy.server:port/";
    4. Add the following line to set your HTTPS proxy.
      Acquire::https::Proxy "http://user:password@proxy.server:port/";
    5. Save your changes and exit the text editor.

    Your proxy settings will be applied the next time your run Apt.

    3. Environment variables

    edit the file /etc/environment

    And then add the following lines after PATH="something here"

    1. http_proxy=http://username:password@host:port/
    2. ftp_proxy=ftp://username:password@host:port/
    3. https_proxy=https://username:password@host:port/

    set Repositories.

    https://help.ubuntu.com/community/Repositories/CommandLine

    Ubuntu uses apt for package management. Apt stores a list of repositories or software channels in the file

    /etc/apt/sources.list

    and in any file with the suffix .list under the directory

    /etc/apt/sources.list.d/

    CN Repository

     1 tlfox@tlfox-virtual-machine:/etc/apt$ more sources.list.save 
     2 # deb cdrom:[Ubuntu 16.04.1 LTS _Xenial Xerus_ - Release amd64 (20160719)]/ xenial main restricted
     3 
     4 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
     5 # newer versions of the distribution.
     6 deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
     7 # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
     8 
     9 ## Major bug fix updates produced after the final release of the
    10 ## distribution.
    11 deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
    12 # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
    13 
    14 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    15 ## team, and may not be under a free licence. Please satisfy yourself as to
    16 ## your rights to use the software. Also, please note that software in
    17 ## universe WILL NOT receive any review or updates from the Ubuntu security
    18 ## team.
    19 deb http://cn.archive.ubuntu.com/ubuntu/ xenial universe
    20 # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial universe
    21 deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe
    22 # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe
    23 
    24 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
    25 ## team, and may not be under a free licence. Please satisfy yourself as to 
    26 ## your rights to use the software. Also, please note that software in 
    27 ## multiverse WILL NOT receive any review or updates from the Ubuntu
    28 ## security team.
    29 deb http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
    30 # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
    31 deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
    32 # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
    33 
    34 ## N.B. software from this repository may not have been tested as
    35 ## extensively as that contained in the main release, although it includes
    36 ## newer versions of some applications which may provide useful features.
    37 ## Also, please note that software in backports WILL NOT receive any review
    38 ## or updates from the Ubuntu security team.
    39 deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
    40 # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
    41 
    42 ## Uncomment the following two lines to add software from Canonical's
    43 ## 'partner' repository.
    44 ## This software is not part of Ubuntu, but is offered by Canonical and the
    45 ## respective vendors as a service to Ubuntu users.
    46 # deb http://archive.canonical.com/ubuntu xenial partner
    47 # deb-src http://archive.canonical.com/ubuntu xenial partner
    48 
    49 deb http://security.ubuntu.com/ubuntu xenial-security main restricted
    50 # deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
    51 deb http://security.ubuntu.com/ubuntu xenial-security universe
    52 # deb-src http://security.ubuntu.com/ubuntu xenial-security universe
    53 deb http://security.ubuntu.com/ubuntu xenial-security multiverse
    54 # deb-src http://security.ubuntu.com/ubuntu xenial-security 
    CN Repository

    US Repository

     1 tlfox@tlfox-virtual-machine:/etc/apt$ more sources.list
     2 
     3 # 
     4 
     5 # deb cdrom:[Ubuntu-Server 16.04.1 LTS _Xenial Xerus_ - Release amd64 (20160719)]/ xenial main restricted
     6 
     7 #deb cdrom:[Ubuntu-Server 16.04.1 LTS _Xenial Xerus_ - Release amd64 (20160719)]/ xenial main restricted
     8 
     9 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    10 # newer versions of the distribution.
    11 deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
    12 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
    13 
    14 ## Major bug fix updates produced after the final release of the
    15 ## distribution.
    16 deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
    17 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
    18 
    19 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    20 ## team. Also, please note that software in universe WILL NOT receive any
    21 ## review or updates from the Ubuntu security team.
    22 deb http://us.archive.ubuntu.com/ubuntu/ xenial universe
    23 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe
    24 deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe
    25 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe
    26 
    27 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
    28 ## team, and may not be under a free licence. Please satisfy yourself as to 
    29 ## your rights to use the software. Also, please note that software in 
    30 ## multiverse WILL NOT receive any review or updates from the Ubuntu
    31 ## security team.
    32 deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
    33 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
    34 deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
    35 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
    36 
    37 ## N.B. software from this repository may not have been tested as
    38 ## extensively as that contained in the main release, although it includes
    39 ## newer versions of some applications which may provide useful features.
    40 ## Also, please note that software in backports WILL NOT receive any review
    41 ## or updates from the Ubuntu security team.
    42 deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
    43 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
    44 
    45 ## Uncomment the following two lines to add software from Canonical's
    46 ## 'partner' repository.
    47 ## This software is not part of Ubuntu, but is offered by Canonical and the
    48 ## respective vendors as a service to Ubuntu users.
    49 # deb http://archive.canonical.com/ubuntu xenial partner
    50 # deb-src http://archive.canonical.com/ubuntu xenial partner
    51 
    52 deb http://security.ubuntu.com/ubuntu xenial-security main restricted
    53 # deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
    54 deb http://security.ubuntu.com/ubuntu xenial-security universe
    55 # deb-src http://security.ubuntu.com/ubuntu xenial-security universe
    56 deb http://security.ubuntu.com/ubuntu xenial-security multiverse
    57 # deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
    US Repository
  • 相关阅读:
    day04-交互、格式化输出及基本运算符
    day03-执行python方式、变量及数据类型简介
    day02-操作系统、编程语言分类及python安装
    day01-编程与计算机组成原理
    Appium测试环境搭建实践
    Windows环境下多线程编程原理与应用读书笔记(3)————Windows环境中的多线程实现(3)
    Windows环境下多线程编程原理与应用读书笔记(3)————Windows环境中的多线程实现(2)
    Windows环境下多线程编程原理与应用读书笔记(3)————Windows环境中的多线程实现(1)
    Windows环境下多线程编程原理与应用读书笔记(2)————面向对象技术
    Windows环境下多线程编程原理与应用读书笔记(1)————基本概念
  • 原文地址:https://www.cnblogs.com/tlfox2006/p/8013224.html
Copyright © 2020-2023  润新知