本篇文章更新時間:2019/02/16
如有資訊過時或語誤之處,歡迎使用 Contact 功能通知。
一介資男的 LINE 社群開站囉!歡迎入群聊聊~
如果本站內容對你有幫助,歡迎使用 BFX Pay 加密貨幣 或 新台幣 贊助支持。
這問題時不時會出現在安裝新機器的時候,之前好像是「反正就放給他timeout」的消極做法,剛剛居然谷歌到神方法!
參考:apt-get update stuck: Connecting to security.ubuntu.com
一堆解法說:「乾脆你就把 IPv6 給關了吧! 」這種又血腥又暴力的做法我實在不是很想用~
這次的解法是針對請求內容時「IPv4 的權重為先」,如此而已!方法如下:
vi /etc/gai.conf
找到 #precedence ::ffff:0:0/96 100
然後解註解,存擋,搞定!
#技術相關 #IPv6 #IPv4 #Ubuntu #VPS #Server #Stuck #apt-get
- Powered by Mxp.TW -FB2WP-
印象中不用這麼麻煩 apt-get 有直接可以用 Ipv4 的選項
是這篇(http://unix.stackexchange.com/questions/9940/convince-apt-get-not-to-use-ipv6-method)
提到的方式? 似乎程序沒差多少啊XD
我有更阿Q的方法
把更新來源換到只有 IPv4 的站台就好了 例如 http://ftp.ntou.edu.tw
也是一招沒錯~
Encountering installation issues while setting up a new server can be frustrating. I recently faced a similar problem when trying to run `apt-get update`, where it would freeze when connecting to security.ubuntu.com. After reading numerous guides, the advice to “just turn off IPv6” was a common suggestion. However, I didn’t want to disable it entirely.
I found a more elegant solution that involves simply prioritizing IPv4 over IPv6. By editing the `/etc/gai.conf` file and uncommenting the line `#precedence ::ffff:0:0/96 100`, I was able to resolve the issue and continue with the update process smoothly.
During my troubleshooting journey, I also found a helpful guide on install python ubuntu, which provided valuable insights for other aspects of my server configuration. Happy to share this solution in case it helps someone else.