首页 » IDC运维 » cobbler镜像阿里云yum仓库供内网机器使用

cobbler镜像阿里云yum仓库供内网机器使用

 

参考博客:https://www.longger.net/article/41354.html

这里以镜像centos7.7的阿里云yum基本源和update源以及epel为例

1,创建repo

#基本仓库
cobbler repo add --name=centos7.7x64 --mirror=https://mirrors.aliyun.com/centos/7.7.1908/os/x86_64/  --arch=x86_64 --breed=yum

#更新的仓库
cobbler repo add --name=centos7.7x64update --mirror=https://mirrors.aliyun.com/centos/7.7.1908/updates/x86_64/

#epel仓库
cobbler repo add --name=centos7.7x64epel --mirror=https://mirrors.aliyun.com/epel/7/x86_64/ --arch=x86_64 --breed=yum

2,同步

cobbler reposync 

若有多个repo,可以指定某一个同步
cobbler reposync --only=“仓库名

3,给profile添加repos

cobbler profile edit --name=Centos-7.7-x86_64 --repos=“centos7.7x64  centos7.7x64update centos7.7x64epel”

4,在内网机器自动安装后测试

yum install vim --enablerepo=centos7.7x64

补充:

1,使用cobbler装机的内网机器会自带一个cobbler-config.repo 文件这个是cobbler在导入镜像时自动生成的repo,是光盘镜像的yum源,这个可能不是最新的,所以我们镜像阿里云的Yum源是有必要的。

2,如果内网机器已经装好了,是后来镜像的yum仓库,可以将制作repo文件发送到内网机器。

cd /var/www/cobbler/repo_mirror

cat */config.repo >> pxe.repo

sed -i 's/${http_server}/192.168.1.200/g' pxe.repo 

scp pxe.repo [email protected]:/etc/yum.repos.d/

192.168.1.200是cobbler服务器的IP
192.168.1.100是内网机器的IP

原文链接:cobbler镜像阿里云yum仓库供内网机器使用,转载请注明来源!

0