离线化yum源的方法
首先准备一个excludes.list
文件,作为排除的列表,如果不想排除,可以不用这个文件,并且将离线化脚本中的参数--exclude-from=exclude.list
删除。
exclude.list文件内容:
SRPMS
aarch64
ppc64
ppc64le
debug
repodata
EFI
LiveOS
images
isolinux
CentOS_BuildTag
EULA
GPL
RPM-GPG-KEY-CentOS-7
RPM-GPG-KEY-CentOS-Testing-7
drpms
离线化脚本rsync.sh,会在当前目录下创建一个centos
的目录,并将源内容同步到这个目录,通过createrepo
命令创建yum仓库。离线文件总计27G左右,执行前确认空间足够。如果不使用exclude.list
,占用空间只会更多。脚本内容:
#!/bin/bash
#epel
rsync -avz --exclude-from=exclude.list rsync://mirrors.tuna.tsinghua.edu.cn/epel/7/ epel/7/
createrepo epel/7/
#centos7-base
rsync -avz --exclude-from=exclude.list rsync://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/ centos/7/os/x86_64/
createrepo centos/7/os/x86_64/
#centos7-updates
rsync