[SOLVED] LEARN HOW TO FIX "failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist" ON CENTOS 8
REQUIREMENTS
In order to complete this tutorial, the following is a list of items that are needed. Please ensure to have these items available before taking implementation action on this tutorial to ensure success:
1) A desktop, laptop or server with 4GB of RAM, a dual core processor and 50GB of free disk space or more
2) CENTOS 8 install of the desktop, laptop or server
3) Root user account privileges
4) An internet connection to download and install package updates
5) SSH or terminal access to the CENTOS 8 computer.
OVERVIEW
1) Brief explanation of the problem
2) Connect to the terminal or SSH interface of the server and fix the CENTOS 8 repo list
3) If step 2 solution does not work try step 3 solution
4) Run the commands yum update && yum upgrade and see if the issue has been resolved.
Brief explanation of the problem
1) According to the official CENTOS website, the CENTOS version 8 reached its end of life EOL on the 31st of DECEMBER 2021. This also means that the operating system no longer receives package and system updates and upgrades as you normally would which can make it difficult to deploy CENTOS 8 and run applications in your IT environment.
After installing CENTOS 8 on a server and you try to run the command: yum update or yum upgrade you can encounter the error message:
“failed to download metadata for repo ‘AppStream’ Cannot prepare internal mirrorlist”
This is actually due to the yum package manager failing to access the default CENTOS 8 repositories which are no longer available due to the END OF LIFE ISSUE, below you will learn a work around that you can try to resolve this issue.

2) To fix the problem open the terminal application on the CENTOS 8 computer and run the following command to change to the /etc/yum.repos.d/ directory
cd /etc/yum.repos.d/

3) Next, run the following commands to add a new package repository:
sed -i ‘s/mirrorlist/#mirrorlist/g’ /etc/yum.repos.d/CentOS-*
sed -i ‘s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g’ /etc/yum.repos.d/CentOS-*
if you face challenges running the above commands, you can also try the commands below:
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-*

4) Finally, run the yum update or yum upgrade command and you should be good!
