De proxy instellen via de commandline

Je stelt de shellvariabele http_proxy voor de huidige gebruiker in op een Linux/Unix-bashshell met het onderstaande commando:

#export http_proxy=http://server-ip:port/

Vraagt de proxyserver om een gebruikersnaam en wachtwoord, voer dan uit:

#export http_proxy=http://username:password@server-ip:port/

De proxy in alle shellsessies beschikbaar maken

Om de proxyvariabele als globale variabele voor alle gebruikers in te stellen:

Voeg de volgende regel toe aan het bestand /etc/profile:

export http_proxy=http://proxy-server:port/

Hieronder een voorbeeld om je proxy-instellingen in één keer te zetten:

PROXY_ADDRESS=”http://server-ip:port/”
HTTP_PROXY=$PROXY_ADDRESS
HTTPS_PROXY=$PROXY_ADDRESS
FTP_PROXY=$PROXY_ADDRESS
http_proxy=$PROXY_ADDRESS
https_proxy=$PROXY_ADDRESS
ftp_proxy=$PROXY_ADDRESS
export HTTP_PROXY HTTPS_PROXY FTP_PROXY http_proxy https_proxy ftp_proxy

De proxy voor één specifieke gebruiker instellen

Om proxytoegang voor één gebruiker in te schakelen, voeg je de regel toe aan het shellprofiel van die gebruiker:

# vi /home/username/.bash_profile

Voeg de volgende regel toe:

export http_proxy=http://username:password@server-ip:port/

YUM via de proxy laten werken

Om “yum” de HTTP/HTTPS-proxy te laten gebruiken, pas je het configuratiebestand /etc/yum.conf aan.

voeg de volgende regel toe:

proxy=http://proxy-server:port

Leeg daarna de cache die yum gebruikt:

yum clean all

Vraagt je proxy om authenticatie, dan stel je die in door de volgende regels in /etc/sysconfig/rhn/up2date toe te voegen of aan te passen:

enableProxy=1
enableProxyAuth=1
proxyPassword=UserPassword
proxyUser=UserName
httpProxy=http://proxy-server:port