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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • siege 用户登录_Siege详解[通俗易懂]

    siege 用户登录_Siege详解[通俗易懂]Siege是一款开源的压力测试工具,设计用于评估WEB应用在压力下的承受能力。可以根据配置对一个WEB站点进行多用户的并发访问,记录每个用户所有请求过程的相应时间,并在一定数量的并发访问下重复进行。Siege可以从您选择的预置列表中请求随机的URL。所以siege可用于仿真用户请求负载,而ab则不能。但不要使用siege来执行最高性能基准调校测试,这方面ab就准确很多。一、安装编译安装tar-z…

    2025年8月6日
    5
  • java实现简单的抽奖游戏(数组学习)

    java实现简单的抽奖游戏(数组学习)参考文章https://blog.csdn.net/zzq1992126/article/details/44118429参考书籍《java核心技术·卷一:基础知识》代码//程序目标:从给定的奖池中抽取出一系列中奖数字,每个数字只能被选取一次。程序实现如下:importjava.util.Arrays;importjava.util.Scanner;publicclass…

    2025年8月9日
    3
  • 台式机dp接口_科普短文,高清晰音视频传输DP接口简单介绍

    DP是DisplayPort的缩写,是一种高清晰音视频流的传输接口。DisplayPort是由视频电子标准协会(VESA)发布的显示接口。作为DVI的继任者,DisplayPort能够传输未经压缩的视频和音频信号,并且支持更高的分辨率和刷新率。2006年5月,视频电子标准协会(VESA)制定了1.0版标准,随后陆续升级出现了1.1版、1.2版、1.3版、1.4版等。DisplayPort的出现赢得…

    2022年4月9日
    687
  • SSL与SET协议

    SSL与SET协议SSL SecureSocket 为 Netscape 所研发 用以保障在 Internet 上数据传输之安全 利用数据加密 Encryption 技术 可确保数据在网络 上之传输过程中不会被截取及窃听 目前一般通用之规格为 40bit 之安全标准 美国则已推出 128bit 之更高安全 标准 但限制出境 只要 3 0 版本以上之 I E 或 Netscape 浏览器即可支持 SSL

    2025年8月25日
    5
  • 中级php面试题以及答案(net高级程序员面试题)

    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;博主最近找工作,记录了不少面试题,有些还是挺值的学习的,这里记录一下。有些我会给出参考链接,有些需要大家自己百度了,持续补充。。一、公司一1、php的接口和抽象类有什么区别,应用场景有哪些https://blog.csdn.net/hanxueyu666/article/details/75712917 https:…

    2022年4月16日
    66
  • pycharmdjango项目实战_pycharm django环境搭建

    pycharmdjango项目实战_pycharm django环境搭建创建项目我们创建django项目有两种方式,命令行方式和使用pycharm工具创建,本文就介绍常用的pycharm工具创建首先点击django,输入项目的名称,选择创建好的虚拟环境,最后点击cre

    2022年7月31日
    8

发表回复

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

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