1. Download the system ISO file
http://isoredirect.centos.org/centos/7/isos/x86_64/
2. Start Apache HTTP Server, generally Centos system pre-installs httpd, if not installed, you can download and install it yourself ( httpd download link )
systemctl start httpd
systemctl status httpd
3. Create an ISO file mounting directory and mount the ISO file
mkdir /var/www/html/centos7
mount CentOS-7-x86_64-Everything-2003.iso /var/www/html/centos7
4. Open the browser to test the local library
Enter http://172.168.***.***/centos7/ in the browser to display the following figure,
5. Back up the original warehouse files
cd /etc/yum.repos.d
mkdir backup
mv CentOS* ./backup
6. Create a local warehouse file
vim Centos-LocalBase.repo
Add the following content to save:
[local-repo]
name=local-repo
baseurl=http://172.168.***.***/centos7/
enabled=1
gpgcheck=0
gpgkey=http://172.168.***.***/centos7/RPM-GPG-KEY-CentOS-7
7. Clear the original yum cache and generate a new cache
sudo yum clean all
sudo yum makecache
8. Test yum warehouse
yum list | more