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
- Configure environment variables.Replace the username, password, proxy IP address, and proxy port with your actual values.
1 2
export http_proxy="http://username:password@proxy_ip:proxy_port" export https_proxy=$http_proxy
- Verify that the internet is accessible.
Run the curl command to access any website. If the website response is displayed, the proxy is successfully configured and the internet access is available.
Method 2: Configuring a Permanent Network Proxy
- Modify the profile file.
- Open the /etc/profile file.
1vi /etc/profile - Press i to enter the insert mode and add the following content to the /etc/profile file.Replace the username, password, proxy IP address, and proxy port with your actual values.
export http_proxy="http://username:password@proxy_ip:proxy_port" export https_proxy=$http_proxy export no_proxy=127.0.0.1,localhost,local,.local
- Press Esc, type :wq!, and press Enter to save the settings and exit.
- Make the proxy take effect.
1source /etc/profile
- Open the /etc/profile file.
- Verify that the internet is accessible.
Run the curl command to access any website. If the website response is displayed, the proxy is successfully configured and the internet access is available.
Parent topic: Configuring the Compilation Environment