新架了一台Centos 8的主機,要用yum先做一些元件更新時,都會跳出同步baseos/appstream/extract 快取失敗的問題。
查了一下,原來是centos8的repo路徑有變,但設定檔裡的路徑還是舊的,所以要改掉。
設定檔的路徑在/etc/yum.repos.d/,裡面有很多xxx.repo檔,檔案裡都有一個baseurl=httpxxxxxxxxxxxxxxxxxxxxxx的路徑,要改掉。
大部分國外的網站都說是把原本的mirror.centos.org改到vault.centos.org,大陸那邊的網站則是說改到http://mirrors.cloud.aliyuncs.com。
後來研究了很久,自己是改到https://mirrors.aliyun.com/centos/8-stream/xxxxxxx,這個網站可以直接用瀏覽器連上,後面的xxxx是要看你的錯誤訊息,看你是哪個快取找不到,就去網站上找到相對應的路徑,貼到設定檔上,就行了。
如果出現下列訊息,也會有可能是提供的網站已不存在,所以會有403的錯誤碼。
搞了兩天才弄好,分享給大家看一下,另外就是防火牆要注意,因為後來發現設定沒錯,但還是連不上,是因為自己的防火牆有擋一些東西,所以如果設定改好還失敗,可以查檢一下防火牆。
CentOS 8 Yum Update Failure - Failed to Synchronize Cache for 'AppStream' Repository
I encountered an issue with my newly deployed CentOS 8 server where I couldn't perform component updates using Yum. Every time I tried, I received an error indicating the failure to synchronize the baseos/appstream/extract cache.
After investigating, I discovered that the repository paths for CentOS 8 had changed, but the configuration files still contained the old paths, requiring modification. The configuration files are located in /etc/yum.repos.d/ and contain multiple xxx.repo files. Within each file, there is a baseurl=httpxxxxxxxxxxxxxxxxxxxxxx path that needs to be updated.
Most foreign websites suggested replacing the original mirror.centos.org with vault.centos.org, while some Chinese websites recommended using http://mirrors.cloud.aliyuncs.com. After extensive research, I found that modifying it to https://mirrors.aliyun.com/centos/8-stream/xxxxxxx worked for me. This website can be accessed directly through a browser, and the xxxxxx part depends on the error message you receive. Look for the corresponding path on the website and paste it into the configuration file.
If you encounter the following message, it's possible that the provided website no longer exists, resulting in a 403 error code.
After spending two days troubleshooting, I wanted to share this solution. Additionally, be mindful of your firewall settings. In my case, even though my configuration was correct, I still couldn't establish a connection. It turned out that my firewall was blocking certain elements. So, if you've made the necessary configuration changes but are still experiencing issues, check your firewall settings.