I. Local CD-ROM yum source configuration
1. Create a mount point
[root@localhost ~]# mkdir /mnt/cdrom
2、Configure automatic local CD-ROM mounting
[root@localhost ~]# vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sun Oct 20 16:02:54 2024
...... omit part of ......
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
#Add automatic boot-mounted system CD-ROM
/dev/cdrom /mnt/cdrom iso9660 defaults 0 0
3. Configure the yum source
# Create a directory for backing up the original yum source files
[root@localhost ]# mkdir bak
#Move the original yum repositories to the bak directory
[root@localhost ]# mv *.repo bak
#Enter the bak directory
[root@localhost ]# cd bak
# Copy the CD-ROM yum source files to the /etc/ directory
[root@localhost bak]# cp ...
# Return to the /etc/ directory
[root@localhost bak]# cd ...
#Open the CD-ROM yum source file
[root@localhost ]# vim
# vim
...... omit part of ......
# yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/cdrom/ #Configure the mount point directory
# file:////media/cdrom/ # configure the mount point directory
# file:////media/cdrecorder/ # configure mount point directory
gpgcheck=1
enabled=1 #Enable. Change the default value from 0 to 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
4. Clean up and generate cache
[root@localhost ~]# yum clean all && yum makecache
Loaded plug-ins:fastestmirror, security
Cleaning repos: c6-media
Clear everything.
Cleaning up list of fastest mirrors
Loaded plug-ins:fastestmirror, security
Determining fastest mirrors
c6-media | 4.0 kB 00:00 ...
c6-media/group_gz | 226 kB 00:00 ...
c6-media/filelists_db | 6.3 MB 00:00 ...
c6-media/primary_db | 4.7 MB 00:00 ...
c6-media/other_db | 2.8 MB 00:00 ...
Metadata cache created
5. View yum sources
[root@localhost ~]# yum repolist
Loaded plug-ins:fastestmirror, security
Loading mirror speeds from cached hostfile
Warehouse identification Warehouse name state of affairs
c6-media CentOS-6 - Media 6,696
repolist: 6,696
Second, AliCloud yum source configuration
1. Backup the original source configuration file of the system
# Go to the directory where the yum source files are stored
[root@localhost ~]# cd /etc//
#Create a directory to back up the original yum source files
[root@localhost ]# mkdir bak
# Move the original yum source files to the backup directory
[root@localhost ]# mv *.repo bak
2、Download AliCloud yum source configuration file
#CentOS6
wget -O /etc// /repo/Centos-vault-6.
#CentOS7
wget -O /etc// /repo/
#CentOS8
wget -O /etc// /repo/Centos-vault-8.5.
Demonstration using CentOS6 as an example
# Download the Aliyun yum configuration file for CentOS6
[root@localhost ]# wget -O /etc// /repo/Centos-vault-6.
--2024-10-18 22:51:10 -- /repo/Centos-vault-6.
Resolving host ... 39.174.58.234, 39.174.58.233, 39.174.58.231, ...
Connecting |39.174.58.234|:443... Connected.
HTTP request sent, waiting for response... 200 OK
Length: 2533 (2.5K) [application/octet-stream]
Saving to: "/etc//"
100% [=====================================>] 2,533 -.K/s in 0s
2024-10-18 22:51:11 (422 MB/s) - Saved "/etc//" [2533/2533])
# Check to see if the download is complete
[root@localhost ]# ll
Total usage 8
drwxr-xr-x. 2 root root 4096 October 18 22:47 bak
-rw-r--r--. 1 root root 2533 August 4 2022
3、Clean the cache and generate a new cache
#Clearing the cache and generating a new one
[root@localhost ~]# yum clean all && yum makecache
Loaded plug-ins:fastestmirror, security
Cleaning repos: base extras updates
Clear everything.
Cleaning up list of fastest mirrors
Loaded plug-ins:fastestmirror, security
Determining fastest mirrors
* base:
* extras:
* updates:
base | 3.7 kB 00:00
base/group_gz | 242 kB 00:00
base/filelists_db | 6.4 MB 00:02
base/primary_db | 4.7 MB 00:00
base/other_db | 2.8 MB 00:00
extras | 3.4 kB 00:00
extras/filelists_db | 24 kB 00:00
extras/prestodelta | 2.2 kB 00:00
extras/primary_db | 29 kB 00:00
extras/other_db | 14 kB 00:00
updates | 3.4 kB 00:00
updates/filelists_db | 8.4 MB 00:01
updates/prestodelta | 357 kB 00:00
updates/primary_db | 12 MB 00:01
updates/other_db | 479 kB 00:00
Metadata cache created
4. View yum source
#ferret outyumroot
[root@localhost ~]# yum repolist
Loaded plug-ins:fastestmirror, security
Loading mirror speeds from cached hostfile
* base:
* extras:
* updates:
Warehouse identification Warehouse name state of affairs
base CentOS-vault-6.10 - Base - 6,713
extras CentOS-vault-6.10 - Extras - 47
updates CentOS-vault-6.10 - Updates - 1,193
repolist: 7,953