yum 源更新代理环境

公司机器需要代理才能上网,之前用yum下载一些资源提示错误,就更新了yum的repo到163,
结果 yum clean all 之后,执行yum makecache 提示
http://mirrors.163.com/centos/7/os/x86_64/repodata/repodata/repomd.xml:[Errno -1] Error importing repomd.xml for base: Damaged repomd.xml file”

可是我用wget http://mirrors.163.com/centos/7/os/x86_64/repodata/repodata/repomd.xml 是成功的,百度了不少文章,也没看到所以然,只说和网络有关。最后实在没办法,还是去google查吧,在某个英文论坛把回帖都看完了,居然找到方法了,原来

/etc/yum.conf 文件中,不仅要配置 proxy,还要配置proxy_username,proxy_password ,配置成功即可。