Debian-Preseed(全局配置)

對於大批量安裝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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章