In this post, I will explain , how we set or configure the proxy setting in Linux server. Usually when you work on the cooperate server you work behind the proxy. So if you are trying to download any packages or software on the Linux operating system machine, you need to configure the proxy on your browser or on system profile.
1. If you want to set http_proxy shell variable on Linux terminal or bash shell, then please use the below command or method to set the proxy settings on terminal.
# export http_proxy=http://Proxy_IP:Proxyport
or
# export http_proxy=http://Proxy_Domain:ProxyPort
You can use above command to set the proxy on bash shell or on terminal. You can use Proxy IP as well as Proxy DNS name to configure the proxy on shell. In my case I have use proxy IP on my server.
#export http_proxy=http://192.168.1.70:8080
If you want to use https proxy then please run the below command to set the proxy settings on bash or any other shell.
#export https_proxy=https://Proxy_IP:ProxyPort
or
#export https_proxy=https://Proxy_Domain:ProxyPort
You can use this proxy on open shell only if you close the terminal or shell then you need to set proxy variable again.
If your proxy use authentication then you need to give proxy user name and password while you are running the above command.
#export http_proxy=http://Proxy_User:Proxy_Password@Proxy_IP:Port
2. If you want to setup proxy variable for all users then you need to set proxy environment as a global variable. To do this you need to set proxy variable on /etc/profile file.
# vi /etc/profile
export http_proxy=http://Proxy_IP:Proxyport
or
export http_proxy=http://Proxy_User:Proxy_Password@Proxy_IP:Port
3. If you want to set the proxy access to a specific user then you need to set the variable on their bash profile.
# vi /home/vibhor/.bash_profile
Append the following line:
export http_proxy=http://Proxy_User:Proxy_Password@Proxy_IP:Port
or
export http_proxy=http://Proxy_IP:Proxyport
You can use the https proxy or ftp proxy also only required to change the name of the varibale.