Settings for Yum using proxy under CentOS

Source: Internet
Author: User
Tags nameserver

Does it seem useless after export?

Problem Description:

 yum " Could not retrieve mirrorlist  http://mirrorlist.centos.org/? Release=5&arch=i386&repo=addons error  "error:

[Plain]View Plaincopyprint?
  1. [[email protected] mysql-5.0.56]# Yum install gcc
  2. Loaded Plugins:fastestmirror
  3. Loading mirror speeds from cached hostfile
  4. Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=i386&repo=addons error was
  5. [Errno 4] IOError: <urlopen error ( -3, ' \xe5\x9f\x9f\xe5\x90\x8d\xe8\xa7\xa3\xe6\x9e\x90\xe6\x9a\x82\xe6\x97\xb6\xe5\xa4\ Xb1\xe8\xb4\xa5 ') >
  6. Error:cannot find a valid baseurl for repo:addons

found that the original is not configured resolv.conf, so to the/etc directory configuration resolv.conf join nameserver IP:

[Plain]View Plaincopyprint?
  1. [Email protected] mysql-5.0.56]# vi/etc/resolv.conf
  2. NameServer 218.85.157.99
  3. Search Localdomain

Save the resolv.conf and run the above command again.

Because recently in the research Linux system, the company environment is limited, the company unifies the Internet through the proxy, I installed the Linux server on the virtual machine of own computer, therefore set up the agent in the virtual machine, the computer IP is xxx.xxx.xxx.xx, where HTTP port 808.

After the search on the Web finally found the final solution, and now posted out to share with you!

If you are only temporarily using a proxy, enter the following command at the command line:
Export http_proxy= "http://210.45.72.XX:808"

For long-term use of agents:
You can set up a separate agent in Yum
is the parameter of the Yum source plus proxy= "Http://ip:PORT"
That is, add the following sentence to the/etc/yum.conf.
proxy=http://210.45.72.xx:808
Proxy_username=username
Proxy_password=password
Other than that:
/ROOT/.BASHRC Add:
Export http_proxy= "Http://username:[email protected]:808"
If it is authenticated via IP or computer's network card address, all username and password can be ignored.
Note: When you stop using the agent, change the file to the original. Especially if the export http_proxy= "http://210.45.72.XX:808" command is used,
To enter: unset http_proxy on the command line, remove the environment variable.
Because the essence of the export http_proxy= "http://210.45.72.XX:808" command is to write the settings behind export into the environment settings file.
Enter Env to see all the environment variable settings.
env >env.txt can output the environment variable to env.txt, and then open it to see it.

The unset variable can cancel an environment variable that was previously set.

Reprint Please specify source: http://blog.csdn.net/fwj380891124

Settings for Yum using proxy under CentOS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.