Some proxy settings for Linux as a client
In Linux (CentOS6.4 is used in this article), the host acts as the client. in a network environment with a network proxy, client proxy configuration is required when accessing the network in the following aspects:
1. Set network proxy on the GUI
2. Set network proxy for environment variables in the system
3. proxy settings when using YUM
4. proxy settings of the application itself
1. Network Proxy under the graphic interface
After installing the GUI, go to System> Preferences> Network Proxy to open the Network Proxy settings page, as shown in figure
The proxy here is configured when some GUI programs access the network. However, for example, when using Firefox, you still need to configure the network proxy in the Firefox program itself, to access the webpage (and After configuring the network proxy in Firefox, Firefox can access the webpage even if it is not configured here ).
The configuration here is actually saved ~ /. Gconf/system/proxy directory and http_proxy directory
2. Agent-related environment variables
Common Agent-related environment variables include http_proxy, https_proxy, and ftp_proxy.
Some command line tools use the proxy settings, such as curl, when using a proxy.
Format:
Export http_proxy = "http: // USERNAME: PASSWORD @ <proxyserver >:< proxyport>"
If you want this configuration to take effect permanently, add it to/etc/profile/**. sh or ~. /Bash_profile
[Root @ tew.achine ~] # Vim/etc/profile. d/proxy. sh # Add the following section to create a new proxy. sh:
Export http_proxy = "http: // USERNAME: PASSWORD @ <proxyserver >:< proxyport>"
Export https_proxy = "http: // USERNAME: PASSWORD @ <proxyserver >:< proxyport>"
Export ftp_proxy = "http: // USERNAME: PASSWORD @ <proxyserver >:< proxyport>"
3. proxy settings in YUM
If a proxy server is used in the network environment, you must configure a proxy in the YUM repository configuration of the client to use the internet-based YUM source.
# Vim/etc/yum. conf
Add the following section
Proxy = http: // <proxyserver >:< proxyport>
Proxy_username = USERNAME
Proxy_password = PASSWORD
# Yum clean all
# Yum makecache
4. proxy settings of the application itself
Some GUI applications still need to configure proxies, even if a proxy is configured in the system, such as Firefox (Edit-> Preferences );
Some command tools, such as curl, can be directly used if the environment variable http_proxy has been configured in the system without additional configuration. If the proxy is not configured in the environment variable, you must specify the proxy through the corresponding options when using curl, as shown below:
# Curl-I-x http: // <proxyserver >:< proxyport>-U <username: password>
-X or -- the HTTP proxy address connected by the proxy command
-U or -- proxy-user specifies the user name and password of the connection proxy
This article permanently updates the link address: