'Centos: Could not retrieve the mirrorlist
I am not able to install any service by using the yum command. When I try to install httpd by typing
[root@kstest /]# yum install httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 7 - "Failed to connect to 2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras error was
14: PYCURL ERROR 7 - "Failed to connect to 2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=updates error was
14: PYCURL ERROR 7 - "Failed to connect to 2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
* base: centos.aol.in
* extras: centos-hn.viettelidc.com.vn
* updates: centos.aol.in
http://centos.aol.in/6.5/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://centos.aol.in/6.5/os/x86_64/repodata/repomd.xml: (28, 'connect() timed out!')
Trying other mirror.
After that when I try to use yum command it says
Existing lock /var/run/yum.pid: another copy is running as pid 2063.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 22 M RSS (219 MB VSZ)
Started: Mon Jul 21 05:09:53 2014 - 01:09 ago
State : Traced/Stopped, pid: 2063
to unlock that I entered
ps aux | grep yum
kill -9 <pid number>
When I tried to update yum by typing
yum update -y
I am getting the following
[root@kstest etc]# yum update -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.aol.in
* extras: centos-hn.viettelidc.com.vn
* updates: centos.aol.in
http://centos.aol.in/6.5/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://centos.aol.in/6.5/os/x86_64/repodata/repomd.xml: (28, 'connect() timed out!')
Trying other mirror.
How do I resolve this issue ? How can I install httpd?
My yum.repos.d file present in etc/ is empty. and my yum.conf file is
[main]
proxy=http://proxy.com:8000
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
the proxy I have added it. it was not there from before.
Solution 1:[1]
I've been having this same issue since 6.4, I remain shocked that there isn't an easy to find solution. The quick workaround is to comment out all mirrorlist lines and uncomment all baseurl ones, but according to some people in some forums that's not a good thing to do.
Solution 2:[2]
This issue can be resolved by fixing your network setup. IPv6 mirrors don't work in all setups. What I do using Ansible is disabling IPv6 and also use Google's public resolver. The playbook assumes SELinux is disabled.
---
- hosts: all
user: vagrant
sudo: True
tasks:
- name: "disable ipv6"
shell: echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
- name: "disable ipv6"
shell: echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6
- name: "restart network"
service: name=network state=restarted
- name: "add public resolver"
lineinfile: dest=/etc/resolv.conf regexp='^nameserver'
line='nameserver 8.8.8.8' state=present
- name: "clean yum"
shell: yum clean all
- name: "warmup Yum"
shell: yum search libselinux-python
- name: "use Yum"
yum: name={{ item }} state=installed
with_items:
- libselinux-python
- name: "Enable SELinux"
selinux: policy=targeted state=permissive
Solution 3:[3]
If you define a proxy server in /etc/yum.conf, all users connect to the proxy server with those details when using yum. To enable all yum operations to use a proxy server, specify the proxy server details in /etc/yum.conf.
Add entry like below in /etc/yum.conf, to enable yum to use the proxy (here proxy server: abc.mydomain.com, connecting to port 8080)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Geoff Johnson |
Solution 2 | bbaassssiiee |
Solution 3 | shashijais789 |