cobbler配置「建议收藏」

cobbler配置「建议收藏」cobbler配置1.配置163网络yum源,安装cobbler相关软件[root@localhost~]#cd/etc/yum.repos.d/[root@localhostyum.repos.d]#lsCentOS-Base.repoCentOS-Debuginfo.repoCentOS-Media.repoCentOS-Vault.repoCentOS-C…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定

cobbler配置

1.配置163网络yum源,安装cobbler相关软件

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo
[root@localhost yum.repos.d]# mv CentOS-* /tmp/
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@localhost yum.repos.d]# sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS7-Base-163.repo 
[root@localhost yum.repos.d]# sed -i 's/^enabled=.*/enabled=1/g' /etc/yum.repos.d/CentOS7-Base-163.repo 
[root@localhost yum.repos.d]# yum install -y epel-release
[root@localhost yum.repos.d]# yum -y install httpd dhcp tftp python-ctypes cobbler xinetd cobbler-web pykickstart

Jetbrains全家桶1年46,售后保障稳定

2.启动服务并设置开机自启

[root@localhost yum.repos.d]# systemctl start httpd
[root@localhost yum.repos.d]# systemctl start cobblerd.service 
[root@localhost yum.repos.d]# systemctl enable cobblerd.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.
[root@localhost yum.repos.d]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

3.修改server和tftp的ip为本机ip,并开启tftp

[root@localhost ~]# sed -i 's/^server: 127.0.0.1/server: 192.168.89.130/' /etc/cobbler/settings
[root@localhost ~]# sed -i 's/^next_server: 127.0.0.1/next_server: 192.168.89.130/' /etc/cobbler/settings
[root@localhost ~]# sed -i '/disable/s/yes/no/g' /etc/xinetd.d/tftp

4.下载缺失文件

[root@localhost ~]# cobbler get-loaders
task started: 2018-10-26_154501_get_loaders
task started (id=Download Bootloader Content, time=Fri Oct 26 15:45:01 2018)
downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
downloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***

5.启动rsync并设置开机自启

[root@localhost ~]# systemctl enable rsyncd
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.
[root@localhost ~]# systemctl start rsyncd

6.生成加密密码并加入配置文件

[root@localhost ~]# openssl passwd -1 -salt "$RANDOM" 'wscl1996.'
$1$29001$ie/aAv/eefNRoBRMiPM8M/
[root@localhost ~]# vim /etc/cobbler/settings
default_password_crypted: "$1$29001$ie/aAv/eefNRoBRMiPM8M/"

7.重启cobbler

[root@localhost ~]# systemctl restart cobblerd

8.核对设置问题

[root@localhost ~]# cobbler check
The following are potential configuration items that you may want to fix:

1 : debmirror package is not installed, it will be required to manage debian deployments and repositories
2 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

Restart cobblerd and then run 'cobbler sync' to apply changes.

9.修改cobbler配置文件,让cobbler控制dhcp

[root@localhost ~]# sed -i '/^manage_dhcp/s/0/1/g' /etc/cobbler/settings
[root@localhost ~]# sed -n '/^manage_dhcp/p' /etc/cobbler/settings
manage_dhcp: 1

10.配置dhcp

[root@localhost ~]# vim /etc/cobbler/dhcp.template
subnet 192.168.89.0 netmask 255.255.255.0 {
     option routers             192.168.89.130;
     option domain-name-servers 192.168.89.130;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.89.100 192.168.89.254;
     default-lease-time         21600;

11.重启服务并同步配置

[root@localhost ~]# systemctl restart cobblerd
[root@localhost ~]# cobbler sync
task started: 2018-10-26_155933_sync
task started (id=Sync, time=Fri Oct 26 15:59:33 2018)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
trying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout: 
received on stderr: 
running: service dhcpd restart
received on stdout: 
received on stderr: Redirecting to /bin/systemctl restart dhcpd.service

running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

12.导入镜像(我的是centos7)

[root@localhost ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# cobbler import --path=/mnt --name=centos-7 --arch=x86_64
task started: 2018-10-26_160116_import
task started (id=Media import, time=Fri Oct 26 16:01:16 2018)
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
Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos7-x86_64/repodata
*** TASK COMPLETE ***

--path     镜像路径
--name     问安装源定义名称	
--arch     指定安装源平台

13.查看cobbler镜像列表

[root@localhost ~]# cobbler list
distros:
   centos7-x86_64

profiles:
   centos7-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

14.创建kickstarts自动安装脚本

[root@localhost ~]# cat > /var/lib/cobbler/kickstarts/centos-7-x86_64.ks <<'EOF'
> auth --enableshadow --passalgo=sha512
> bootloader --location=mbr
> clearpart --all --initlabel
> part /boot --asprimary --fstype="ext4" --size=500
> part swap --fstype="swap" --size=4096
> part / --fstype="ext4" --grow --size=15000
> text
> firewall --disabled
> firstboot --disable
> keyboard us
> lang en_US
> url --url=http://192.168.89.130/cobbler/ks_mirror/centos-7-x86_64
> $yum_repo_stanza
> $SNIPPET('network_config')
> reboot
> rootpw --iscrypted $1$29001$ie/aAv/eefNRoBRMiPM8M/
> selinux --disabled
> skipx
> timezone Asia/Shanghai --isUtc --nontp
> install
> zerombr
> %packages
> @^minimal
> @core
> kexec-tools
> %end
> %addon com_redhat_kdump --enable --reserve-mb='auto'
> %end
> %anaconda
> pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
> pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
> pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
> %end
> EOF
[root@localhost kickstarts]# cat centos-7-x86_64.ks 
auth --enableshadow --passalgo=sha512
bootloader --location=mbr
clearpart --all --initlabel
part /boot --asprimary --fstype="ext4" --size=500
part swap --fstype="swap" --size=4096
part / --fstype="ext4" --grow --size=15000
text
firewall --disabled
firstboot --disable
keyboard us
lang en_US
url --url=http://192.168.89.130/cobbler/ks_mirror/centos-7-x86_64
$yum_repo_stanza
$SNIPPET('network_config')
reboot
rootpw --iscrypted $1$29001$ie/aAv/eefNRoBRMiPM8M/                              这里用上面生成的随机密码
selinux --disabled
skipx
timezone Asia/Shanghai --isUtc --nontp
install
zerombr
%packages
@^minimal
@core
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end

15.检查ks文件语法,并查看cobbler有哪些配置文件

[root@localhost kickstarts]# cobbler validateks
task started: 2018-10-26_161559_validateks
task started (id=Kickstart Validation, time=Fri Oct 26 16:15:59 2018)
----------------------------
osversion: rhel7
checking url: http://192.168.89.130/cblr/svc/op/ks/profile/centos7-x86_64
running: /usr/bin/ksvalidator -v "centos7" "http://192.168.89.130/cblr/svc/op/ks/profile/centos7-x86_64"
received on stdout: 
received on stderr: 
*** all kickstarts seem to be ok ***
*** TASK COMPLETE ***
[root@localhost kickstarts]# cobbler profile list
   centos7-x86_64

16.修改profile,将我们新建的ks文件设置为默认的kickstarts

[root@localhost kickstarts]# cobbler profile edit --name centos-7-x86_64  --kickstart=/var/lib/cobbler/kickstarts/centos-7-x86_64.ks

17.配置网卡名称为传统网卡名称eth0

[root@localhost kickstarts]# cobbler profile edit --name centos-7-x86_64 --kopts='net.ifnames=0 biosdevname=0'

18.检查当前系统cobbler配置文件信息

[root@localhost ~]# cobbler profile report
Name                           : centos7-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos7-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {'biosdevname': '0', 'net.ifnames': '0'}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/centos-7-x86_64.ks
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm

19.同步cobbler

[root@localhost ~]# cobbler sync
task started: 2018-10-26_162509_sync
task started (id=Sync, time=Fri Oct 26 16:25:09 2018)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/centos7-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/images/centos7-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
copying distros to tftpboot
copying files for distro: centos7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos7-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: centos7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos7-x86_64/initrd.img
Writing template files for centos7-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
processing boot_files for distro: centos7-x86_64
cleaning link caches
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout: 
received on stderr: 
running: service dhcpd restart
received on stdout: 
received on stderr: Redirecting to /bin/systemctl restart dhcpd.service

running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

20.重启所有服务

[root@localhost ~]# systemctl restart xinetd
[root@localhost ~]# systemctl restart cobblerd
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# ss -antl
State       Recv-Q Send-Q  Local Address:Port                 Peer Address:Port              
LISTEN      0      5           127.0.0.1:25151                           *:*                  
LISTEN      0      5                   *:873                             *:*                  
LISTEN      0      128                 *:22                              *:*                  
LISTEN      0      100         127.0.0.1:25                              *:*                  
LISTEN      0      5                  :::873                            :::*                  
LISTEN      0      128                :::80                             :::*                  
LISTEN      0      128                :::22                             :::*                  
LISTEN      0      100               ::1:25                             :::*                  
LISTEN      0      128                :::443                            :::* 

21.cobbler的web段

cobbler的网址为https://IP/cobbler_web
账户名和密码都为默认的cobbler
cobbler配置「建议收藏」

22.查看效果

配置一台虚拟机,不需要配置光盘,直接开机,显示最后一张图片界面即为配置成功
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
这里就完成了配置,剩下直接选我们的镜像直接安装即可

23.定制安装

在这里插入图片描述

[root@linux-node2 ~]# cobbler system add --name=linux --mac=00:0C:29:FE:63:4F \
> --profile=centos-7-x86_64 \
> --ip-address=192.168.100.5 --subnet=255.255.255.0 \
> --gateway=192.168.100.254 --interface=eth0 \
> --static=1 --hostname=linux \
> --name-servers="192.168.100.254" \
> --kickstart=/var/lib/cobbler/kickstarts/centos-7-x86_64.ks
[root@linux-node2 ~]# cobbler system list
   linux

参数解释:

system add 添加一个系统定制
name 定义这个新添加的系统定制的名字
mac 指定MAC
profile 指定profile,通过cobbler profile list查看
ip-address 指定静态IP
subnet 指定子网掩码
gateway 指定网关
interface 指定网卡
static=1 设置为静态IP
hostname 这是主机名
name-servers 设置dns服务器
kickstart 设置kickstart,通过cobbler profile report来查看。

报错

Truncated backtrace:parser.py:715:readKickstart:KickstartError: The following problem occurred on line 0 of the kickstart file:
Unable to open input kickstart file: curl#37 - "Couldn't open file /root/anaconda-ks.cfg"
[root@localhost ~]# vim  /var/lib/cobbler/kickstarts/centos-7-x86_64.ks     删除$SNIPPET('network_config')这一行即可
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/206735.html原文链接:https://javaforall.net

(0)
上一篇 2025年8月5日 下午4:15
下一篇 2025年8月5日 下午4:43


相关推荐

  • 单调栈算法详解_单调栈和单调队列

    单调栈算法详解_单调栈和单调队列单调栈算法详解单调栈使用模板stack<int>st;//此处一般需要给数组最后添加结束标志符,具体下面例题会有详细讲解for(遍历这个数组){if(栈空||栈顶元素大于等于当前比较元素){入栈;}else{while(栈不为空&&栈顶元素小于当前元素){栈顶元素出栈;更新结果;}入栈;}}或者简化

    2026年2月15日
    6
  • WSDL说明

    WSDL说明WSDL 是一种 XMLApplicati 他将 Web 服务描述定义为一组服务访问点 客户端可以通过这些服务访问点对包含面向文档信息或面向过程调用的服务进行访问 类似远程过程调用 WSDL 首先对访问的操作和访问时使用的请求 响应消息进行抽象描述 然后将其绑定到具体的传输协议和消息格式上 以最终定义具体部署的服务访问点 相关的具体部署的服务访问点通过组合就成为抽象的 Web 服务 WSDL

    2026年3月17日
    4
  • 池化层的作用[通俗易懂]

    maxpooling是CNN当中的最大值池化操作,其实用法和卷积很类似tf.nn.max_pool(value,ksize,strides,padding,name=None)参数是四个,和卷积很类似:第一个参数value:需要池化的输入,一般池化层接在卷积层后面,所以输入通常是featuremap,依然是[batch,height,width,channels]这样的shape第二个参数ksize:池化窗口的大小,取一个四维向量,一般是[1,height,width,1],

    2022年4月10日
    53
  • uniapp 使用本地数据库

    uniapp 使用本地数据库//我这个封装通过promise返回出去!!!//我这个封装通过promise返回出去!!!//创建数据库或者有该数据库就打开,这一步必须要!exportfunctionopenSqlite(cb){//创建数据库或者打开//这plus.sqlite只在手机上运行plus.sqlite.openDatabase({name:’wallet’,//数据库名称path:’_doc/wallet.db’,//数据库地址,…

    2022年5月29日
    284
  • linux中vi编辑器保存文件命令_linux用vi编辑文件

    linux中vi编辑器保存文件命令_linux用vi编辑文件工具:Linux方法:1、首先进入Linux的命令行界面.在目录下创建一个用于测试的文本文件(touchfilename).这里就新建了一个test12文本文件.当然这个名字是可以随便取得.2、用”vitest12″命令进入vi命令行模式(vifilename).如果要想编辑文本文件.必须要转换到插入模式下,也就是按一下键盘上的”i”就可以了.这样就可以编辑文本,删除文本中的内容.按键盘上…

    2026年2月13日
    5
  • 《科研诚信与学术规范》参考答案最新版

    《科研诚信与学术规范》参考答案最新版研究人员在通过大众传媒传播自己已经发表的研究成果时,以下哪一个表述不正确:1.11【单选题】为了确保学术和科研(),多大学制定了荣誉法则。A、效率B、质量C、风格D、诚信正确答案:D我的答案:D2【判断题】大学建立荣誉制度的初衷旨在预防大学生考试作弊。正确答案:√我的答案:√3【判断题】科学研究与学术工作与人类其他活动一样,均建立在诚信之上。正确答案:√我的答案:√4【判断题】很多大学制定了荣誉法则的目的是为了确保学术和科研诚信。…

    2022年5月22日
    65

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号