Configuring a System Network Proxy (Linux)
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 information to the end of the file, save the file, and exit. (The following information is only an example. Change it according to the actual situation.)export http_proxy="http://proxyserverip:port" export https_proxy="http://proxyserverip:port"
In the preceding command, 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, install the certificate of the proxy server before downloading third-party components.
Parent topic: Common Operations