以lvm2安装包为例
######本地######
[root@localhost ~]# mkdir -p lvm2 #创建临时文件夹用来存放lvm2安装包和依赖包
[root@localhost ~]# cd lvm2/
[root@localhost lvm2]# yum install -y yum-utils createrepo #安装yum源制作工具
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.qlu.edu.cn
* extras: mirrors.ustc.edu.cn
* updates: mirrors.ustc.edu.cn
软件包 yum-utils-1.1.31-54.el7_8.noarch 已安装并且是最新版本
软件包 createrepo-0.9.9-28.el7.noarch 已安装并且是最新版本
无须任何处理
[root@localhost lvm2]# repotrack lvm2 #下载安装包和依赖包
Downloading acl-2.2.51-15.el7.x86_64.rpm
Downloading audit-libs-2.8.5-4.el7.x86_64.rpm
Downloading audit-libs-2.8.5-4.el7.i686.rpm
Downloading basesystem-10.0-7.el7.centos.noarch.rpm
Downloading bash-4.2.46-35.el7_9.x86_64.rpm
Downloading binutils-2.27-44.base.el7_9.1.x86_64.rpm
Downloading bzip2-libs-1.0.6-13.el7.x86_64.rpm
......
[root@localhost lvm2]# createrepo . #制作yum源,制作完成后,该文件夹下会有repodata文件夹
Spawning worker 0 with 46 pkgs
Spawning worker 1 with 46 pkgs
Spawning worker 2 with 46 pkgs
Spawning worker 3 with 45 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@localhost lvm2]# tar zcvf lvm2.tar.gz ./lvm2
######内网######
[root@localhost lvm2]# tar zxvf lvm2.tar.gz #上传压缩包后解压
[root@localhost lvm2]# vim /etc/yum.repos.d/hrmw.repo #修改yum源
[root@localhost lvm2]# yum clean all && yum makecache #清除缓存重新加载yum源
[root@localhost lvm2]# yum install -y lvm2 #安装软件