15.自定义kickstart文件
[root@node2 ~]# cd /var/lib/cobbler/kickstarts/
[root@node2 kickstarts]# cp sample_end.ks CentOS6.ks
[root@node2 kickstarts]# vim centos6.ks
# kickstart template for Fedora 8 and later.
# (includes %end blocks)
# do not use with earlier distros
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --service=ssh
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Use network installation
url --url=$tree
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# Network information
$SNIPPET('network_config')
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $default_password_crypted
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone --utc Asia/Shanghai
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
part /boot --fstype=ext4 --size=200
part / --fstype=ext4 --size=10000
part /data --fstype=ext4 --size=5000
part swap --size=1000
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end
%packages
@chinese-support
@development
$SNIPPET('func_install_if_enabled')
%end
%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('RedHat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
%end
16.将自定义的kickstart文件与镜像相关联
[root@node2 ~]# cobbler profile edit --name=CentOS-6.4-x86_64 --distro=CentOS-6.4-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6.ks
[root@node2 ~]# cobbler report
注,上面部分省略。
profiles:
==========
Name : CentOS-6.4-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : CentOS-6.4-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/centos6.ks
17.同步一下
[root@node2 ~]# cobbler sync
task started: 2013-11-13_163907_sync
task started (id=Sync, time=Wed Nov 13 16:39:07 2013)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/CentOS-6.4-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/images/CentOS-6.4-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying files for distro: CentOS-6.4-x86_64
trying hardlink /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/CentOS-6.4-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/CentOS-6.4-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: CentOS-6.4-x86_64
trying hardlink /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/CentOS-6.4-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS-6.4-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/CentOS-6.4-x86_64/initrd.img
Writing template files for CentOS-6.4-x86_64
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: 关闭 dhcpd:[确定]
正在启动 dhcpd:[确定]
received on stderr:
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 ***
18.新建客户端虚拟机
19.启动客户端并进行系统安装
(1).选择 “CentOS-6.4-x86_64”进行安装。
(2).选择后直接回车进行安装。
(3).开始安装初始化
(4).安装相关软件包
(5).软件包安装完成,大概过1分钟后进行重启