Centos 7创建离线epel源
1、环境准备
准备好一台可用联网的机器,并配置好在线epel源,在线epel源可用使用腾讯的:参考:https://mirrors.cloud.tencent.com/help/epel.html
1 | wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-7.repo |
也可以使用其它,例如:
1 2 3 4 | curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo wget -O /etc/yum.repos.d/epel.repo https://repo.huaweicloud.com/repository/conf/epel-7-reg.repo |
可以通过 yum info pssh
测试在线epel源:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | [root@localhost ~]# yum info pssh Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Available Packages Name : pssh Arch : noarch Version : 2.3.1 Release : 5.el7 Size : 49 k Repo : epel/7/x86_64 Summary : Parallel SSH tools URL : http://code.google.com/p/parallel-ssh/ License : BSD Description : This package provides various parallel tools based on ssh and scp. : Parallell version includes: : o ssh : pssh : o scp : pscp : o nuke : pnuke : o rsync : prsync : o slurp : pslurp |
可用看到pssh包的信息,说明配置成功。
2、下载安装制作工具包
1 | yum install yum-utils createrepo xorriso |
3、把epel源中的rpm包下载到本地
截至目前2023.03.14有13766个rpm包,共约16G大小。
1 | reposync -r epel -p /data/epel/ |
4、制作本地仓库
1 | createrepo -v /data/epel |
5、可以直接使用或制作成iso镜像文件
直接使用
1 2 3 4 5 6 7 | cat > /etc/yum.repos.d/offline-epel.repo << "EOF" [epel2] name=epel2 baseurl=file:///data/epel enabled=1 gpgcheck=0 EOF |
或制成镜像之后挂载使用
1 | mkisofs -r -o /data/centos7-epel.iso /data/epel |
6、本地使用测试
1 2 3 4 | yum clean all yum makecache yum reinstall -y pssh |
7、配置服务作为服务端
1 2 3 | # 可以用Apache或nginx提供web服务,但用Python的http模块更简单,适用于内网环境 cd /data/epel nohup python -m SimpleHTTPServer 80 &>/dev/null & |