How to resolve yum error [Errno 14] PYCURL ERROR 6 – “Couldn’t resolve host”
หากเกิด error “[Errno 14] PYCURL ERROR 6 – “Couldn’t resolve host”” เมื่อทำการ Install หรือ Update ระบบผ่าน yum หลังจากติดตั้ง CentOS เสร็จเรียบร้อย ดังตัวอย่างด้านล่าง
[shell]http://mirrors.psu.ac.th/pub/centos/6.4/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 – "Couldn’t resolve host ‘mirrors.psu.ac.th’"
Trying other mirror.
http://mirrors.neusoft.edu.cn/centos/6.4/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 – "Couldn’t resolve host ‘mirrors.neusoft.edu.cn’"
Trying other mirror.
http://mirrors.yun-idc.com/centos/6.4/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 – "Couldn’t resolve host ‘mirrors.yun-idc.com’"
Trying other mirror.
http://mirrors.stuhome.net/centos/6.4/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 – "Couldn’t resolve host ‘mirrors.stuhome.net’"
Trying other mirror.
http://centos.ustc.edu.cn/centos/6.4/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 – "Couldn’t resolve host ‘centos.ustc.edu.cn’"
Trying other mirror.[/shell]
การตรวจสอบและแก้ไข error “[Errno 14] PYCURL ERROR 6 – “Couldn’t resolve host”” สามารถทำได้ดังนี้
- ตรวจสอบการใช้งานระบบ network ของเครื่องว่าสามารถใช้งานได้หรือไม่
- ตรวจสอบการ lookup DNS ว่าสามารถใช้งานได้หรือไม่ ถ้าหากไม่สามารถใช้งานได้ ให้ตรวจสอบที่ไฟล์ /etc/resolv.conf โดยตรวจสอบ name server ว่ามีการ setup ถูกต้องหรือไม่
ถ้าหากตรวจสอบครบทั้ง 2 ข้อแล้วแต่ยังไม่สามารถใช้งานได้ ปัญหาน่าจะเกิดจาก IPv6 ซึ่งทางแก้ไขปัญหาสามารถทำได้ 2 วิธีด้วยกัน คือ
- ทำการ map domain และ IP ที่โปรแกรม yum ต้องใช้งานในไฟล์ /etc/hosts (วิธีนี้จะต้องทำการ set baseurl บนไฟล์ repo เพื่อให้ระบบสามารถดึงไฟล์ได้ถูกต้อง)
- ปิดการใช้งาน IPv6 สามารถทำได้ดังนี้
สร้างไฟล์ /etc/modprobe.d/ipv6.conf และใน parameter ด้านล่างลงไป[shell]options ipv6 disable=1
install ipv6 /bin/true
blacklist ipv6[/shell]