Sometimes, we can not directly connect an external network, you may need to connect to a proxy server to access the Internet, package installation, upgrade program, this time we need to configure some proxy settings, so as to ensure normal network.
First, the global server environment variables
Global home agent as follows:
Modify / etc / profile file, add the following content:
http_proxy=http://username:password@yourproxy:8080/
ftp_proxy=http://username:password@yourproxy:8080/
export http_proxy
export ftp_proxy
If no password restrictions, the above can be modified to the following:
http_proxy=http://yourproxy:8080/
ftp_proxy=http://yourproxy:8080/
export http_proxy
export ftp_proxy
If only for a certain user, then modify ~ / .bash_profile file, add the same content;
After editing, log off log on again.
Two, yum proxy settings
Open yum configuration file with the vi editor, under normal circumstances: vi /etc/yum.conf
After opening the yum configuration file, the file finally add the proxy server protocol, address, port, if the proxy server requires user authentication, then, at the same time add to authenticate the user's user name and password.
Proxy authentication server does not need to: add proxy = protocol: // proxy server address: port (such as: proxy = http://192.168.1.1:80 )
Proxy server requires user authentication: add proxy = protocol: // proxy server address: port (eg: proxy = http://192.168.1.1:80 )
proxy_username=代理服务器用户名
proxy_password=代理服务器密码
Save and exit, you can use the software to install the yum easy.
Three, git proxy settings
git config --global https.proxy https://proxyuser:proxypassword@ip/域名:port
git config --global http.proxy http://proxyuser:proxypassword@ip/域名:port
Example:
Suppose someone working in Baidu, the company proxy server is (proxy.baidu.com), port (8080), the proxy configuration is as follows
1, configure the proxy server requires authentication
git config --global https.proxy https://username:[email protected]:8080
2, the proxy server does not require authentication configurationgit config --global https.proxy https://proxy.baidu.com:8080
Fourth, the proxy configuration of some special characters
If there are special characters such as @ password, it will go wrong, such as
git config --global http.proxy http://username:abc@[email protected]:8080
From the first will be parsed @, @ 123 @ proxyhk.huawei.com tips can not find resolution, this time to a special symbol which is processed, using a percentage encoding (Percent-encoding) converts special characters, conversion.
List is as follows:
! --> %21 # --> %23 $ --> %24 & --> %26 ' --> %27
( --> %28 ) --> %29 * --> %2A + --> %2B , --> %2C
/ --> %2F : --> %3A ; --> %3B = --> %3D ? --> %3F
@ --> %40 [ --> %5B ] --> %5D
For example: br /> Agent Account: admin
Proxy Password: abc @ 123
@ as special characters by
proxy: http://172.31.101.102:8080
time globally agent, need to follow the following configuration