CentOS/AlmaLinux Error: Failed to download metadata for repo 'appstream'
How to fix 'Cannot prepare internal mirrorlist - No URLs in mirrorlist' on CentOS 7/8 and AlmaLinux
Cause
This error typically appears on CentOS 8 because the CentOS 8 project reached End of Life on December 31, 2021. Official mirrors no longer exist.
Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist:
No URLs in mirrorlistSolution for CentOS 8 (EOL)
Option 1: migrate to AlmaLinux 8 (recommended)
AlmaLinux 8 is the official replacement, binary compatible with CentOS 8:
# Install migration tool
curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh
chmod +x almalinux-deploy.sh
sudo bash almalinux-deploy.sh
# Restart
sudo reboot
# Verify
cat /etc/almalinux-releaseOption 2: use vaults (only for temporary updates)
If you can't migrate yet, redirect to archive vault:
# Replace mirrors with CentOS vaults
sudo sed -i 's|mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-*
sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
# Update
sudo dnf update -ySolution for CentOS 7 (EOL since June 30, 2024)
# Redirect to vaults
sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
# Test
sudo yum update -yCentOS 7 reached End of Life. It no longer receives security updates. Migrating to AlmaLinux 9 or Rocky Linux 9 is recommended.
Solution for AlmaLinux / Rocky Linux (temporarily unreachable mirrors)
If the problem is temporary (mirror offline):
# Clean yum/dnf cache
sudo dnf clean all
sudo dnf makecache
# Force a specific mirror
sudo dnf update --setopt=fastestmirror=True -y
# Check which repos are enabled
sudo dnf repolistDisable a problematic repo
# Temporarily disable appstream
sudo dnf update --disablerepo=appstream -y
# Or modify the repo file
sudo nano /etc/yum.repos.d/almalinux-appstream.repo
# Change enabled=1 to enabled=0Install iptables on CentOS 7 / AlmaLinux
# CentOS 7
sudo yum install iptables-services -y
sudo systemctl start iptables
sudo systemctl enable iptables
# AlmaLinux 8/9 (uses nftables by default, but you can install iptables)
sudo dnf install iptables-services -y
sudo systemctl disable firewalld
sudo systemctl stop firewalld
sudo systemctl start iptables
sudo systemctl enable iptables
# Verify
sudo iptables -L -nBasic iptables configuration on CentOS/AlmaLinux
# Save current config
sudo service iptables save
# Configuration file
cat /etc/sysconfig/iptables
# Reload rules
sudo systemctl restart iptablesMigrate from CentOS 7 to AlmaLinux 9
Direct migration 7 → 9 is not supported. Recommended path:
- Make a complete backup of server (VirtFusion snapshot)
- Note all installed packages:
rpm -qa > /tmp/packages-centos7.txt - Reinstall the VPS with AlmaLinux 9 from VirtFusion panel
- Reinstall necessary packages on new system
See the guide OS Reinstallation to reinstall from panel.
Common Windows Server Issues
Solutions to frequent Windows VPS errors - expired license, missing DLLs, locked account, firewall and more
Expired SSL Certificate: Renewal and Resolution
Your site shows 'Certificate not valid' or 'Connection is not private'? Guide to renewing Let's Encrypt certificates and preventing with automatic renewal.