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
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/
Note: mount: /dev/sr0 is write-protected, mounting read-only successfully mounted
View the mounted folder, command: ll /mnt/cdrom
Step 3: Make a backup before modifying the yum file
cp -r /etc/yum.repos.d /etc/yum.repos.d.bak
repos.d.bak is a backup file to ensure that it can be rolled back after an operation error
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/
vi centos.repo
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.
Step 5: Clear the local cache
yum clean all
View native yum source
yum repolist
View the installation package in the yum source
yum list
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.
This is because I have already installed it, so this message is displayed.