一、将镜像上传至服务器
二、挂载本地安装vsftp
[root@ ~]# mkdir /yum
[root@ ~]# mv /home/4ajr/CentOS-7-x86_64-DVD-2009.iso /
[root@ ~]# mount -o loop /CentOS-7-x86_64-DVD-2009.iso /yum
mount: /dev/loop0 is write-protected, mounting read-only
[root@ ~]# yum repolist
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
repo id repo name status
!rhel7.6 rhel7.6 5,152
repolist: 5,152
[root@ ~]# vim /etc/yum.repos.d/
redhat.repo centos.repo
[root@ ~]# vim /etc/yum.repos.d/centos.repo
[centos]
name=centos
baseurl=file:///yum
enabled=1
gpgcheck=0
三、安装httpd并挂载镜像
[root@ ~]# yum -y install httpd
[root@ ~]# cd /var/www/html
[root@ pub]# mkdir centos7
[root@ pub]# mount -o loop /CentOS-7-x86_64-DVD-2009.iso
/var/www/html/centos7
mount: /dev/loop2 is write-protected, mounting read-only
[root@ ]# service httpd restart
四、客户端验证
[root@ ~]# vim /etc/yum.repos.d/RHEL.repo
[http]
name=http
baseurl=http://1.1.1.1/centos7
enabled=1
gpgcheck=0
[root@ ~]# yum clean all
[root@ ~]# yum repolist
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
http | 3.6 kB 00:00:00
(1/2): http/group_gz | 153 kB 00:00:00
(2/2): http/primary_db | 3.3 MB 00:00:00
repo id repo name status
http http 4,070
repolist: 4,070
[root@ ~]# yum -y install telnet
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package telnet.x86_64 1:0.17-65.el7_8 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================================================================================
Installing:
telnet x86_64 1:0.17-65.el7_8 http 64 k
Transaction Summary
================================================================================================================================================================================================
Install 1 Package
Total download size: 64 k
Installed size: 113 k
Downloading packages:
telnet-0.17-65.el7_8.x86_64.rpm | 64 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:telnet-0.17-65.el7_8.x86_64 1/1
Verifying : 1:telnet-0.17-65.el7_8.x86_64 1/1
Installed:
telnet.x86_64 1:0.17-65.el7_8