cobbler无人值守安装

cobbler无人值守安装

环境

[root@localhost ~]# cat /etc/centos-release
 CentOS Linux release 7.5.1804 (Core) 
 [root@localhost ~]# systemctl stopt firewalld
 [root@localhost ~]# setenforce 0
 [root@localhost ~]# hostname -I
::1 127.0.0.1

安装cobbler

yum install -y cobbler cobbler-web dhcp tftp-server pykickstart httpd python-django 
 [root@localhost ~]# cobbler check
 cobblerd does not appear to be running/accessible: error(111, 'Connection refused')

解决办法

[root@ localhost ~]# systemctl start httpd
[root@ localhost ~]# systemctl start cobblerd

继续执行cobbler会出现

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

1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work.  This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something otherthan 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : change 'disable' to 'no' in /etc/xinetd.d/tftp
4 : Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' todownload them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a*recent* version of the syslinux package installed and can ignore this message entirely.  Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
5 : enable and start rsyncd.service with systemctl
6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
7 : ksvalidator was not found, install pykickstart
8 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
9 : 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.

我们进行逐个侦破
1 2 6

vim /etc/cobbler/settings
next_server:10.0.0.41
default_password_crypted: "$1$oldboy$McLrrFlr6r1R636KEIbu61"
server:10.0.0.41

3

[root@ localhost ~]# cobbler get-loaders
[root@ localhost ~]# tree /var/lib/cobbler/loaders
/var/lib/cobbler/loaders
├── COPYING.elilo
├── COPYING.syslinux
├── COPYING.yaboot
├── elilo-ia64.efi
├── grub-x86_64.efi
├── grub-x86.efi
├── menu.c32
├── pxelinux.0
├── README
└── yaboot

0 directories, 10 files

4

[root@ localhost ~]# cat /etc/xinetd.d/rsync
disable = no

配置dhcp
修改cobbler的dhcp配置模板
不要修改本身dhcp配置文件,cobbler会覆盖掉

[root@ localhost ~]# vim /etc/cobbler/dhcp.template:
subnet 10.0.0.41 netmask 255.255.255.0 {
     option routers             10.0.0.5;
     option domain-name-servers 10.0.0.1;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        10.0.0.100 10.0.0.254;
[root@ localhost ~]# sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings   --是用cobbler管理dhcp的

同步cobbler管理

[root@ localhost ~]# cobbler sync
task started: 2020-05-01_091215_sync
task started (id=Sync, time=Fri May  1 09:12:15 2020)
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 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 shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.manage_genders
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

[root@ localhost ~]# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#

重启相关服务和添加开机自启

[root@ localhost ~]# systemctl restart cobblerd.service rsyncd tftp.socket httpd.service
[root@ localhost ~]# systemctl enable cobblerd.service rsyncd tftp.socket httpd.service

cobbler命令

cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ... 
         [add|edit|copy|getks*|list|remove|rename|report] [options|--help]
 cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validateks|version|signature|get-loaders|hardlink> [options|--help]
 [root@ localhost ~]# cobbler import --help  # 导入镜像
 Usage: cobbler [options]
 Options:
   -h, --help            show this help message and exit
   --arch=ARCH           OS architecture being imported
   --breed=BREED         the breed being imported
   --os-version=OS_VERSION
                         the version being imported
   --path=PATH           local path or rsync location
   --name=NAME           name, ex 'RHEL-5'
   --available-as=AVAILABLE_AS
                         tree is here, don't mirror
   --kickstart=KICKSTART_FILE
                         assign this kickstart file
   --rsync-flags=RSYNC_FLAGS
                         pass additional flags to rsync
 cobbler check    核对当前设置是否有问题
 cobbler list     列出所有的cobbler元素
 cobbler report   列出元素的详细信息
 cobbler sync     同步配置到数据目录,更改配置最好都要执行下
 cobbler reposync 同步yum仓库
 cobbler distro   查看导入的发行版系统信息
 cobbler system   查看添加的系统信息
 cobbler profile  查看配置信息

测试
需要一台centos系统(但是不需要选择镜像)
内存需要2GB 内存过小导致无法操作
在这里插入图片描述
耐心等待安装出现下图就表示已经安装成功了
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值