对于大批量安装Linux服务器来说,Kickstart是个不错的选择,我比较热衷的方式是:TFPT+HTTP+DHCP+PXE(configure file)
之前一直都在CentOS上调试没有发现问题,但是现在的工作环境变成了Debian系统,所以又研究了一下相关内容。
Debian与CentOS上的区别在于Configure file 的书写语法,其他的配置没有什么变化
对于心急的读者可以访问:http://www.pro.instalinux.com,它可以自动生成各个系统的配置文件
本文会比较长,我会分很多部分进行描述
注:以下个篇章都是在squeezef和wheezy版本下进行测试的
关于Debian系统安装的详细流程介绍请参照:
http://www.debian.org/releases/stable/i386/ch06s03.html.en#ftn.idp6448144
一、全局
Debian的配置文件默认是以seed为后缀,先列举一个完整的preseed的例子:
#### Preseed file for BabelBox # See the Installation Guide for other preconfiguration options ### Network configuration # netcfg will choose an interface that has link if possible. This makes it # skip displaying a list if there is more than one interface. d-i netcfg/choose_interface select auto # To pick a particular interface instead: #d-i netcfg/choose_interface select eth1 # If you have a slow dhcp server and the installer times out waiting for # it, this might be useful. d-i netcfg/dhcp_timeout string 60 # If you prefer to configure the network manually, or if there's no # network available, then uncomment this line and check the static # network configuration below. #d-i netcfg/disable_dhcp boolean true # Static network configuration. d-i netcfg/get_nameservers string 10.0.2.3 d-i netcfg/get_ipaddress string 10.0.2.99 d-i netcfg/get_netmask string 255.255.255.0 d-i netcfg/get_gateway string 10.0.2.2 d-i netcfg/confirm_static boolean true # Any hostname and domain names assigned from dhcp take precedence over # values set here. However, setting the values still prevents the questions # from being shown, even if values come from dhcp. d-i netcfg/get_hostname string babelbox d-i netcfg/get_domain string unassigned-domain ### Mirror settings d-i mirror/country string enter information manually d-i mirror/http/hostname string 10.0.2.2 d-i mirror/http/directory string /debian d-i mirror/http/proxy string ### Partitioning # We use the largest free space available and the simple "all in one" recipe # for BabelBox d-i partman-auto/init_automatically_partition select biggest_free d-i partman-auto/choose_recipe select atomic # This makes partman automatically partition without confirmation. d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true ### Clock and time zone setup # Controls whether or not the hardware clock is set to UTC. d-i clock-setup/utc boolean true # You may set this to any valid setting for $TZ; see the contents of # /usr/share/zoneinfo/ for valid values. d-i time/zone string Europe/Amsterdam ### Apt setup # When using a full CD image, we don't need a mirror d-i apt-setup/use_mirror boolean false # We don't need security updates for this d-i apt-setup/services-select multiselect ### Account setup d-i passwd/root-password password r00tme d-i passwd/root-password-again password r00tme # Alternatively, create a normal user account. d-i passwd/user-fullname string Debian User d-i passwd/username string debian d-i passwd/user-password password r00tme d-i passwd/user-password-again password r00tme ### Boot loader installation d-i grub-installer/skip boolean true d-i lilo-installer/skip bollean true ### Package selection ## don't install the desktop task, it takes to long to install tasksel tasksel/first multiselect ## instead install a quite minimal GNOME setup and desktop-base (for spacefun theme) d-i pkgsel/include string gdm3, gnome-session, gnome-icon-teme, desktop-base, xserver-xorg-core, xserver-xorg-input-evdev, xserver-xorg-video-vesa, xserver-xorg # Don't install popcon popularity-contest popularity-contest/participate boolean false ### Finishing up the first stage install # Avoid that last message about the install being complete. d-i finish-install/reboot_in_progress note #### Advanced options ### Define scripts to be run # This first command is run as early as possible, just after # preseeding is read. d-i preseed/early_command string /hd-media/srv/babelbox/preseed_early # This command is run just before the install finishes, but when there is # still a usable /target directory. You can chroot to /target and use it # directly, or use the apt-install and in-target commands to easily install # packages and run commands in the target system. d-i preseed/late_command string /hd-media/srv/babelbox/preseed_late
此脚本来自:git clone git://anonscm.debian.org/d-i/babelbox.git
通过上面的脚本我们可以大体了解一下preseed的组织结构,下面这个例子,说明seed直接是可以嵌套使用的。我比较推崇嵌套的方式,因为这样开起来条例清晰。
#set two seed configure fire common.seed and lvm.seed d-i preseed/include string common.seed lvm.seed # Preseeding only locale sets language, country and locale. d-i debian-installer/locale string en_US # Keyboard selection. d-i console-keymaps-at/keymap select us d-i keyboard-configuration/xkb-keymap select us
详细信息请参考:https://wiki.debian.org/DebianInstaller/Preseed