Generally, for internal network security of enterprises in medium and large enterprises, the external internet is usually connected through proxy, so that the Linux server on the Intranet cannot directly connect to the external Yum server, it is inconvenient to install the software (after all, there are too many dependent packages for some software ).
Here, I only record the Yum and wget network proxy configurations of the centos server in my personal work environment.
1. Yum proxy configuration: 1. Modify the/etc/yum. conf file and append the following content to the end:
Sudo VI/etc/yum. conf
[Main] cachedir =/var/Cache/Yum/$ basearch/$ releaseverkeepcache = 0 debuglevel = 2 logfile =/var/log/yum. logexactarch = 1 obsoletes = 1 gpgcheck = 1 plugins = 1installonly_limit = 5bugtracker_url = http://bugs.centos.org/set_project.php? Project_id = 23 & ref = http://bugs.centos.org/bug_report_page.php? Category = yumdistroverpkg = centos-release # configure proxy http_proxy = http: // proxy IP Address: Port # Yes, add; (No, Please omit the following ;) proxy_username = proxy username proxy_password = proxy Password
2. Test Yum proxy configuration
Yum list
If the yum data is obtained correctly after the preceding command is executed, the yum proxy configuration is successful.
2. wget download and configuration proxy method 1: directly set the HTTP proxy in the wget command
Wget http://www.sina.com-e use_proxy = yes-e http_proxy = proxy IP: Port
HTTPS Proxy
Wget -- no-check-certificate http://www.sina.com-e use_proxy = yes-e http_proxy = proxy IP: Port
Method 2: Add a configuration file
Create a. wgetrc file in the current user's directory and write the proxy server information
VI ~ /. Wgetrc
# Configure proxy http_proxy = http: // proxy IP Address: Port ftp_proxy = http: // proxy IP Address: Port # If yes, add it. (If NO, omit the following ;) proxy_username = proxy username proxy_password = proxy password # indicates enabling proxy use_proxy = on
Configure network proxy for Yum and wget