Reference article:
Proxy settings on centos7
03-Use three methods to set up CentOS7 to use proxy server to access the Internet
1. Permanent setting
Modify the /etc/profile file and 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 there is no password restriction, the above content can be modified to the following content:
http_proxy=http://yourproxy:8080/
ftp_proxy=http://yourproxy:8080/
export http_proxy
export ftp_proxy
If it is only for a certain user, modify the ~/.bash_profile file and add the same content;
Then use source /etc/profile to make the settings take effect immediately.
2. Temporary setting (deactivated after reconnection)
Just enter the following command directly in the command line
export http_proxy=http://username:password@yourproxy:8080/
export ftp_proxy=http://username:password@yourproxy:8080/
#or
export http_proxy=http://yourproxy:8080/
export ftp_proxy=http://yourproxy:8080/
Note: After setting, you may still not be able to connect to the external network when using ping, but it is OK when using pip because the ping protocol is different. This proxy cannot be used.
3. Single setting (recommended)
Set up proxy directly during pip
pip3 install –proxy http://proxy address:proxy port number Software name
Note: proxy has two "-" numbers
4. YUM Agent Settings
Use the vi editor to open the yum configuration file. Generally: vi /etc/
After opening the yum configuration file, add the protocol, address, and port of the proxy server at the end of the file. If the proxy server requires user authentication, add the user name and password of the authenticated user at the same time.
The proxy server does not require authentication: add proxy=Protocol://Proxy server address: port (such as: proxy=http://192.168.1.1:80)
The proxy server needs to authenticate the user: add proxy=Protocol://Proxy server address: port (such as: proxy=http://192.168.1.1:80)
proxy_username=Proxy server username
proxy_password=Proxy server password
After saving and exiting, you can easily install the software using yum.
5. Git proxy settings
git config --global https://proxyuser:proxypassword@ip/Domain name:port
git config --global http://proxyuser:proxypassword@ip/Domain name:port
Example:
Suppose someone works in Baidu, the company's proxy server is (), the port is (8080), and the proxy configuration is as follows
1. The proxy server needs authentication configuration
git config --global https://username:password@:8080
2. The proxy server does not require authentication configurationgit config --global :8080
6. Some special characters in proxy configuration
If there are special characters such as @ in the password, an error will occur, for example
git config --global http://username:abc@123@:8080
During parsing, it will be parsed from the first @, prompting that @123@ cannot be found. At this time, the special symbols must be processed and the special characters must be converted using Percent-encoding.
The 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/>Proxy account: admin Proxy password: abc@123 @ is a special character Proxy server:http://172.31.101.102:8080
When performing global proxy, you need to configure it as follows
http://admin:abc%[email protected]:8080