环境:

[root@kickstart ~]# cat /etc/redhat-release
CentOS Linux release 7.4. (Core)
[root@kickstart ~]# uname -r
3.10.-.el7.x86_64
[root@kickstart ~]# getenforce
Disabled
[root@kickstart ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld()
[root@kickstart ~]# hostname -I
10.0.0.201 172.16.1.201

前言

cobbler安装比较简单,主要是网页操作,点点点,相对于PXE+kickstart网络安装更简单。

如果大家不了解PXE+kickstart网络安装系统过程原理的话,建议大家去看看我写的 <PXE+kickstart网络安装CentOS7.4系统及过程中各种报错>   <-- 快戳我

cobbler安装

1、下载cobbler及相关软件

[root@Cobbler ~]# yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd

2、检查更改配置

注意:CentOS7上需要启动httpd服务和cobbler服务才能检查

[root@Cobbler ~]# systemctl start cobblerd.service httpd.service
[root@Cobbler ~]# cobbler check
The following are potential configuration items that you may want to fix: : 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.
: For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
: change 'disable' to 'no' in /etc/xinetd.d/tftp
: Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download 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., menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
: enable and start rsyncd.service with systemctl
: debmirror package is not installed, it will be required to manage debian deployments and repositories
: 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
: 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.

根据这些检查条目,进行更改相关的检查项

sed -i 's/server: 127.0.0.1/server: 172.16.1.202/' /etc/cobbler/settings
sed -i 's/next_server: 127.0.0.1/next_server: 172.16.1.202/' /etc/cobbler/settings
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings
sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
sed -ri "/default_password_crypted/s#(.*: ).*#\1\"`openssl passwd -1 -salt 'oldboy' '123456'`\"#" /etc/cobbler/settings
sed -i 's#yes#no#' /etc/xinetd.d/tftp systemctl start rsyncd
systemctl enable rsyncd
systemctl enable tftp.socket
systemctl start tftp.socket
systemctl restart cobblerd.service

修改dhcp模板配置文件

sed -i.ori 's#192.168.1#172.16.1#g;22d;23d' /etc/cobbler/dhcp.template

同步所有配置

注意:不同步会报错

[root@Cobbler ~]# cobbler sync
task started: --15_101915_sync
task started (id=Sync, time=Wed Nov :: )
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux. -> /var/lib/tftpboot/pxelinux.
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 ***

一坨

cobbler使用操作

博主使用虚拟机操作

https://10.0.0.202/cobbler_web    浏览器访问网址
账号密码默认均为cobbler

导入镜像(import DVD)

说明:首先虚拟机保证下列以操作

根据镜像位置,进行挂载

因为镜像位置写的mnt,所以要将镜像挂载到mnt下
[root@Cobbler pxelinux.cfg]# mount /dev/cdrom /mnt/
[root@Cobbler pxelinux.cfg]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 98G .8G 93G % /
devtmpfs 902M 902M % /dev
tmpfs 912M 912M % /dev/shm
tmpfs 912M 8.7M 903M % /run
tmpfs 912M 912M % /sys/fs/cgroup
/dev/sda1 1014M 135M 880M % /boot
tmpfs 183M 183M % /run/user/
/dev/sr0 .3G .3G % /mnt
查看进程,看是否在导入
[root@Cobbler ~]# ps -ef|grep rsync
root : ? :: /usr/bin/rsync --daemon --no-detach
root : ? :: rsync -a /mnt/ /var/www/cobbler/ks_mirror/CentOS7.-x86_64 --progress
root : ? :: rsync -a /mnt/ /var/www/cobbler/ks_mirror/CentOS7.-x86_64 --progress
root : ? :: rsync -a /mnt/ /var/www/cobbler/ks_mirror/CentOS7.-x86_64 --progress

ks文件组成

命令段

install开头,到%pre

包组段

以%packages开头,以%end结束

脚本段

以%post开头,以%end结束,在安装完系统之后执行的相关Linux命令、脚本

以%pre开头,以%end结束,在安装完系统之前执行的相关Linux命令、脚本

kickstart文件语法检查

下载语法检查软件

yum install pykickstart -y

检查命令

[root@CentOS7 tftpboot]# ksvalidator /var/www/html/ks_config/CentOS--ks.cfg
说明:请记住这个验证工具有其局限性。Kickstart 文件可能会很复杂;ksvalidator 可保证其语法正确,且该文件不包含淘汰的选项,但它无法保证安装会成功。它也不会尝试验证 Kickstart 文件的 %pre、%post 和 %packages 部分。

root加密密码生成

密码:123456

[root@CentOS7 ~]# python -c 'import crypt; print(crypt.crypt("123456"))'
$$02PfimLMqN53z6Io$ov2Xbjm7ZC36X2tFvqnI0HymvqMY0vI/UOCxze0L/zMX722PkDJOz/JTWwVHaksawGf/bfR0k3GCpubodKTdV0

CentOS7的ks文件添加

CentOS7 ks文件内容

# Cobbler for Kickstart Configurator for CentOS  by yao zhang
install
url --url=$tree
text
lang en_US.UTF-
keyboard us
zerombr
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
#Network information
$SNIPPET('network_config')
#network --bootproto=dhcp --device=eth0 --onboot=yes --noipv6 --hostname=CentOS7
timezone --utc Asia/Shanghai
authconfig --enableshadow --passalgo=sha512
rootpw --iscrypted $default_password_crypted
clearpart --all --initlabel
part /boot --fstype xfs --size
part swap --size
part / --fstype xfs --size --grow
firstboot --disable
selinux --disabled
firewall --disabled
logging --level=info
reboot %pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end %packages
@^minimal
@compat-libraries
@core
@debugging
@development
bash-completion
chrony
dos2unix
kexec-tools
lrzsz
nmap
sysstat
telnet
tree
vim
wget
%end %post
systemctl disable postfix.service
%end

ks文件内容

关于ks文件内容的详解在我写的 <PXE+kickstart网络安装CentOS7.4系统及过程中各种报错> 里有解释

修改镜像变量属性

自定义安装系统

cobbler自动安装系统(Centos7.X)的更多相关文章

  1. cobbler自动安装系统

    一.简介 Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命令即可完成P ...

  2. centos7系统部署cobbler批量安装系统

    系统环境: 一.开启两个网卡.一个仅主机模式,一个桥接模式,主机模式对内提供cobbler服务 [root@localhost ~]# ip a 1: lo: <LOOPBACK,UP,LOWE ...

  3. cobbler 自定义安装系统

    1.自定义安装系统(根据mac地址)--name=定义名称--mac=客户端的mac地址--ip-address=需求的ip--subnet=掩码 --gateway=网关--interface=网口 ...

  4. 其他综合-Cobbler无人值守安装系统 CentOS 7

    Cobbler 无人值守安装系统 CentOS 7 1.实验描述 1.1 概述 作为运维,在公司经常遇到一些机械性重复工作要做,例如:为新机器装系统,一台两台机器装系统,可以用光盘.U盘等介质安装,1 ...

  5. Cobbler自定义安装系统和私有源

    1.自定义安装系统(根据mac地址) --name=定义名称 --mac=客户端的mac地址 --ip-address=需求的ip --subnet=掩码 --gateway=网关 --interfa ...

  6. s32 kickstart 批量自动安装系统

    1. 自动安装操作系统 http://blog.oldboyedu.com/autoinstall-kickstart/   自动安装操作系统的解决方案:kickstart.cobbler(披着web ...

  7. CentOS 6.9 CentOS 7.4 自动安装系统 kickstart

    通过ks文件 实现 CentOS 6.9 & 7.4 自动安装系统 环境: VMware 14.0 Pro版 光盘镜像: CentOS-6.9-x86_64-minimal.iso ks文件生 ...

  8. Centos 7 自动安装系统-pxe

    一.简介 PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服 ...

  9. DHCP服务+PXE自动安装系统

    DHCP服务+PXE自动安装系统 DHCP安装 安装DHCP服务器 yum install dhcp -y 安装完dhcp默认无法启动,需要编辑配置文件设置分配地址范围等相关信息,服务器自身IP地址要 ...

随机推荐

  1. c++对象在lua层的生命周期与内容扩展

    前言 上一篇博客记录了 tolua++ 将 c++类型,变量,函数,以及对象导出到 lua 的过程,这篇博客就接着记录一下 c++对象的内存回收以及c++对象数据和方法在lua中的扩展. 首先 tol ...

  2. 阿里云轻量应用服务器Lamp部署php工程踩过的坑

    第一次写博客,也不知道写什么,但是想坚持写博客来提升自己,不喜勿喷. 切回正题,使用阿里云的轻量应用服务器Lamp其实非常方便,价格也很便宜,一键购买需要的环境都帮你搭配好了,剩下的就是自己修改一下数 ...

  3. Linux 使用tcpdump观察arp通信过程

    ARP协议简介: ARP协议能实现任意网络层地址到任意物理地址的转换,此次讨论从IP地址到以太网地址(MAC地址)的转换.其工作原理是:主机向自己所在的网络广播一个ARP请求,该请求包含目标机器的网络 ...

  4. MERGE语法详解

    merge语法是根据源表对目标表进行匹配查询,匹配成功时更新,不成功时插入. 其基本语法规则是 merge into 目标表 a using 源表 b on(a.条件字段1=b.条件字段1 and a ...

  5. BZOJ 1003 [ZJOI2006]物流运输trans SPFA+DP

    题意:链接 方法:SPFA+DP 解析:挺好的题目.因为数据范围较小所以用这样的方式能够搞,只是也是挺不好想的. 我们定义cost(i,j)表示从第i天走到第j天运用同一种方式的最小花费,然后因为数据 ...

  6. 【SqlServer】【问题收集】删除同一张表中完全相同的记录

    1   概述 在Sqlserver中,当通过SqlServer设计器删除同一张表中两条完全相同的记录时,会弹出如下提示: 点击“是” 弹出如下提示,不让删除 2   问题解决 这个问题很简单,用DEL ...

  7. 十五、Spring Boot 环境变量读取 和 属性对象的绑定

    凡是被spring管理的类,实现接口 EnvironmentAware 重写方法 setEnvironment 可以在工程启动时,获取到系统环境变量和application配置文件中的变量. 如: @ ...

  8. 自学Zabbix3.10.1.4-事件通知Notifications upon events-媒介类型Ez Texting

    自学Zabbix3.10.1.4-事件通知Notifications upon events-媒介类型Ez Texting Ez Texting是zabbix的技术合作伙伴,主要提供短信服务,用手机注 ...

  9. 程序员最常用的Linux命令

    命令 用法 说明 pwd pwd 显示当前所在目录 ls ls -al 以列表形式,显示当前目录下的所有文件和目录,大多数情况可直接用ll cd cd  /home/hadoop/hbase/ 进入到 ...

  10. 第五章 使用 SqlSession

    第五章 使用 SqlSession 原文链接; http://www.mybatis.org/spring/zh/sqlsession.html 在 MyBatis 中,你可以使用 SqlSessio ...