一键同步 centos, openeuler, openanolis, alinux 各版本的镜像源(x86, arm),并生成本地镜像源
step1, 安装相关工具
yum install createrepo yum-utils -y
step2, 添加各种源
[epel-el8-x86-64]
name=Extra Packages for Enterprise Linux 8 x86_64
baseurl=https://mirrors.aliyun.com/epel/8/Everything/x86_64
failovermethod=priority
enabled=0
gpgcheck=0
[epel-el8-arm64]
name=Extra Packages for Enterprise Linux 8 arm_64
baseurl=https://mirrors.aliyun.com/epel/8/Everything/aarch64
failovermethod=priority
enabled=0
gpgcheck=0
[epel-el7-x86-64]
name=Extra Packages for Enterprise Linux 8 x86_64
baseurl=https://mirrors.aliyun.com/epel/7/x86_64
failovermethod=priority
enabled=0
gpgcheck=0
[epel-el7-arm64]
name=Extra Packages for Enterprise Linux 7 arm_64
baseurl=https://mirrors.aliyun.com/epel/7/aarch64
failovermethod=priority
enabled=0
gpgcheck=0
[rpmfusion-el7-x86]
name=RPM Fusion for EL 7 - Free - Updates
baseurl=https://mirrors.aliyun.com/rpmfusion/free/el/updates/7/x86_64/
enabled=0
gpgcheck=0
[rpmfusion-el8-x86]
name=RPM Fusion for EL 8 - Free - Updates
baseurl=https://mirrors.aliyun.com/rpmfusion/free/el/updates/8/x86_64/
enabled=0
gpgcheck=0
[docker-el7-x86-64]
name=docker ce
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable
enabled=0
gpgcheck=0
[docker-el7-arm64]
name=docker ce
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/aarch64/stable
enabled=0
gpgcheck=0
[docker-el8-x86-64]
name=docker ce
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/8/x86_64/stable
enabled=0
gpgcheck=0
[docker-el8-arm64]
name=docker ce
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/8/aarch64/stable
enabled=0
gpgcheck=0
[nginx-el7-x86-64]
name=nginx
baseurl=http://nginx.org/packages/centos/7/x86_64
enabled=0
gpgcheck=0
[nginx-el7-arm64]
name=nginx
baseurl=http://nginx.org/packages/centos/7/aarch64
enabled=0
gpgcheck=0
[nginx-el8-x86-64]
name=nginx
baseurl=http://nginx.org/packages/centos/8/x86_64
enabled=0
gpgcheck=0
[nginx-el8-arm64]
name=nginx
baseurl=http://nginx.org/packages/centos/8/aarch64
enabled=0
gpgcheck=0
step3, 同步源
mirror=/mnt/mirror
#epel
reposync --norepopath -g -l -d -m --repoid=epel-el7-x86-64 --newest-only --download-metadata --download_path=$mirror/epel/7/x86_64
reposync --norepopath -g -l -d -m --repoid=epel-el7-arm64 --newest-only --download-metadata --download_path=$mirror/epel/7/aarch64
createrepo -g comps.xml $mirror/epel/7/aarch64
createrepo -g comps.xml $mirror/epel/7/x86_64
reposync --norepopath -g -l -d -m --repoid=epel-el8-x86-64 --newest-only --download-metadata --download_path=$mirror/epel/8/x86_64
reposync --norepopath -g -l -d -m --repoid=epel-el8-arm64 --newest-only --download-metadata --download_path=$mirror/epel/8/aarch64
createrepo -g comps.xml $mirror/epel/8/aarch64
createrepo -g comps.xml $mirror/epel/8/x86_64
#rpmfusion
reposync --norepopath -g -l -d -m --repoid=rpmfusion-el7-x86 --newest-only --download-metadata --download_path=$mirror/rpmfusion/7/x86_64
reposync --norepopath -g -l -d -m --repoid=rpmfusion-el8-x86 --newest-only --download-metadata --download_path=$mirror/rpmfusion/8/x86_64
createrepo -g comps.xml $mirror/rpmfusion/7/x86_64
createrepo -g comps.xml $mirror/rpmfusion/8/x86_64
#nginx
reposync --norepopath -g -l -d -m --repoid=nginx-el7-x86-64 --newest-only --download-metadata --download_path=$mirror/nginx/7/x86_64
reposync --norepopath -g -l -d -m --repoid=nginx-el7-arm64 --newest-only --download-metadata --download_path=$mirror/nginx/7/aarch64
createrepo -g comps.xml $mirror/nginx/7/aarch64
createrepo -g comps.xml $mirror/nginx/7/x86_64
reposync --norepopath -g -l -d -m --repoid=nginx-el8-x86-64 --newest-only --download-metadata --download_path=$mirror/nginx/8/x86_64
reposync --norepopath -g -l -d -m --repoid=nginx-el8-arm64 --newest-only --download-metadata --download_path=$mirror/nginx/8/aarch64
createrepo -g comps.xml $mirror/nginx/8/aarch64
createrepo -g comps.xml $mirror/nginx/8/x86_64
#docker
reposync --norepopath -g -l -d -m --repoid=docker-el7-x86-64 --newest-only --download-metadata --download_path=$mirror/docker/7/x86_64
reposync --norepopath -g -l -d -m --repoid=docker-el7-arm64 --newest-only --download-metadata --download_path=$mirror/docker/7/aarch64
createrepo -g comps.xml $mirror/docker/7/aarch64
createrepo -g comps.xml $mirror/docker/7/x86_64
reposync --norepopath -g -l -d -m --repoid=docker-el8-x86-64 --newest-only --download-metadata --download_path=$mirror/docker/8/x86_64
reposync --norepopath -g -l -d -m --repoid=docker-el8-arm64 --newest-only --download-metadata --download_path=$mirror/docker/8/aarch64
createrepo -g comps.xml $mirror/docker/8/aarch64
createrepo -g comps.xml $mirror/docker/8/x86_64
step 4, 使用源
修改操作对应的/etc/yum.repo.d
或者 /etc/apt/source.list
启用离线镜像