After successfully installing CentOS 8 on our Cloud VPS and running it for an extended period without updates, we encountered an error when attempting to perform a system update:
[[email protected] ~]# yum update
CentOS Linux 8 - AppStream 265 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
This error message indicates that the repository mirrorlist URLs have become unreachable. The root cause is that CentOS 8 reached End of Life (EOL) on December 31, 2021, meaning the CentOS Project no longer provides updates or support for this version.
Understanding CentOS 8 End of Life
What Happened to CentOS 8?
CentOS 8 was originally scheduled to receive support until 2029, following the traditional 10-year lifecycle. However, in December 2020, Red Hat announced a significant shift in the CentOS project strategy:
- CentOS 8 EOL accelerated to December 31, 2021
- Focus shifted to CentOS Stream, a rolling-release distribution
- Traditional CentOS Linux discontinued in favor of the upstream development model
Impact on Existing Systems
When CentOS 8 reached EOL:
- All official mirrors stopped hosting CentOS 8 packages
- Security updates and bug fixes ceased
- Repository metadata became inaccessible
- Systems could no longer receive updates through standard channels
Solution: Migrating to Vault Repositories
To resolve the repository error and continue using CentOS 8 (though not recommended for production), you can redirect your repositories to the archived vault.centos.org:
Method 1: Quick Repository Fix
Step 1: Navigate to the repository configuration directory
cd /etc/yum.repos.d/
Step 2: Comment out the mirrorlist entries
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
Step 3: Enable and update baseurl to point to vault
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
Step 4: Clean cache and update
yum clean all
yum update -y
Method 2: Manual Repository Configuration
For more control, manually edit each repository file:
# Edit each repository file individually
vi /etc/yum.repos.d/CentOS-Linux-BaseOS.repo
vi /etc/yum.repos.d/CentOS-Linux-AppStream.repo
vi /etc/yum.repos.d/CentOS-Linux-Extras.repo
In each file, modify the configuration:
[baseos]
name=CentOS Linux $releasever - BaseOS
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
baseurl=http://vault.centos.org/8.5.2111/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Method 3: Using Alternative Mirrors
Some community mirrors still host CentOS 8 packages:
# Example using a community mirror
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://archive.kernel.org/centos-vault|g' /etc/yum.repos.d/CentOS-*
Migration Strategies for Production Systems
Immediate Actions Required
ā ļø Security Warning: Using EOL CentOS 8 in production poses significant security risks due to lack of security updates.
Recommended Migration Paths
1. CentOS Stream 8 (Short-term)
- Rolling-release model
- Upstream for RHEL 8
- Note: CentOS Stream 8 also reached EOL on May 31, 2024
# Convert to CentOS Stream 8 (if still available)
dnf install centos-release-stream
dnf distro-sync
2. Rocky Linux 8 (Recommended)
- Community-driven RHEL clone
- Binary-compatible with RHEL 8
- Long-term support
# Migration using migrate2rocky script
curl -O https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh
chmod +x migrate2rocky.sh
./migrate2rocky.sh -r
3. AlmaLinux 8 (Alternative)
- Another RHEL-compatible distribution
- Backed by CloudLinux
# Migration using almalinux-deploy script
curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh
chmod +x almalinux-deploy.sh
./almalinux-deploy.sh
4. RHEL 8 (Enterprise)
- Official Red Hat Enterprise Linux
- Commercial support available
- Free for development use
# Convert using convert2rhel tool
subscription-manager register
dnf install convert2rhel
convert2rhel
Advanced Troubleshooting
Common Issues and Solutions
Issue 1: GPG Key Errors
# Import CentOS GPG keys
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Issue 2: Dependency Conflicts
# Force package downgrade if needed
yum downgrade package-name
# Or skip broken packages
yum update --skip-broken
Issue 3: Repository Priority Conflicts
# Install yum priorities plugin
yum install yum-plugin-priorities
# Configure repository priorities in .repo files
Verification Steps
After fixing repositories, verify the configuration:
# Check repository status
yum repolist
yum repoinfo
# Verify package availability
yum check-update
# Test package installation
yum install -y vim
Best Practices for Future Migrations
1. Proactive Planning
- Monitor EOL schedules for your distributions
- Plan migrations 6-12 months before EOL
- Test migration procedures in development environments
2. Backup Strategy
- Create full system backups before migration
- Document current system configuration
- Test backup restoration procedures
3. Staged Migration
- Migrate non-critical systems first
- Validate application compatibility
- Plan maintenance windows for production systems
4. Alternative Distributions
Consider distributions with longer support cycles:
- Ubuntu LTS: 5-year support cycle
- RHEL: 10-year lifecycle
- SUSE Linux Enterprise: 13-year support
- Debian: ~5-year support cycle
Container and Cloud Considerations
Container Images
Update container base images to supported distributions:
# Replace CentOS 8 base images
# FROM centos:8
FROM rockylinux:8
# or
FROM almalinux:8
Cloud Instances
- Update AMIs/images to supported distributions
- Use infrastructure as code for consistent deployments
- Implement automated patching for security updates
Conclusion
The CentOS 8 EOL represents a significant shift in the enterprise Linux landscape. While the vault.centos.org solution provides temporary access to packages, it should only be used as a short-term measure for non-production systems.
Key Takeaways:
- Immediate action required for CentOS 8 systems in production
- Multiple migration paths available (Rocky Linux, AlmaLinux, RHEL)
- Security risks of running EOL systems without updates
- Importance of proactive planning for future EOL events
For production environments, we strongly recommend migrating to a supported distribution like Rocky Linux or AlmaLinux, which provide binary compatibility with RHEL 8 and ongoing security updates. The migration tools available make this process relatively straightforward, and the long-term benefits far outweigh the short-term effort required.