You will first need to create a preconfiguration file and place it in the location from where you want to use it. Creating the preconfiguration file is covered later in this appendix. Putting it in the correct location is fairly straightforward for network preseeding or if you want to read the file off a floppy or usb-stick. If you want to include the file on a CD or DVD, you will have to remaster the ISO image. How to get the preconfiguration file included in the initrd is outside the scope of this document; please consult the developers' documentation for debian-installer
.
An example preconfiguration file that you can use as basis for your own preconfiguration file is available from http://www.debian.org/releases/stretch/example-preseed.txt. This file is based on the configuration fragments included in this appendix.
If you are using initrd preseeding, you only have to make sure a file named preseed.cfg
is included in the root directory of the initrd. The installer will automatically check if this file is present and load it.
For the other preseeding methods you need to tell the installer what file to use when you boot it. This is normally done by passing the kernel a boot parameter, either manually at boot time or by editing the bootloader configuration file (e.g. syslinux.cfg
) and adding the parameter to the end of the append line(s) for the kernel.
If you do specify the preconfiguration file in the bootloader configuration, you might change the configuration so you don't need to hit enter to boot the installer. For syslinux this means setting the timeout to 1
in syslinux.cfg
.
To make sure the installer gets the right preconfiguration file, you can optionally specify a checksum for the file. Currently this needs to be a md5sum, and if specified it must match the preconfiguration file or the installer will refuse to use it.
Opstartsparametre at angive: - hvis du bruger opstart for nettet: preseed/url=http://host/path/to/preseed.cfg preseed/url/checksum=5da499872becccfeda2c4872f9171c3d - or preseed/url=tftp://host/path/to/preseed.cfg preseed/url/checksum=5da499872becccfeda2c4872f9171c3d - hvis du starter op fra en remastered cd: preseed/file=/cdrom/preseed.cfg preseed/file/checksum=5da499872becccfeda2c4872f9171c3d - hvis du installerer fra USB-medie (placer prækonfigurationsfilen i den øverste mappe af USB-drevet): preseed/file=/hd-media/preseed.cfg preseed/file/checksum=5da499872becccfeda2c4872f9171c3d
Bemærk at preseed/url
kan forkortes til bare url
, preseed/file
til bare file
og preseed/file/checksum
til bare preseed-md5
, når de sendes som opstartsparametre.
Hvis en forhåndskonfigurationsfil ikke kan bruges til at forhåndskonfigurere nogle trin, så kan installationen stadig automatiseres, da du kan sende forhåndskonfigurerede værdier på kommandolinjen når installationsprogrammet startes op.
Opstartsparametere kan også bruges hvis du ikke reelt ønsker at bruge forhåndskonfiguration, men bare ønsker at tilbyder et svar på et specifikt spørgsmål. Nogle eksempler hvor dette kan være nyttigt er dokumenteret et andet sted i denne manual.
To set a value to be used inside debian-installer
, just pass
for any of the preseed variables listed in the examples in this appendix. If a value is to be used to configure packages for the target system, you will need to prepend the owner[20] of the variable as in path/to/variable
=value
. If you don't specify the owner, the value for the variable will not be copied to the debconf database in the target system and thus remain unused during the configuration of the relevant package. owner
:path/to/variable
=value
Normalt vil forhåndskonfiguration af et spørgsmål på den måde betyde, at spørgsmålet ikke vil blive stillet. For at angive en specifik standardværdi for et spørgsmål, men stadig få spørgsmålet, så brug “?=” i stedet for “=” som operatør. Se også Afsnit B.5.2, “Brug af forhåndskonfiguration til at ændre standardværdier”.
Bemærk at nogle variabler som ofte angives ved opstartsprompten har et kortere alias. Hvis et alias er tilgængelig, så bruges det i eksemplerne i dette appendiks i stedet for den fulde variabel. Variablen preseed/url
har for eksempel et alias som url
. Et andet eksempel er aliasset tasks
, som oversættes til tasksel:tasksel/first
.
Et “---” i opstartstilvalget har speciel betydning. Kerneparametre som fremgår efter det sidste “---” kan kopieres til opstartsindlæserens konfiguration for det installerede system (hvis understøttet af installationsprogrammet for opstartsindlæseren). Installationsprogrammet vil automatisk filtrere tilvalg væk (såsom forhåndskonfigurerede tilvalg), som den genkender.
![]() |
Bemærk |
---|---|
Nuværnede Linuxkerner (2.6.9 og senere) accepterer et maksimum på 32 kommandolinjetilvalg og 32 miljøtilvalg, inklusive eventuelle tilvalg tilføjet som standard for installationsprogrammet. Hvis der anvendes højere antal, vil kernen gå i panik (nedbrud). (For tidligere kerner er disse antal lavere). |
For de fleste installationer kan nogle af standardtilvalgene i opstartsindlæserens konfigurationsfil, såsom vga=normal
, fjernes uden problemer, hvilket giver mulighed for at tilføje flere tilvalg for forhåndskonfigurationen.
![]() |
Bemærk |
---|---|
Det er ikke altid muligt at specificere værdier med mellemrum for opstartsparametre, selv ikke hvis du afgrænser dem med citationstegn. |
Der er flere funktioner i Debian-installationsprogrammet, som kombineret medfører at ret så simple kommandolinjer på opstartsprompten medfører arbitrære og komplekse tilpassede automatiske installationer.
Dette aktiveres ved at bruge opstartsvalget Automatiseret installation
, også kaldt auto
for nogle arkitekturer eller opstartsmetoder. I dette afsnit, er auto
derfor ikke en parameter, det betyder valg af opstartindstillingen, og tilføjelse af den efterfølgende opstartsparameter på opstartsprompten.
To illustrate this, here are some examples that can be used at the boot prompt:
auto url=autoserver
This relies on there being a DHCP server that will get the machine to the point where autoserver
can be resolved by DNS, perhaps after adding the local domain if that was provided by DHCP. If this was done at a site where the domain is example.com
, and they have a reasonably sane DHCP setup, it would result in the preseed file being retrieved from http://autoserver.example.com/d-i/stretch/./preseed.cfg
.
The last part of that url (d-i/stretch/./preseed.cfg
) is taken from auto-install/defaultroot
. By default this includes the directory stretch
to allow future versions to specify their own codename and let people migrate forwards in a controlled manner. The /./
bit is used to indicate a root, relative to which subsequent paths can be anchored (for use in preseed/include and preseed/run). This allows files to be specified either as full URLs, paths starting with / that are thus anchored, or even paths relative to the location where the last preseed file was found. This can be used to construct more portable scripts where an entire hierarchy of scripts can be moved to a new location without breaking it, for example copying the files onto a USB stick when they started out on a web server. In this example, if the preseed file sets preseed/run
to /scripts/late_command.sh
then the file will be fetched from http://autoserver.example.com/d-i/stretch/./scripts/late_command.sh
.
If there is no local DHCP or DNS infrastructure, or if you do not want to use the default path to preseed.cfg
, you can still use an explicit url, and if you don't use the /./
element it will be anchored to the start of the path (i.e. the third /
in the URL). Here is an example that requires minimal support from the local network infrastructure:
auto url=http://192.168.1.2/path/to/mypreseed.file
The way this works is that:
hvis adressen mangler en protokol, så anvendes http,
hvis værtsnavnafsnittet ikke indeholder punktummer, så bliver domænet afledt fra HDCP tilføjet til det, og
hvis der ikke er nogle /
efter værtsnavnet, så tilføjes standardstien.
In addition to specifying the url, you can also specify settings that do not directly affect the behavior of debian-installer
itself, but can be passed through to scripts specified using preseed/run
in the loaded preseed file. At present, the only example of this is auto-install/classes
, which has an alias classes
. This can be used thus:
auto url=example.com
classes=class_A;class_B
The classes could for example denote the type of system to be installed, or the localization to be used.
Det er selvfølgelig muligt at udvide dette koncept, og hvis du gør det, er det fornuftigt at bruge det automatisk installerede navnerum til dette formål. Så man kan have noget ala dette auto-install/style
, som så bruges i dine skripter. Hvis du har brug for dette, så nævn det på postlisten <debian-boot@lists.debian.org>
, så vi kan undgå navnerumskonflikter, og måske tilføje et alias for parameteren for dig.
The auto
boot choice is not yet defined on all arches. The same effect may be achieved by simply adding the two parameters auto=true priority=critical
to the kernel command line. The auto
kernel parameter is an alias for auto-install/enable
and setting it to true
delays the locale and keyboard questions until after there has been a chance to preseed them, while priority
is an alias for debconf/priority
and setting it to critical
stops any questions with a lower priority from being asked.
Yderligere indstililnger som kan have interesse under forsøget på at automatisere en installation mens DHCP anvendes: interface=auto netcfg/dhcp_timeout=60
som får maskinen til at vælge den første levedygtige NIC og være tålmodig med at få et svar til dets DHCP-forespørgsel.
![]() |
Vink |
---|---|
Et omfattende eksempel på hvordan denne ramme anvendes, inklusive eksemplskripter og klasser, kan findes på hjemmesiden for udvikleren. Eksemplerne der viser også mange andre gode effekter, som kan opnås ved kreativ brug af forhåndskonfiguration. |
De følgende aliasser kan være nyttige når forhåndskonfiguration (auto-tilstand) anvendes. Bemærk at dette er simple korte aliasser for spørgsmålnavne, og at du altid også skal specificere en værdi: For eksempel, auto=true
eller interface=eth0
.
priority | debconf/priority |
fb | debian-installer/framebuffer |
language | debian-installer/language |
country | debian-installer/country |
locale | debian-installer/locale |
theme | debian-installer/theme |
auto | auto-install/enable |
classes | auto-install/classes |
fil | preseed/file |
url | preseed/url |
domain | netcfg/get_domain |
hostname | netcfg/get_hostname |
interface | netcfg/choose_interface |
protocol | mirror/protocol |
suite | mirror/suite |
modules | anna/choose_modules |
recommends | base-installer/install-recommends |
tasks | tasksel:tasksel/first |
desktop | tasksel:tasksel/desktop |
dmraid | disk-detect/dmraid/enable |
keymap | keyboard-configuration/xkb-keymap |
preseed-md5 | preseed/file/checksum |
It's also possible to use DHCP to specify a preconfiguration file to download from the network. DHCP allows specifying a filename. Normally this is a file to netboot, but if it appears to be an URL then installation media that support network preseeding will download the file from the URL and use it as a preconfiguration file. Here is an example of how to set it up in the dhcpd.conf for version 3 of the ISC DHCP server (the isc-dhcp-server Debian package).
if substring (option vendor-class-identifier, 0, 3) = "d-i" { filename "http://host/preseed.cfg"; }
Bemærk at det ovenstående eksempel begrænser dette filnavn til DHCP-klineter, som identificerer sig selv som »d-i«, så det vil ikke påvirke normale DHCP-klienter, men kun installationsprogrammet. Du kan også placere teksten i en stanza for en bestemt vært for at undgå forhåndskonfiguration af alle installationer på dit netværk.
A good way to use the DHCP preseeding is to only preseed values specific to your network, such as the Debian mirror to use. This way installs on your network will automatically get a good mirror selected, but the rest of the installation can be performed interactively. Using DHCP preseeding to fully automate Debian installs should only be done with care.
[20] The owner of a debconf variable (or template) is normally the name of the package that contains the corresponding debconf template. For variables used in the installer itself the owner is “d-i”. Templates and variables can have more than one owner which helps to determine whether they can be removed from the debconf database if the package is purged.