How to run yum behind a proxy sever

Configuring yum to run behind a proxy server is easy. You need to create an environment variable “http_proxy”. Yum will read it everytime it loads and run without any trouble.  

Open the file /etc/profile.d/proxy.sh. If this file doesn't exist then create one. You have to be root to do these changes.

 [jasonleon]$ vi /etc/profile.d/proxy.sh

and add the following line

export http_proxy=http://proxy:port/

where, 

proxy is your proxy server (like 192.168.36.1)

port is the port number

Now, run this command(do this as root)

[jasonleon]$ sh /etc/profile.d/proxy.sh

If yum is still not working then logout and login again, yum will start working.

This will add the setting for all users of the system. If a user wants to override this variable then the same line can be added in the file .bash_profile present in the home directory of the user. If the file is not present then create one.

3 Comments

Broncha (not verified)
March 31st, 2010 11:56 pm
Yeah ! worked for me.. Thanks !!
Francisco (not verified)
September 28th, 2010 07:35 pm
Or, you can edit /etc/yum.conf and add the following: proxy=http://: Good luck!
Vinayak M K (not verified)
January 2nd, 2011 03:19 pm
I have a problem here... My proxy server limits the download size to 5MB. Is there anyway I can enable proxy tunneling option or HTTP CONNECT method in yum through configuration file ?

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <p> <br>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Use syntax $$latex$$ to insert LaTeX formulas.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.
  • Search Engines will index and follow ONLY links to allowed domains.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.