How to modify proxy settings in Linux CentOS

Hello,

As I am getting more familiar with Linux, I am wondering how to add a proxy setting to my centos server.

In windows I am used to going to my "Internet Options" -> "Connections" -> "LAN Settings" -> make changes in here.... proxy address & port

How would I perform this on my centos box?

thx
t
tobe1424Asked:
Who is Participating?
 
savoneConnect With a Mentor Commented:
On linux the proxy settings are set per app.  You can set the proxy setting in firefox for regular browsing.

For more information see here:
http://www.putorius.net/2012/06/how-to-configure-system-proxy-settings.html
0
 
gheistCommented:
You can set proxy using environment variables:
https://wiki.archlinux.org/index.php/proxy_settings

Some programs take only http_proxy. some need username in different environment variable, some has selectable option to actually use system variables, but still say with 'export all_proxy=http://me:secure@proxy.corp:12345/' all scripting languages will use that proxy.
Graphical browsers with javascript interpreter can use PAC or WPAD, but no others can do that
0
 
tobe1424Author Commented:
The reason I asked about the proxy setting is because I was running an "apt-get" command to download a package and I receive errors. On my windows vm I added the proxy settings easily. However, using linux cli, I am not where exactly to specify the proxy
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
savoneCommented:
Enter the following command:

http_proxy=http://192.168.1.1:8080

Replace 192.168.1.1:8080 with your proxy IP address and port.

Once you enter the command try your apt-get command again.
0
 
tobe1424Author Commented:
Thanks for the feedback.

I cannot find "proxy.sh" inside /etc/profile.d/

nor can I find it in the system.

Is this something that needs to be installed?
0
 
gheistCommented:
You need to create executable file called proxy.sh that exports all variables.
YUM will ignore that.
0
 
tobe1424Author Commented:
Would this be a valid example of the shell script?

export http_proxy=http://10.203.0.1:5187/
 export https_proxy=$http_proxy
 export ftp_proxy=$http_proxy
 export rsync_proxy=$http_proxy
 export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
0
 
gheistCommented:
Why it should be an example? Yes, you posted valid list of shell commands.
0
 
tobe1424Author Commented:
edited the yum.conf file

# The proxy server - proxy server:port number
proxy=http://mycache.mydomain.com:3128
# The account details for yum connections
proxy_username=yum-user
proxy_password=qwerty
0
All Courses

From novice to tech pro — start learning today.