介绍
Cobbler is a versatile Linux deployment server
github链接:https://github.com/cobbler/cobbler
官网:https://cobbler.github.io/
文档:https://cobbler.readthedocs.io/en/latest/quickstart-guide.html
cobbler in docker博客:
https://blog.container-solutions.com/cobbler-in-a-docker-container
https://hub.docker.com/r/ethnchao/cobbler
docker pull ethnchao/cobbler
docker run \
-d \
--privileged \
--net host \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
-v ./etc/cobbler/settings:/etc/cobbler/settings \
-v ./etc/cobbler/dhcp.template:/etc/cobbler/dhcp.template \
-v ./var/www/cobbler/images:/var/www/cobbler/images \
-v ./var/www/cobbler/ks_mirror:/var/www/cobbler/ks_mirror \
-v ./var/www/cobbler/links:/var/www/cobbler/links \
-v ./var/lib/cobbler/config:/var/lib/cobbler/config \
-v ./var/lib/tftpboot:/var/lib/tftpboot \
-v ./dist/os:/mnt:ro \
-p 69:69 \
-p 80:80 \
-p 443:443 \
-p 25151:25151 \
--name cobbler dockerhub.icu/ethnchao/cobbler
修改配置文件 settings file,
change the value for manage_dhcp to 1
next_server and server variables.
manage_dhcp: 1
next_server: 192.168.39.152
server: 192.168.39.152
修改配置文件 dhcp_template
...
subnet 192.168.39.0 netmask 255.255.255.0 {
option routers 192.168.39.2;
option domain-name-servers 192.168.39.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.39.200 192.168.39.254;
...
重启容器,访问服务https://192.168.39.152/cobbler_web
挂载镜像到容器内部
sudo mount -t iso9660 -o loop,ro -v ./dist/centos.iso ./dist/os
此时可以查看 ls ./dist/os
ll workerdir/dist/os/
total 117
drwxr-xr-x 8 root root 2048 Apr 22 2020 ./
drwxr-xr-x 4 777 root 4096 Jul 25 11:28 ../
-rw-rw-r-- 2 root root 14 Apr 21 2020 CentOS_BuildTag
-rw-r--r-- 1 root root 29 Apr 21 2020 .discinfo
drwxr-xr-x 3 root root 2048 Apr 21 2020 EFI/
-rw-rw-r-- 3 root root 227 Aug 30 2017 EULA
-rw-rw-r-- 3 root root 18009 Dec 10 2015 GPL
drwxr-xr-x 3 root root 2048 Apr 21 2020 images/
drwxr-xr-x 2 root root 2048 Apr 21 2020 isolinux/
drwxr-xr-x 2 root root 2048 Apr 21 2020 LiveOS/
drwxr-xr-x 2 root root 73728 Apr 22 2020 Packages/
drwxrwxr-x 2 root root 4096 Apr 22 2020 repodata/
-rw-rw-r-- 3 root root 1690 Dec 10 2015 RPM-GPG-KEY-CentOS-7
-rw-rw-r-- 3 root root 1690 Dec 10 2015 RPM-GPG-KEY-CentOS-Testing-7
-r--r--r-- 1 root root 2883 Apr 22 2020 TRANS.TBL
-rw-r--r-- 1 root root 353 Apr 21 2020 .treeinfo
会多出一堆东西,这就是安装操作系统需要用到的,-t iso9660 应该是相当于刻盘工具,后期可以研究下这个选项
此时容器内部的/mnt识别不到新生成的文件,需要重启下容器再执行命令
docker restart cobbler
docker exec -it cobbler cobbler import --name=centos7 --arch=x86_64 --path=/mnt
这里又会报奇怪的错误,
task started: 2024-07-25_113952_import
task started (id=Media import, time=Thu Jul 25 11:39:52 2024)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path /var/www/cobbler/ks_mirror/centos7-x86_64:
creating new distro: centos7-x86_64
trying symlink: /var/www/cobbler/ks_mirror/centos7-x86_64 -> /var/www/cobbler/links/centos7-x86_64
creating new profile: centos7-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/centos7-x86_64 for centos7-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos7-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/centos7-x86_64
looking for /var/www/cobbler/ks_mirror/centos7-x86_64/repodata/*comps*.xml
error launching createrepo (not installed?), ignoring
Exception occured: <type 'exceptions.IOError'>
Exception value: [Errno 2] No such file or directory: '/var/www/cobbler/ks_mirror/config/centos7-x86_64.repo'
Exception Info:
File "/usr/lib/python2.7/site-packages/cobbler/modules/manage_import_signatures.py", line 599, in yum_process_comps_file
config_file = open(fname, "w+")
*** TASK COMPLETE ***
GPT说需要安装一个包
替换为国内源 centos
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum repolist
安装repo包
yum install -y createrepo
接下来需要删除刚才导入的,重新导入
docker exec -it cobbler cobbler distro list
docker exec -it cobbler cobbler distro remove --name=centos7-x86_64
docker exec -it cobbler cobbler profile remove --name=centos7-x86_64
docker exec -it cobbler cobbler import --name=centos7 --arch=x86_64 --path=/mnt
装完还是报错,需要手动创建
docker exec -it cobbler bash -c 'mkdir -p /var/www/cobbler/ks_mirror/config'
docker exec -it cobbler bash -c 'cat <
[centos7-x86_64]
name=CentOS 7 x86_64
baseurl=file:///var/www/cobbler/ks_mirror/centos7-x86_64
enabled=1
gpgcheck=0
EOF'
或者手动创建
createrepo /var/www/cobbler/ks_mirror/centos7-x86_64
cobbler check
cobbler sync
### centos自动安装遇到奇怪的错误
An unknown error has occurredanaconda 21.48.22.158-1 exception reportTraceback (most recent call first):File "/usr/lib64/python2.7/site-packages/pyanaconda/packaging/yumpayload.py", line 1283, in _selectYumGroupl raise NoSuchGroup(groupid, required=required)File "/usr/lib64/python2.7/site-packages/pyanaconda/packaging/yumpayload.py", line 1396, in _applyYumSelectionsl self. selectYumGroup("core")File "/usr/lib64/python2.7/site-packages/pyanaconda/packaging/yumpayload.py", line 1454, in checkSoftuareSelectionl self._applyYumSelections()File "/usr/lib64/python2.7/site-packages/pyanaconda/ui/tui/spokes/software.py", line 238, in checkSoftwareSelectionl self.payload.checkSoftwareSelection()File "/usr/lib64/python2.7/threading.py", line 765, in runself._target(*self. _args, *self._kwargs)File "/usr/lib64/python2.7/site-packages/pyanaconda/threads.py", line 227, in run threading.Thread.run(self, wargs, kwargs)File "/usr/lib64/python2.7/site-packages/pyanaconda/threads.py", line 92, in get self.raise_if_error(name)File "/usr/lib64/python2.7/site-packages/pyanaconda/ui/tui/spokes/source.py", line 256, in readyl not threadMgr.get(THREAD_CHECK_SOFTWARE))File "/usr/lib64/python2.7/site-packages/pyanaconda/ui/tui/hubs/summary.py", line 54, in
操作ubuntu记录
umount ./dist/os
sudo mount -t iso9660 -o loop,ro -v ./dist/ubuntu.iso ./dist/os
docker restart cobbler
docker exec -it cobbler cobbler import --name=ubuntu2004 --arch=x86_64 --path=/mnt
ubuntu报错记录
1. 解决办法
更新签名
cobbler signature update
received on stderr:
running: /usr/bin/file /var/www/cobbler/ks_mirror/ubuntu2004--arch=x86_64/dists/focal/restricted/binary-amd64/Release
received on stdout: /var/www/cobbler/ks_mirror/ubuntu2004--arch=x86_64/dists/focal/restricted/binary-amd64/Release: ASCII text
received on stderr:
running: /usr/bin/file /var/www/cobbler/ks_mirror/ubuntu2004--arch=x86_64/dists/focal/restricted/binary-i386/Release
received on stdout: /var/www/cobbler/ks_mirror/ubuntu2004--arch=x86_64/dists/focal/restricted/binary-i386/Release: ASCII text
received on stderr:
No signature matched in /var/www/cobbler/ks_mirror/ubuntu2004--arch=x86_64
!!! TASK FAILED !!!
### ubuntu安装cobbler具体步骤
参考链接:
https://cobbler.readthedocs.io/en/latest/installation-guide.html
### pxe再ubuntu系统上安装ubuntu2204
https://linux.cn/article-13693-1.html
标签:x86,--,笔记,学习,cobbler,var,64,root
From: https://www.cnblogs.com/jasmine456/p/18322375