1.1    定制Centos_7_x86_64.ks文件内容

# Cobbler for Kickstart Configurator for CentOS 7.2.1511 by Wolf_Dreams

# Install OS instead of upgrade
install
# Use network installation(The starting "$" variables are all values in the call configuration file)
url --url=$tree #引用cobbler配置文件来进行安装
# Use text mode install(graphical, text, or cmdline)
text #采用文本方式安装
# System language
lang en_US.UTF-8 #指定系统语言
# System keyboard
keyboard us #指定键盘使用语言
# Clear the Master Boot Record
zerombr #清空系统主引导记录(原机器有系统)
# System bootloader configuration
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto net.ifnames=0 biosdevname=0 rhgb quiet" #引导启动器
# Network information
$SNIPPET('network_config')
# System timezone
timezone --utc Asia/Shanghai --ntpservers=ntp1.aliyun.com
# System authorization information(Use shadow passwords,set up the SHA-512 hashing)
authconfig --enableshadow --passalgo=sha512 #设置认证信息
#Root password
rootpw --iscrypted $default_password_crypted #新装系统默认密码
# Partition clearing information
clearpart --all –initlabel #删除分区信息
# Allow manual partitioning of the system as needed(default fstype xfs or default units MB)
part /boot --fstype xfs --size 500
part swap --size 2048
part / --fstype xfs --grow #逻辑磁盘的所有分区都划分给根(/)分区
# Run the Setup Agent on first boot
firstboot --disable
# SELinux configuration
selinux --disabled
# Firewall configuration
firewall --disabled
#Controls the error logging of Anaconda during installation. It has no effect on the installed system.
logging --level=info
# Do not configure the X Window System
skipx #不配置x window桌面系统
# Creates a new user group
group --name=development
# Creates a new user on the system
user --name=gandalf --groups=development --homedir=/data/gandalf --password=123456 --shell=/bin/sh
# Reboot after installation
reboot # Pre-installation Script(The %pre script is run on the system immediately after the Kickstart file has been parsed, but before installation begins. )
%pre --log=/var/log/ks-pre.log
$SNIPPET('log_ks_pre') #调用的文件存放在/var/lib/cobbler/snippets目录下
$SNIPPET('kickstart_start') #调用kickstart开始安装
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end # Package Selection(The %packages section must end with the %end command.)
%packages #定制安装完的系统安装有什么软件包(@代表安装软件包组-代表不安装什么软件包,没有前缀代表单个软件包)
@base
@compat-libraries
@debugging
@development
net-tools
tree
lrzsz
vim
telnet
nmap
sysstat
dos2unix
iptraf
ncurses-devel
openssl-devel
zlib-devel
OpenIPMI-tools
screen
%end # Post-installation Script(You have the option of adding commands to run on the system once the installation is complete, but before the system is rebooted for the first time)
#Logs the script's output into the specified log file(/var/log/ks-post.log)
%post --log=/var/log/ks-post.log
systemctl disable postfix.service
%end # kdump configuration(enable,The amount of memory you want to reserve for kdump, in MiB)
%addon com_redhat_kdump --enable --reserve-mb=128 #开启系统崩溃转存机制kdump
%end # Jump to local drive boot start
%post
# Start final steps
$SNIPPET('kickstart_done') #防止系统循环安装,即调用pxe_just_once=1
%end

1.2    指定Centos_7_x86_64.ks文件及调整内核net.ifnames=0 biosdevname=0参数

1、切换到存放kickstarts文件目录并查看其目录所有文件

[root@cobbler-server ~]# cd /var/lib/cobbler/kickstarts/
[root@cobbler-server kickstarts]# ls
default.ks install_profiles sample_autoyast.xml sample_esxi4.ks sample.ks
esxi4-ks.cfg legacy.ks sample_end.ks #默认ks文件 sample_esxi5.ks sample_old.seed
esxi5-ks.cfg pxerescue.ks sample_esx4.ks sample_esxi6.ks sample.seed

2、执行rz命令上传定制的Centos_7_x86_64.ks文件

[root@cobbler-server kickstarts]# rz
rz waiting to receive.
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring Centos_7_x86_64.ks...
100% 2 KB 2 KB/sec 00:00:01 0 Errors

3、查看定制的Centos_7_x86_64.ks文件属性

[root@cobbler-server kickstarts]# ls -ldh Centos_7_x86_64.ks
-rw-r--r-- 1 root root 2.7K May 26 13:30 Centos_7_x86_64.ks

4、查看cobbler镜像文件及profile配置文件

[root@cobbler-server kickstarts]# cobbler distro list
CentOS-6.8-x86_64
CentOS-7-x86_64
[root@cobbler-server kickstarts]# cobbler profile list
CentOS-6.8-x86_64
CentOS-7-x86_64

5、查看首次导入系统镜像后,安装镜像的文件信息

[root@cobbler-server kickstarts]# cobbler distro report --name=CentOS-7-x86_64
Name : CentOS-7-x86_64
Architecture : x86_64
TFTP Boot Files : {}
Breed : redhat
Comment :
Fetchable Files : {}
Initrd : /var/www/cobbler/ks_mirror/CentOS-7-x86_64/images/pxeboot/initrd.img
Kernel : /var/www/cobbler/ks_mirror/CentOS-7-x86_64/images/pxeboot/vmlinuz
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS-7-x86_64'}
Management Classes : []
OS Version : rhel7
Owners : ['admin']
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Template Files : {}

6、查看指定的profile设置,cobbler默认使用/var/lib/cobbler/kickstarts/sample_end.ks文件

[root@cobbler-server kickstarts]# cobbler profile report --name=CentOS-7-x86_64
Name : CentOS-7-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : CentOS-7-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/sample_end.ks #系统默认使用的kickstart文件
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

7、检查kickstart文件的完整性

[root@cobbler-server kickstarts]# ksvalidator Centos_7_x86_64.ks
The following problem occurred on line 18 of the kickstart file: Unknown command: $SNIPPET(network_config) #忽略该项

8、编辑profile配置文件,修改关联的kickstart文件

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

9、指定更改Centos7网卡名称为ethx,指定参数--kopts='net.ifnames=0 biosdevname=0'

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

10、再次查看指定的profile设置,kickstart文件/var/lib/cobbler/kickstarts/Centos_7_x86_64.ks

[root@cobbler-server kickstarts]# cobbler profile report --name=CentOS-7-x86_64
Name : CentOS-7-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : CentOS-7-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {'biosdevname': '0', 'net.ifnames': '0'} #centos7需要设置,centos6不需要设置
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/Centos_7_x86_64.ks #更改成指定的kickstart文件
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
[root@cobbler-server kickstarts]# cobbler sync

1.3    定制化安装指定操作系统方法

1、查看指定服务器的MAC地址(区分不同物理服务器采用MAC地址区分)

2、指定服务器使用指定的kickstart文件

[root@cobbler-server kickstarts]# cobbler system add --name=cobbler-client --mac-address=00:0C:29:97:85:40 --profile=CentOS-7-x86_64 --ip-address=172.16.0.100 --netmask=255.255.255.0 --gateway=172.16.0.1 --interface=eth0 --static=1 --hostname=cobbler-client --name-servers="114.114.114.114 8.8.8.8"
[root@cobbler-server kickstarts]# cobbler system list
cobbler-client
[root@cobbler-server kickstarts]# cobbler sysnc

3、修改指定系统的IP地址

[root@cobbler-server kickstarts]# cobbler system edit --name=cobbler-client --ip-address=172.16.0.190
[root@cobbler-server kickstarts]# cobbler system report --name=cobbler-client
Name : cobbler-client
TFTP Boot Files : {}
Comment :
Enable gPXE? : <<inherit>>
Fetchable Files : {}
Gateway : 172.16.0.1
Hostname : cobbler-client
Image :
IPv6 Autoconfiguration : False
IPv6 Default Device :
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart : <<inherit>>
Kickstart Metadata : {}
LDAP Enabled : False
LDAP Management Type : authconfig
Management Classes : <<inherit>>
Management Parameters : <<inherit>>
Monit Enabled : False
Name Servers : ['114.114.114.114', '8.8.8.8']
Name Servers Search Path : []
Netboot Enabled : True
Owners : <<inherit>>
Power Management Address :
Power Management ID :
Power Management Password :
Power Management Type : ipmitool
Power Management Username :
Profile : CentOS-7-x86_64
Internal proxy : <<inherit>>
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Repos Enabled : False
Server Override : <<inherit>>
Status : production
Template Files : {}
Virt Auto Boot : <<inherit>>
Virt CPUs : <<inherit>>
Virt Disk Driver Type : <<inherit>>
Virt File Size(GB) : <<inherit>>
Virt Path : <<inherit>>
Virt PXE Boot : 0
Virt RAM (MB) : <<inherit>>
Virt Type : <<inherit>>
Interface ===== : eth0
Bonding Opts :
Bridge Opts :
CNAMES : []
InfiniBand Connected Mode : False
DHCP Tag :
DNS Name :
Per-Interface Gateway :
Master Interface :
Interface Type :
IP Address : 172.16.0.190
IPv6 Address :
IPv6 Default Gateway :
IPv6 MTU :
IPv6 Prefix :
IPv6 Secondaries : []
IPv6 Static Routes : []
MAC Address : 00:0C:29:97:85:40
Management Interface : False
MTU :
Subnet Mask : 255.255.255.0
Static : True
Static Routes : []
Virt Bridge : [root@cobbler-server kickstarts]# cobbler sync

4、开启服务器自动安装指定的操作系统

5、操作系统安装完成后进行基本验证

定制kickstart文件的语法参考网址

基于Centos7.2使用Cobbler工具定制化批量安装Centos7.2系统的更多相关文章

  1. Cobbler全自动批量安装部署Linux系统

    说明: Cobbler服务器系统:CentOS 5.10 64位 IP地址:192.168.21.128 需要安装部署的Linux系统: eth0(第一块网卡,用于外网)IP地址段:192.168.2 ...

  2. kickstart 实现批量安装centos7.x系统

    1.1 安装系统的方法 l  光盘(ISO文件,光盘的镜像文件)===>>每一台物理机都得给一个光驱,如果用外置光驱的话,是不是每台机器都需要插一下 l  U盘:ISO镜像刻录到U盘==& ...

  3. kickstart模式实现批量安装centos7.x系统

    1.1 安装系统的方法 l  光盘(ISO文件,光盘的镜像文件)===>>每一台物理机都得给一个光驱,如果用外置光驱的话,是不是每台机器都需要插一下 l  U盘:ISO镜像刻录到U盘==& ...

  4. 005-(已测试成功的方案)kickstart模式实现批量安装centos7.x系统

    1.1 安装系统的方法 l  光盘(ISO文件,光盘的镜像文件)===>>每一台物理机都得给一个光驱,如果用外置光驱的话,是不是每台机器都需要插一下 l  U盘:ISO镜像刻录到U盘==& ...

  5. Cobbler批量安装Ubuntu/CentOS系统

    2013-07-25    一.安装和修改cobbler配置 1. Cobbler不在CentOS的基本源中,需要导入EPEL源升级软件包, 确保epel-release包的版本为最新,当前最新版本为 ...

  6. centOS7 mini配置linux服务器(一)安装centOs7

    1. 准备centos-7 (minni镜像) 官网地址http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minim ...

  7. Monodraw for Mac(基于 ASCII 码设计编辑工具)破解版安装

    1.软件简介    Monodrawp 是 macOS 系统上一款专为 Mac 设计的强大的 ASCII 码设计编辑器,纯文本历经几十年而不衰.Monodraw for mac 可以创建基于文本的艺术 ...

  8. 在Mac OS X 通过抓包、“第三方下载工具”加速下载、安装APP或系统

    #!/bin/bash ######################################################################################## ...

  9. Vagrant批量安装CentOS7

    环境准备 下载virtualbox https://download.virtualbox.org/virtualbox/6.1.10/VirtualBox-6.1.10-138449-Win.exe ...

随机推荐

  1. ELK系列(1) - Elasticsearch + Logstash + Kibana + Log4j2快速入门与搭建用例

    前言 最近公司分了个ELK相关的任务给我,在一边学习一边工作之余,总结下这些天来的学习历程和踩坑记录. 首先介绍下使用ELK的项目背景:在项目的数据库里有个表用来存储消息队列的消费日志,这些日志用于开 ...

  2. 寒假作业第二组P&&Q&&R题解

    P的题意是有M份作业,这些作业有不同的截止日期,超过截止日期完成,不同的作业有不同的罚分,求如何完成罚分最低. 首先,从截止日期最长的那个作业到截止日期,这些天数是固定的,所做的就是把这些作业填进这些 ...

  3. Token认证登录以及权限控制

    IdentityServer4实现Token认证登录以及权限控制   相关知识点 不再对IdentityServer4做相关介绍,博客园上已经有人出了相关的系列文章,不了解的可以看一下: 蟋蟀大神的: ...

  4. openstack安装newton版本dashboard+cinder(六)

    一.dashboard 1.安装dashboard及配置 [root@linux-node1 ~]# yum install openstack-dashboard -y #可以装任何地方只要能连接 ...

  5. ML.NET 示例:目录

    ML.NET 示例中文版:https://github.com/feiyun0112/machinelearning-samples.zh-cn 英文原版请访问:https://github.com/ ...

  6. 《java学习三》并发编程 -------线程池原理剖析

    阻塞队列与非阻塞队 阻塞队列与普通队列的区别在于,当队列是空的时,从队列中获取元素的操作将会被阻塞,或者当队列是满时,往队列里添加元素的操作会被阻塞.试图从空的阻塞队列中获取元素的线程将会被阻塞,直到 ...

  7. 3D旋转仿伪3D立体效果,手机端

    偶然在书上看到这段代码,感觉很舒服,直街附代码吧,原生JS.手机端旋转效果仿立体效果. 纯JS代码足够了. var img=document.createElement('img'); img.set ...

  8. Git基础使用教程(仓库初始化,源码clone,源码push)

    一.下载Git源码管理客户端 Git下载地址:https://git-scm.com/ 二.检查电脑是否已安装Git 1)已安装:输入git出现下图提示则代表已安装成功. 2)未安装情况下git会出现 ...

  9. httpHelper请求辅助类

    #import <Foundation/Foundation.h> #import "AFNetworking.h" @interface AFHttpClient : ...

  10. xcode在代码中查找中文

    总是忘记xcode中查找中文,这次记下来,以后就不会忘记了,哈哈 请看下图: 切换到查找,点击find后面的text,选择Regular Expression,然后输入 1. 查找非ascii的字符 ...