1、安装 createrepo
createrepo 命令用于创建 yum 源(软件仓库),即为存放于本地特定位置的众多 rpm 包建立索引,描述各包所需依赖信息,并形成元数据。
yum install -y createrepo
yum 开启缓存的方法
vim /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=1 #修改为 1 表示开启缓存
2、安装 php 源
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtaticrelease.rpm
3、安装 php 和 nextcloud 需要的功能模块
yum install -y php72w php72w-cli php72w-common php72w-curl php72w-gd php72w-mbstring php72w-mysqlnd php72w-process php72w-xml php72w-zip php72w-opcache php72w-pecl-apcu php72w-intl php72w-pecl-redis
4、然后执行安装就会把软件包下载到本地
mkdir /opt/php72
cd /var/cache/yum/x86_64/7/
find ./ -name "*.rpm" -exec cp -r {} /opt/php72 \;
5、使用 createrepo 就制作本地 yum 源
cd /opt/php72
createrepo ./
cd ..
tar -zcvf php7.tar.gz php7
6、搭建本地 yum 仓库
tar zxvf php72.tar.gz -C /opt/
7、创建 yum 配置文件
vim /etc/yum.repos.d/php72.repo
[php72]
name=php72
baseurl=file:///opt/php72
enable=1
gpgcheck=0