Configuring a System Network Proxy
The following procedure is a general method for configuring a network proxy. It may not be applicable to all network environments. The method of configuring the network proxy depends on the actual network environment.
Prerequisites
- Ensure that the network cable of the server is connected and the proxy server can connect to the external network.
- The configuration proxy is based on the condition that the server is located on an intranet and cannot be directly connected to the external network.
Configuring a System Network Proxy
- Log in to the user environment as the root user.
- Run the following command to edit the /etc/profile file:
vi /etc/profile
Add the following content to the file, save the file, and exit:export http_proxy="http://user:password@proxyserverip:port" export https_proxy="http://user:password@proxyserverip:port"
In the preceding commands, user indicates the username on the intranet, password indicates the user password, proxyserverip indicates the IP address of the proxy server, and port indicates the port number.
- Run the following command to make the configuration take effect.
source /etc/profile
- Run the following command to check whether the external network is connected:
wget www.baidu.com
If the HTML file can be downloaded, the server is connected to the external network successfully.
If a certificate error occurs when you use a proxy to connect to the network, you need to install the certificate of the proxy server before downloading third-party components.