我要评分
获取效率
正确性
完整性
易理解

Configuring a Network Proxy

If you cannot directly access the Internet, configure a network proxy temporarily or permanently. A permanent network proxy may cause password leakage because all users in the environment can obtain the password. Therefore, you are advised to configure a temporary network proxy. You can also select the proxy mode that better suits your requirements.

Method 1: Configuring a Temporary Network Proxy

  1. Set the environment variable.

    Set the user name, password, proxy IP address, and proxy port based on your requirements.

    1
    2
    export http_proxy="http://Username:Password@Proxy_IP_address:Proxy_port"
    export https_proxy=$http_proxy
    
  2. Confirm that the Internet connection is normal.

    Run the curl command to access any website. If the website information is displayed, the proxy is successfully configured and the Internet is connected.

Method 2: Configuring a Permanent Network Proxy

  1. Modify the profile file.
    1. Open the /etc/profile file.
      1
      vi /etc/profile
      
    2. Press i to enter the insert mode and add the following content to the /etc/profile file.
      Set the user name, password, proxy IP address, and proxy port based on your requirements.
      export http_proxy="http://Username:Password@Proxy_IP_address:Proxy_port"
      export https_proxy=$http_proxy 
      export no_proxy=127.0.0.1,localhost,local,.local
    3. Press Esc, type :wq!, and press Enter to save the settings and exit.
    4. Make the proxy take effect.
      1
      source /etc/profile
      
  2. Confirm that the Internet connection is normal.

    Run the curl command to access any website. If the website information is displayed, the proxy is successfully configured and the Internet is connected.