Il programma wget consente di scaricare file dagli URL. Sebbene possa fare molto, la forma più semplice del comando è:wget [qualche URL]. Supponendo che non ci siano errori, collocherà quel file nella directory corrente. Se non specifichi un nome file, per impostazione predefinita tenterà di ottenere il file index.html.
Questo documento descrive come impostare wget (il downloader di rete non interattivo) per scaricare file tramite proxy.
File di configurazione wget
Di seguito sono riportati i file di configurazione di wget elencati in base alle loro priorità:
- ~/.wgetrc :File di avvio dell'utente.
- /etc/wgetrc :Posizione predefinita del file di avvio globale.
- Imposta le variabili del proxy in shell per lo pseudo-terminale corrente.
- ~/.bash_profile :ambiente specifico dell'utente.
- /etc/profilo :ambiente a livello di sistema.
Configurazione del proxy wget
1. Aggiungi le righe sottostanti nel file ~/.wgetrc o /etc/wgetrc :
http_proxy = http://[Proxy_Server]:[port] https_proxy = http://[Proxy_Server]:[port] ftp_proxy = http://[Proxy_Server]:[port]
2. Imposta manualmente le variabili proxy in una shell:
$ export http_proxy=http://[Proxy_Server]:[port] $ export https_proxy=$http_proxy $ export ftp_proxy=$http_proxy
Verifica i valori delle variabili usando il comando “env”.
$ env | grep proxy http_proxy=http://[Proxy_Server]:[port] https_proxy=http://[Proxy_Server]:[port] ftp_proxy=http://[Proxy_Server]:[port]
3. Aggiungi le righe sottostanti nel file ~/.bash_profile o /etc/profile :
# export http_proxy=http://[Proxy_Server]:[port] # export https_proxy=http://[Proxy_Server]:[port] # export ftp_proxy=http://[Proxy_Server]:[port]Come configurare il server proxy in CentOS/RHEL/Fedora