Solve CentOS6.9 use yum to install gccError: Cannot find a valid baseurl for r
Enter yum-y install gcc and the error "cocould not retrieve into list http://mirrorlist.centos.org..." is reported ....
Error: Cannot find a valid baseurl for repo: base.
The error is that the network yum source cannot be connected. We can download it from the CD.
Solution:
1. Hanging on a CD:
Mount/dev/cdrom/mnt/cdrom
2. Enter the file/etc/yum. repos. d/to make the network yum source invalid, that is, the source files except the CentOS-Media.repo in yum. repos. d are invalid:
Method 1: Modify the CentOS-Base.repo file name to CentOS-Base.repo.bak (change. repo to other will be invalid );
Method 2: change enable = 1 in the network yum source file to = 0.
3. Modify the disc yum source file CentOS-Media.repo:
Baseurl = file: // media/CentOS is changed to file: // mnt/cdrom, that is, to the disk Mount address/mnt/cdrom, comment out other non-existent file addresses; and enable is set to 1.