CentOS 7.3 mirror mount to build local yum source

Author: chenhao
to operate on a virtual machine, for example
the first step: first in the state of the virtual machine device "connected" before playing on the hook, determine in clicks
Insert picture description here

Insert picture description here
Step 2: Mount the CD-ROM, command mount /dev/cdrom /mnt/cdrom/
to mount the CD-ROM under mnt/cdrom

mount /dev/cdrom /mnt/cdrom/

Insert picture description here
Note: mount: /dev/sr0 is write-protected, mounting read-only successfully mounted

View the mounted folder, command: ll /mnt/cdrom
Insert picture description here
Step 3: Make a backup before modifying the yum file

cp -r /etc/yum.repos.d /etc/yum.repos.d.bak

Insert picture description here
repos.d.bak is a backup file to ensure that it can be rolled back after an operation error
Insert picture description here

Step 4: Modify the yum file
Go to the /etc/yum.repos.d/ file, and create a new .repo text file under the file

cd /etc/yum.repos.d/

Insert picture description here

vi centos.repo

Insert picture description here
Edit the following command in centos.repo

[cccc]                                           #库名称
name=CentOS                  			 #名称描述
baseurl=file:///mnt/cdrom/                      #yum源目录,源地址
gpgcheck=0                                          #检查GPG-KEY,0为不检查,1为检查
#enabled=1                                        #是否用该yum源,0为禁用,1为使用
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7  #GPG-KEY秘钥,gpgcheck的值为0时不需要配置

Note: gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 This command does not need to be configured.
Insert picture description here
Step 5: Clear the local cache

yum clean all

Insert picture description here
View native yum source

yum repolist

Insert picture description here
View the installation package in the yum source

yum list

Insert picture description here
Too many installation packages are not convenient to take screenshots
Through these three-step verification, you can know that the local yum source is successfully built.
Install httpd via local yum source

yum -y install httpd

With -y, you don't need to enter yes.
Insert picture description here
Insert picture description here
This is because I have already installed it, so this message is displayed.

Guess you like

Origin blog.csdn.net/m0_52425873/article/details/112909721