Setting Proxy Server for CentOS machine


Linux offers several possibilities when setting a proxy server on a CentOS machine. You can configure a proxy server for a single bash shell, for all users that have access on the machine or for specific user.

  • Configuring proxy server for a single bash shell: export http_proxy=http://proxy-server:port/

$ export http_proxy=http://192.168.1.10:3128/
$ export http_proxy=http://proxy.ppscu.com:3128/

The exported environment variable can be visualized by executing env or env | grep proxy:

[root@Linux-VM init.d]# env
HOSTNAME=Linux-VM
SELINUX_ROLE_REQUESTED=
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=192.168.61.1 53544 22
SELINUX_USE_CURRENT_RANGE=
SSH_TTY=/dev/pts/0
http_proxy=http://proxy.ppscu.com:3128/
USER=root

  • Configuring proxy server for all users: edit /etc/profile file

Use your desired text editor and add one of the following lines to the profiles file

export http_proxy=http://proxy.ppscu.com:3128/
export http_proxy=http://username:password@http://proxy.ppscu.com:3128/
  • Configuring proxy server for specific user: edit either ~/.bash_profile or $HOME/.bash_profile
Edit either one of these two files and add the following line
export http_proxy=http://username:password@http://proxy.ppscu.com:3128/
Advertisements

One thought on “Setting Proxy Server for CentOS machine

  1. I will immediately grasp your rss as I can’t to find your email subscription link or e-newsletter service.

    Do you have any? Kindly permit me know so that I could subscribe.
    Thanks.

    Like

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s