Anaconda/Kickstart/zh-cn

From FedoraProject

< Anaconda | Kickstart(Difference between revisions)
Jump to: navigation, search
(%ksappend)
(Chapter 3. Package Selection)
Line 1,372: Line 1,372:
 
Thus, <code>%ksappend</code> provides a way to include a file containing <code>%pre</code> scripts, while <code>%include</code> does not.
 
Thus, <code>%ksappend</code> provides a way to include a file containing <code>%pre</code> scripts, while <code>%include</code> does not.
  
= Chapter 3. Package Selection =
+
= Chapter 3. 包的选择 =
  
 
Use the %packages command to begin a kickstart file section that lists the packages you would like to install.
 
Use the %packages command to begin a kickstart file section that lists the packages you would like to install.

Revision as of 03:35, 15 July 2014

Contents

Chapter 1. 引言

什么是Kickstart安装?

许多系统管理员都希望能够使用自动化安装的方式来在他们的机器上安装Fedora或红帽企业版Linux。为了满足这样的需求,红帽公司创建了kickstart安装方式。通过使用kickstart,系统管理员能够创建一个单独的、包含安装过程中遇到的所有问题答案的文件。

kickstart文件能被存储在服务器系统之上,机器在安装系统的时候可以读取该文件。这种安装方式支持只用一个kickstart文件就可以在多台机器上安装Fedora和红帽企业版Linux的特性,这对于网络和系统管理员来说非常理想。

Fedora安装指南(http://docs.fedoraproject.org/en-US/index.html) 中有关于kickstart的详细说明。

如何使用kickstart进行系统安装?

使用kickstart来安装系统可以通过本地CD-ROM、本地磁盘、或者通过NFS、FTP、HTTP来进行。

为了使用kickstart,你必须:

  1. 创建一个kickstart文件
  2. 创建一个带有kickstart文件的启动磁盘,或者让kickstart可以通过网络访问
  3. 使能安装树
  4. 开始kickstart安装

本章节详细地解释了这些步骤。

创建Kickstart文件

kickstart文件是一个简单的文本文件,它包含了一个项目列表,列表中的每一个项目都有一个关键字用来识别。你可以通过Kickstart Configurator程序来生成kickstart文件,也可以手动编辑。Fedora或者红帽企业版Linux安装程序已经根据你在安装过程中的选择创建了一个简单的kickstart文件。它就是/root/anaconda-ks.cfg。你应该可以使用能够识别ASCII编码的文本编辑器或文字处理软件来编辑它。

首先,在创建kickstart文件的时候应该注意以下问题:

  • 有一条并不严格的要求,kickstart文件中各部分(section)要遵循一定的顺序。每个部分中的项(Item)并不需要按照一定的顺序排列,除非有其他要求。各部分的顺序如下:
    1. 命令部分 -- (参考第二章节)列出的kickstart选项(option),必须包含要求的选项。
    2.  %packages部分 -- 详细内容参见第三章节。
    3.  %pre, %post, 以及%traceback部分 -- 这些部分的顺序可以任意排列,更详细的内容请参考第四和第五章节。
  •  %packages, %pre, %post以及%traceback部分需要以%end结束。
  • 不要求的项(Item)可以被省略。
  • 省略任何一个被要求的项将会导致安装程序向用户询问相关的问题,就像典型安装过程向用户询问那样。一旦用户给出了答案,安装过程将会继续自动进行,除非又遇到缺失的项。
  • 以(#)开头的行作为注释行被忽略。
  • 如果在kickstart安装中使用了不推荐的命令、选项或者语法,警告日志将会被记录到anaconda日志中。因为在一个或者两个发行版之间这些不推荐的项经常会被删掉,所以检查安装日志以确保没有使用这些项非常必要。当使用ksvalidator的时候,这些不推荐的项会导致错误。

引用磁盘的特殊说明

传统上,Kickstart一直通过设备节点名(例如 sda)来引用磁盘。Linux内核采用了更加动态的方法,设备名并不会在重启时保持不变。因此,这会使得在Kickstart脚本中引用磁盘变得复杂。为了满足稳定的设备命名,你可以在项(Item)中使用/dev/disk代替设备名。例如,你可以使用:

part / --fstype=ext4 --onpart=/dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:0-part1
part / --fstype=ext4 --onpart=/dev/disk/by-id/ata-ST3160815AS_6RA0C882-part1

来代替:

part / --fstype=ext4 --onpart=sda1

这种方式提供了对磁盘的持久引用,因而比仅仅使用sda更加有意义。 这在大的存储环境中特别有意义。

你也可以使用类似于shell的入口来应用磁盘。这种方式主要用来简化大的存储环境中clearpart以及ignoredisk命令的使用。例如,为了替代:

ignoredisk --drives=sdaa,sdab,sdac

你可以使用如下的入口:

ignoredisk --drives=/dev/disk/by-path/pci-0000:00:05.0-scsi-*

最后,如果想要在任何地方引用已经存在的分区或者文件系统(例如,在part --ondisk=中),你可以通过文件系统标签(label)或者UUID来进行。例如:

part /data --ondisk=LABEL=data
part /misc --ondisk=UUID=819ff6de-0bd6-4bf4-8b72-dbe41033a85b

Chapter 2. Kickstart选项

如下的选项可以放到kickstart文件中。如果你喜欢图形化的接口,可以使用Kickstart Configurator程序。

Stop (medium size).png
如果选项后接等号(=),等号后面必须指定选项的值。 在示例命令中, [方括号]中的选项是可选的。
Stop (medium size).png
pykickstart处理命令参数的方式和shell相似。 如果一个参数列表(多个参数)传进来,这些参数必须以逗号隔开,并且不能有多余的空格。 如果参数列表需要多余的空格,那么整个参数列表就要用双引号括起来。如果引号、空格或者其他特殊字符需要被加入到参数列表,必须将它们进行转义。

auth 或者 authconfig(必需)

auth命令设置系统的授权选项。它只是authconfig程序的封装,因而所有被authconfig程序识别的选项都可以应用于auth命令。想要获取完整的列表,请参考authconfig手册页。

默认情况下,密码一般会被加密但并不会放在shadow文件中。

autopart

自动创建分区--一个根分区(/)、一个swap分区,以及一个适合体系架构(architecture)的boot分区。如果磁盘驱动器足够大,也会创建/home分区。

Stop (medium size).png
autopart命令不能和part/partition, raid, volgroup 或者 logvol 命令存在与同一kickstart文件里。

--type=<type>

选择自动分区机制。必须是lvm, btrfs, plain, thinp中的一个。Plain意味着常规分区,没有btrfs和lvm.

--encrypted

所有支持的设备都应该默认加密吗?这等价于在初始化分区的屏幕上选择"加密"复选框。

--passphrase=

只在--encrypted指定时有效。为所有加密设备提供一个系统范围内的默认密码。

--escrowcert=<url>

只在--encrypted指定时有效。从<url>加载X.509认证。在/root目录下以文件的形式存储所有安装过程中创建的加密卷的密钥。

--backuppassphrase

只在 --escrowcert指定时有效。除了存储数据密钥之外,在所有安装过程中产生的加密卷中加入随机生成的密码。然后在/root目录下以文件的形式存储这些使用--escrowcert指定的认证加密过的密码。(每个加密卷对应一个文件)

--cipher

只在--encrypted指定时有效。指定加密文件系统时所用到的加密算法。

autostep

通常情况下,kickstart安装时跳过了不必要的屏幕显示。该选项可以让安装过程简单地显示每一步的屏幕。autostep多用于调试。

--autoscreenshot

在安装过程中,将每一步的屏幕截图并在安装完成后将这些截图拷贝到/root/anaconda-screenshots目录下。这对写文档非常有帮助。

bootloader(必需)

该命令指明了引导程序(bootloader)如何被安装.

Important.png
BIOS引导分区
从Fedora16开始,包含GPT/GUID的磁盘必须有一个bios引导分区,用来安装引导程序。该分区必须用kickstart选项part biosboot --fstype=biosboot --size=1创建。然而,如果一个磁盘已经有了bisoboot分区,就没有必要使用"part biosboot"了。

--append=

指定内核参数。引导程序默认的参数是"rhgb quiet"。无论--append的参数是什么,或者你把--append完全遗漏了,你都会得到这个参数。例如:
bootloader --location=mbr --append="hdd=ide-scsi ide=nodma"

--boot-drive=

指定引导程序被写入的驱动器,也即是操作系统开始启动的驱动器。

--leavebootorder

在EFI或者ISeries/PSeries的机器上,该选项可以防止安装器(installer)改变现存的可启动镜像列表。

--driveorder

指定BIOS启动顺序中的第一个驱动器。例如:
bootloader --driveorder=sda,hda

--location=

指定引导记录写入的位置。有效的值包括:mbr(默认),partition(在包含内核的分区的第一个扇区上安装引导程序),或者none(不安装引导程序)。

--password=

如果使用了GRUB,设置GRUB引导程序的密码。该密码用于访问GRUB shell。(在GRUB shell中可以传递任意内核参数)

--iscrypted=

如果被使用,--password=指定的密码已经被加密,而且应该不做额外修改地传递给引导程序的配置文件。

--md5pass=

如果使用了GRUB,类似于--password=,但密码已经被加密。

--timeout=<secs>

指定引导程序超时之前等待的秒数,超时之后将会启动默认选项。

--default=

在引导程序的配置文件中设置默认的启动镜像。

--extlinux

使用extlinux引导程序代替GRUB。该选项只能在extlinux支持的机器上工作。

btrfs

(anaconda-17.3引入)

定义一个BTRFS卷或者子卷(subvolume)。该命令的形式如下:

定义卷:

btrfs <mntpoint> --data=<level> --metadata=<level> --label=<label> <partitions*>

定义子卷:

btrfs <mntpoint> --subvol --name=<path> <parent>

<partitions*>(表示可以列出多个分区)列出了添加到BTRFS卷上的BTRFS标示符。对于子卷来说,<parent>应该是这些子卷对应的父卷的标示符。

<mntpoint>

文件系统的挂载点。

--data=

文件系统数据使用的RAID级别(0, 1, 10)。该选项对于子卷没有意义。

--metadata=

文件系统/卷的元数据使用的RAID级别(0, 1, 10)。可选。该选项对于子卷没有意义。

--label=

指定将要生成的文件系统标签(label)。如果指定的标签已经被另外一个文件系统使用,则会创建一个新的标签。该选项对于子卷没有意义。

--noformat

使用存在的BTRFS卷(或者子卷),不会重新进行格式化操作。

--useexisting

类似于--noformat,同上。

下面的例子展示了如何从分别位于三个磁盘上的三个分区创建一个BTRFS卷和子卷,子卷用于root和home。在示例中,主卷并没有挂载和直接使用--仅使用了root和home子卷。

part btrfs.01 --size=6000 --ondisk=sda
part btrfs.02 --size=6000 --ondisk=sdb
part btrfs.03 --size=6000 --ondisk=sdc

btrfs none --data=0 --metadata=1 --label=f17 btrfs.01 btrfs.02 btrfs.03
btrfs / --subvol --name=root LABEL=f17
btrfs /home --subvol --name=home f17

clearpart

从系统中删除分区,先于新分区的创建。默认不删除任何分区。

Stop (medium size).png
如果使用了clearpart,--onpart命令不能用于该逻辑分区

--all

删除系统上的所有分区。

--drives=

指定从哪个驱动器上删除分区。例如,下面的代码删除了IDE控制器上的前两个驱动器上的所有分区。
clearpart --all --drives=sda,sdb

--list=

指定了要删除的分区。如果使用,它会取代所有的--all--linux选项。它可以在驱动器之间交叉使用:
clearpart --list=sda2,sda3,sdb1

--initlabel

将磁盘标签初始化为体系架构的默认值(例如x86是msdos,Itanium是gpt)。该选项只有和'--all'选项联合使用才有意义。

--linux

删除linux分区。

--none (default)

不删除任何分区。

cmdline

以完全非交互的命令行模式安装。任何导致交互的动作都会使安装过程停止。这种模式对于带有x3270控制台的S/390系统非常有用。

device

在大多数PCI系统上,安装程序会正确地自动探测以太网和SCSI卡。然而,在旧系统和一些PCI系统上,kickstart需要一个提示来寻找正确的设备。device命令告诉安装程序以如下的形式安装额外的模块:

device <moduleName> --opts=<options>

<moduleName>

用应该安装的内核模块名替代。

--opts=

传递给内核模块的选项。例如:
--opts="aic152x=0x340 io=11"

dmraid

dmraid --name= --dev=

driverdisk

kickstart安装过程可以使用磁盘(Driver diskettes)。你需要把磁盘的内容拷贝到系统硬盘上一个分区的根目录。然后使用driverdisk命令告诉安装程序哪里可以找到磁盘内容。

driverdisk <partition>|--source=<url>|--biospart=<part>

<partition>

包含磁盘内容的分区.

--source=<url>

为磁盘内容指定一个URL。NFS位置可以使用nfs:host:/path/to/img给出。

--biospart=<part>

包含磁盘内容的bios分区(例如82p2)。

fcoe

firewall

该选项对应安装程序中的防火墙配置界面:

firewall --enabled|--disabled <device> [options]

--enabled or --enable

拒绝不是如DNS或者DHCP应答之类响应外部请求的连接。如果需要访问在这台机器上运行的服务,你可以通过防火墙选择允许特定的服务。

--disabled or --disable

不配置iptable规则。

--trust=

在这里列出一个设备,比如说eth0,允许来自该设备的数据包通过防火墙。可使用--trust eth0 --trust eth1列出多个设备,而不要使用such as --trust eth0, eth1这样逗号分隔的格式。

<incoming>

使用下面的字符代替<incoming>以允许特定的服务通过防火墙:
--ssh - ssh是被默认开启的,这个选项会被忽略.
--smtp
--http
--ftp

--port=

你可以使用"端口(服务名):协议"这样的格式来指定可以通过防火墙的端口,也可以通过端口号来指定。
firewall --port=imap:tcp,1234:ucp,47

--service=

该选项提供一种更高级别的方式来允许服务通过防火墙。一些服务(例如 cpus, avahi,等)需要多个端口打开或者其他特殊的配置。你可以用 --port或者--service=将它们一次打开。
所有可以被firewalld包中的firewall-offline-cmd程序识别的选项都是可用的。如果firewalld正在运行, firewall-cmd --get-services将会提供一个可以识别的服务的列表。

firstboot

决定是否在第一次启动系统后运行设置代理程序(Setup Agent)。如果使能,firstboot包必须被安装。如果没有使能,firstboot缺省是禁用的。

--enable or --enabled

第一次启动系统后运行设置代理程序。

--disable or --disabled

第一次启动系统后不运行设置代理程序。

--reconfig

使设置代理程序在启动后运行于重新配置模式。该模式启用了默认配置选项之外的语言、鼠标、键盘、根密码、安全级别、时区以及网络配置选项。

group

在系统上创建一个新的用户组。如果指定的组名或者GID已经存在,则该命令失效。除此之外,user命令会为新创建的用户创建新的用户组。

group --name=<name> [--gid=<gid>]

--name=

提供新组的名字。

--gid=

The group's GID. If not provided, this defaults to the next available non-system GID.
用户组标识GID。如果没有提供,默认是下一个可用的非系统GID。

graphical

以图形模式完成kickstart安装。这是默认的。

halt

在安装的最后,显示提示消息并等待用户按键来重启系统。这是默认的操作。

ignoredisk

控制anaconda对系统磁盘的访问。下面的两个选项中可能只有一个被用到。

ignoredisk --drives=[disk1,disk2,...]

指定在分区、格式化、擦出时anaconda不应该访问的磁盘。

ignoredisk --only-use=[disk1,disk2,...]

与上面的选项相反。仅有列出的磁盘可以在安装过程中被使用。

ignoredisk --interactive

允许用户手动进行设置。

install

告诉系统是安装一个全新的系统而不是升级存在的系统(默认)。安装时,你可以从cdrom、硬盘驱动器、nfs、或者url(ftp,http安装)中指定安装类型。install命令和安装方法必须在不同的行设置。

Important.png
注意:从F18起,anaconda不再支持升级。升级必须由FedUp(Fedora升级工具)来完成。

cdrom

cdrom

从系统上的第一个CD-ROM/DVD驱动安装。

harddrive

harddrive [--biospart=<bios partition> | --partition=<partition>] [--dir=<directory>]

从本地驱动器上包含ISO镜像的目录安装,该驱动器必须是vfat或者ext2文件系统。除了改目录之外,还需要以后面的方式提供install.img。一种方式是由boot.iso启动,另一种是在ISO镜像相同的目录中创建一个images/目录,然后将install.img放在那里。
--biospart=
安装用到的BIOS分区(例如82p2)。
--partition=
安装用到的硬盘分区(例如sdb2)。
--dir=
包含ISO镜像和images/install.img的目录。例如:
harddrive --partition=hdb2 --dir=/tmp/install-tree

liveimg

liveimg --url=<url> [--proxy=<proxyurl>] [--checksum=<sha256>] [--noverifyssl]

安装一个磁盘镜像而不是软件包。镜像可以是Live iso上的squashfs.img,也可以是任何可以被安装介质挂载的文件系统(例如ext4)。Anaconda预期该镜像包含完成系统安装所需的实用程序。因此,创建磁盘镜像最好的方法是使用livemedia-creator。如果该镜像包含/LiveOS/*.img(这是squashfs.img的构成),LiveOS中的第一个*.img将会被挂载,并用来安装目标系统。
--url=
安装用到的URL。支持http,https,ftp以及文件。
--proxy=[protocol://][username[:password]@]host[:port]
指定在安装时用到的HTTP/HTTPS/FTP代理。参数的各个部分用实际值来代替。
--checksum=
可选,镜像文件的sha256校验和。
--noverifyssl
对于HTTPS服务器上的目录树,不用检查服务器的证书以及服务器的主机名匹配证书的域名。

nfs

nfs --server=<hostname> --dir=<directory> [--opts=<nfs options>]

从指定的NFS服务器安装。可以是分解的安装树或者ISO镜像的目录。如果是后者,和上面所描述的硬盘驱动器安装方式所遵循的规则一样,必须提供install.img。
--server=
指定服务器(主机名或者IP)。
--dir=
包含安装树的软件包/目录的目录。如果是ISO安装,该目录必须包含images/install.img。
--opts=
挂载NFS的选项。所有可以在/etc/fstab中指定的NFS选项都可以使用。这些选项列表在nfs(5)的man手册中可以查到。多个选相使用逗号分隔。
例如:
nfs --server=nfsserver.example.com --dir=/tmp/install-tree

url

url --url=<url>|--mirrorlist=<url> [--proxy=<proxy url>] [--noverifyssl]

通过FTP和HTTP从远程服务器安装。
--url=
安装用到的URL。在该URL中完成$releasever和$basearch的变量替换(F19中增加)。
--mirrorlist=
安装用到的镜像URL。在该URL中完成$releasever和$basearch的变量替换(F19中增加)。
--proxy=[protocol://][username[:password]@]host[:port]
指定安装时用到的HTTP/HTTPS/FTP代理。参数的各个部分用实际值来代替。
--noverifyssl
对于HTTPS服务器上的目录树,不用检查服务器的证书以及服务器的主机名匹配证书的域名。

iscsi

指定在安装时附加的iSCSI存储。如果要使用iscsi参数,你必须通过iscsiname参数指定iSCSI节点的名字。iscsiname参数在kickstart文件中的位置必须在iscsi参数前面。

iscsi --ipaddr= [options]

无论在哪里使用,我们都推荐在系统BIOS或者固件(Intel系统的iBFT)中配置iSCSI存储,而不是使用iscsi参数。*Anaconda*会自动探测和使用BIOS或者固件中的磁盘配置,不需要在kickstart文件中另外配置。

如果你必须使用iscsi参数,请确保在安装开始时网络是激活的,以及iscsi参数在kickstart文件中的位置应该在引用iscsi磁盘的参数(如clearpart或ignoredisk)之前。

--ipaddr= (mandatory)

要连接的目标端(Target)的IP地址。

--port=

要连接的端口号(默认是--port=3260)。

--target=

目标端iqn.

--iface=

绑定连接到指定的网络接口,而不是使用网络层决定的默认网卡。一旦使用,所有的iscsi命令必须指定。

--user=

目标端鉴定用到的用户名。

--password=

目标端指定用户名对应的密码。

--reverse-user=

使用反向CHAP身份认证的目标端对应的发起端(initiator)鉴定所使用的用户名。

--reverse-password=

发起端指定的用户名对应的密码。

iscsiname

给电脑分配一个发起端名字。如果你在kickstart文件中使用了iscsi参数,该参数是强制的,而且要在iscsi参数之前出现。

iscsiname <iqn>

keyboard(必需)

设置系统键盘类型。可以参考--vckeymap选项的文档以及该节后面的建议来获得此命令能够接受的值。

Important.png
从Fedora18开始,keyboard命令有三个新的选项:

keyboard [--vckeymap=<keymap>] [--xlayouts=<layout1>,<layout2>,...,<layoutN>] [--switch=<option1>...<optionN>] [arg]

--vckeymap 或者 --xlayouts 之一必须使用。
另外,使用旧格式arg依然会被支持。arg 可以是一个X layout或者VConsole的字符映射表文件名。
缺失的值会自动根据已有的值转换。

--vckeymap=<keymap>

指定VConsole应该使用的字符映射表。<keymap>是字符映射表的文件名,和/usr/lib/kbd/keymaps目录下的文件名除去".map.gz"后相同。

--xlayouts=<layout1>,<layout2>,...,<layoutN>

指定应该使用的X layouts的列表(用逗号分隔,无空格)。
接受和setxkbmap(1)相同的值,但使用layout格式(例如cz)或者'layout(变种)'格式(例如'cz (qwerty)')。
例如:
keyboard --xlayouts=cz,'cz (qwerty)'

--switch=<option1>,...,<optionN>

指定应该使用的版式切换选项列表(逗号分隔,无空格)。
接受和setxkbmap同样的值。
例如:
keyboard --xlayouts=cz,'cz (qwerty)' --switch=grp:alt_shift_toggle
Idea.png
如果只知道版式的说明(如Czech (qwerty)),你可以使用http://vpodzime.fedorapeople.org/layouts_list.py 来列出所有可用的版式,然后找到你想要的一种。方括号中的字符串有效的版式规格,因为Anaconda接受它。切换选项可以用同样的方法(http://vpodzime.fedorapeople.org/switching_list.py) (两个脚本都需要安装版本为>= 5.1-1的libxklavier)

lang(需要)

lang <id>

设置安装时的语言,以及所安装系统的默认语言为<id>。可以设置所有可以被环境变量$LANG识别的值,尽管安装过程中并不是识别所有的语言。

某些语言(主要是中文、日语、韩语以及印度语)在文本模式安装时并不支持。如果这些语言中的一种被lang命令指定,安装将会继续使用英语,尽管安装后的系统会默认使用指定的语言。

/usr/share/system-config-language/locale-list文件(system-config-language软件包中的文件)每一行的第一列提供了一个有效语言码的列表。

logvol

为逻辑卷管理(LVM)创建创建一个逻辑卷。

logvol <mntpoint> --vgname=<name> --size=<size> --name=<name> <options>

--noformat

使用一个已经存在的逻辑卷,不进行格式化操作。

--useexisting

使用一个已经存在的逻辑卷,并重新格式化。

--fstype=

为逻辑卷设置文件系统类型。有效的值包含ext4,ext3,ext2,btrfs,swap,vfat。其它的文件系统类型是否有效取决于为使能其它文件系统而传递给anaconda的命令行参数。Btrfs是一个实验性质的文件系统。如果使用它,请务必定期备份。

--fsoptions=

指定一个包含挂载文件系统时用到的选项的自由格式字符串。该字符串将会被引号括起来并拷贝到安装系统的/etc/fstab文件中。

--grow

告诉逻辑卷填充可用的空间(如果有的话),或者填充到最大的容量设置。注意--grow并不被其上包含一个RAID卷的逻辑卷支持。

--maxsize=

当逻辑卷设置了--grow时最大的容量(MB)。指定一个整数值即可,无需在其后加入MB。

--recommended

自动决定逻辑卷的大小。

--percent

以在卷组可用空间中所占的百分比的形式指定逻辑卷的大小。如果没有用到--grow,该选项也许不会起作用。

--encrypted

说明逻辑卷应该被加密。

--passphrase=

指定加密逻辑卷时用到的密码短语。如果没指定--encrypted,该选项不会其作用。如果没有指定密码短语,将会使用系统范围内默认的密码短语。如果没有默认密码短语,安装程序将会停下来提示。

--escrowcert=<url>

<url>加载一个X.509的认证。以文件的形式在/root目录下存储该逻辑卷用证书加密过的数据加密密钥。

--backuppassphrase

仅在--escrowcert指定时相关。除了存储数据加密密钥之外,生成一个随机密码短语,然后添加到逻辑卷中。然后以文件的形式在/root目录下存储用--escrowcert指定的证书加密过的密码短语。如果多于一个LUKS卷使用--backuppassphrase,所有卷将会使用同一个密码短语。

--thinpool

Create a thin pool logical volume. (Use a mountpoint of "none")
创建一个精简池逻辑卷。(使用"none"作为mountpoint)

--metadatasize=<size>

指定精简池设备元数据区域的大小(MB).

--chunksize=<size>

指定精简池设备的块大小(KiB)。

--thin

创建一个精简逻辑卷。(需要用到--poolname)

--poolname=<name>

指定创建精简逻辑卷的精简池的名字。(需要--thin)


首先创建分区,创建逻辑卷组,然后创建逻辑卷。例如:

part pv.01 --size 3000
volgroup myvg pv.01
logvol / --vgname=myvg --size=2000 --name=rootvol

logging

该命令控制anaconda安装过程中的错误日志,并不影响安装系统。

--host=

给远程主机发送发送日志信息,远程主机必须启动配置好接受远程日志的syslogd进程。

--port=

如果远程syslogd进程使用了非默认端口,在这里指定。

--level=

debug,info,warning,error,critical之一。
指定在tty3上输出的最小级别。然而,所有消息仍然被发动到日志文件而不管日志级别如何设置。

mediacheck

如果指定,将会强制anaconda在安装介质上运行mediacheck。该命令需要安装过程被干预,所以默认是禁用的。

monitor

如果指定了monitor命令,anaconda将会使用X来自动探测监视器设置。请在手动配置监视器之前先试一试该命令。

--hsync=

指定监视器水平同步频率。

--monitor=

使用指定的监视器;监视器的名字应该来自于hwdata软件包/usr/share/hwdata/MonitorsDB中监视器列表。该监视器列表也能在Kickstart Configurator的X配置界面中找到。如果--hsync或者--vsync被指定,该选项会被忽略,安装程序会试图自动探测它。

--noprobe

不去探测监视器。

--vsync=

指定监视器的垂直同步频率。

multipath

multipath --name= --device= --rule=

network

配置目标系统的网络信息,在安装环境中激活网络设备。如果需要网络,如从网络安装的情形或者使用到了VNC,第一个network命令的设备会被激活。设备的激活也可以明确地使用--activate选项。如果设备在获取kickstart文件的时候已经被激活(例如,使用boot选项的配置或者进入装载器UI),它会根据kickstart文件的配置重新激活。

在F15上,第一个network命令的设备即使在非网络安装的情形下也会被激活,而且不会根据kickstart文件的配置重新激活设备。

kickstart文件中配置的其它的设备能够在安装器上使用--activate激活(自F16起)。

--bootproto=[dhcp|bootp|static|ibft]

默认设置是dhcp. bootp和dhcp会被同等对待。
DHCP方法使用一个DHCP服务器来获取它的网络配置。你也许会猜到,BOOTP方法是类似的,需要一个BOOTP服务器来提供网络配置。
static方法需要你在kickstart文件中敲入所有网络信息。正如名字所暗示的,该信息是静态的,将会在安装过程中以及安装后使用。静态网络的配置行更为复杂,因为你必须在一行内包含所有的网络配置信息。你必须指定IP地址,网关以及域名服务器。例如:(\ 表示所有的内容在一行上):
network --bootproto=static --ip=10.0.2.15 \
--netmask=255.255.255.0 --gateway=10.0.2.254 \
--nameserver=10.0.2.1
如果你使用static方法,需要弄清楚以下的限制:
  • 所有静态网络配置信息必须在同一行上指定;例如,你不能用反斜线来把多行内容封装成一行。
ibft设置会从iBFT表中读取配置。F16中加入。

--device=

指定要使用network命令配置或者激活的设备。能够以和 ksdevice启动选项相同的方式指定。例如:
network --bootproto=dhcp --device=eth0
对于第一个network命令,如果选项没有被指定,它默认是 1)ksdevice启动选项, 2)为了获得kickstart而激活的设备,或者 3)UI上的选择框。对于如下的network命令,需要--device选项。

--ip=

网络接口的IP地址。

--ipv6=

网络接口的IPv6地址。可以是<IPv6 address>[/<prefix length>]形式的静态地址,例如,3ffe:ffff:0:1::1/128(如果前缀被省略,会被假定为64),"auto"地址分配基于动态的邻居发现协议,而"dhcp"会使用DHCPv6协议。

--gateway=

默认网关,是一个IPv4或者IPv6地址。

--nodefroute

组织设备抓取默认路由。在安装器中使用--activate选项激活其它设备时非常有用,从F16起。

--nameserver=

主域名服务器,是一个IP地址。多个域名服务器必须由逗号分隔。

--nodns

并不配置DNS服务器。

--netmask=

安装系统的网络掩码。

--hostname=

安装系统的主机名。

--ethtool=

指定将要传递给ethtool程序的设备附加的低级别设置。

--essid=

无线网网络ID。

--wepkey=

无线网WEP加密密钥。

--wpakey=

无线网WPA加密密钥(从F16起)。

--onboot=

是否在启动时使能该设备。

--dhcpclass=

DHCP类别。

--mtu=

设备的MTU。

--noipv4

在该设备上禁用IPv4。

--noipv6

在该设备上禁用IPv6。

--bondslaves

使用该选项指定的网卡作为多网卡绑定的从网卡,虚拟出的网卡的名字由--device指定。例如--bondslaves=eth0,eth1。自Fedora 19开始。

--bondopts

--bondslaves--device选项指定的绑定接口指定一个逗号分隔的参数列表。例如:--bondopts=mode=active-backup,primary=eth1。如果一个选项本身以逗号作为分隔符,那么使用分号作为选项之间的分隔符。

--vlanid

使用--device指定的设备作为父设备来创建的vlan设备的Id(802.1q标签)。例如,network --device=eth0 --vlanid=171将会创建vlan设备eth0.171。从Fedora 19起。

--teamslaves

--device选项命名的组设备会以该选项指定的设备作为从设备。从设备之间用逗号分隔。一个从设备可以后接它的配置,一个单引号括起来的json格式字符串,其中的双引号用反斜线转义。例如:--teamslaves="p3p1'{\"prio\": -10, \"sticky\": true}',p3p2'{\"prio\": 100}'"。参考--teamconfig选项。从Fedora 20起。

--teamconfig

指定双引号括起来的组设备配置,json格式的字符串,其中的双引号用反斜线转义。设备名由--device指定,从设备及其配置由--teamslaves选项指定。从Fedora 20起。例如:
network --device team0 --activate --bootproto static --ip=10.34.102.222 --netmask=255.255.255.0 --gateway=10.34.102.254 --nameserver=10.34.39.2  \
--teamslaves="p3p1'{\"prio\": -10, \"sticky\": true}',p3p2'{\"prio\": 100}'" \
--teamconfig="{\"runner\": {\"name\": \"activebackup\"}}"

part or partition(必需)

在系统上创建一个分区。

Stop (medium size).png
创建的所有分区在安装过程中都会被格式化,除非使用了--noformat--onpart

part <mntpoint>

<mntpoint>是分区将要被挂载的地方,必须是以下格式中的一种:

/<path>
例如 /, /usr, /home
swap
分区将被用作交换分区。
为了自动决定交换分区的大小,可以使用--recommended选项。从Fedora 18开始,--hibernation选项可以被用来自动决定交换分区大小,以便其能足够大来支持系统休眠。
raid.<id>
分区将会为软件RAID使用(参考raid)。
pv.<id>
分区将会为LVM而使用(参考logvol)。

--size=

最小分区大小(MB)。这里可以指定一个整数值如500.不要在后面加MB。

--grow

告诉分区增长以填满可用空间(如果有的话),或者填满设置的最大值。注意,--grow并不支持RAID卷在上的分区。

--maxsize=

分区被设置为grow时的最大分区大小(MB)。指定一个整数值,不要在后面加上MB。

--noformat

告诉安装程序不格式化分区,和--onpart一起使用。

--onpart= or --usepart=

把分区放在已经存在的设备上。使用"--onpart=LABEL=name"或者"--onpart=UUID=name" 来通过各自的标签(label)或uuid来指定一个分区。
Stop (medium size).png
Anaconda也许会以特殊的顺序创建分区,所以使用标签比只用分区名要安全些

--ondisk= or --ondrive=

强制在特定的磁盘上创建。

--asprimary

强制分区作为主分区,否则会导致分区失败。

--fsprofile=

为在该分区上创建文件系统的程序指定使用类型。使用类型定义了创建文件系统时各种各样的调整参数。为了让该选项能起作用,文件系统必须支持使用类型的概念,而且必须有一个配置文件列出所有可用的类型。对于ext2/3/4,配置文件位于/etc/mke2fs.conf

--fstype=

为分区设置文件系统类型。有效值包括ext4,ext3,ext2,btrfs,swap以及vfat。其它文件系统是否有效取决于传递给anaconda使能其它文件系统的命令行参数。

--fsoptions=

为挂载文件系统指定自由格式的字符串选项。该字符串将会被拷贝到安装系统的/etc/fstab文件中并且应该被引号括起来。

--label=

指定分区上创建的文件系统标签。如果所指定的标签已经被其它文件系统使用,新的标签将会被创建。

--recommended

自动决定分区大小。

--onbiosdisk=

强制在BIOS发现的特定磁盘上创建分区。

--encrypted

说明该分区应该被加密

--passphrase=

指定加密分区时指定的密码短语。如果没有上述--encrypted选项,该选项不起任何作用。如果没有密码短语被指定,将会使用系统范围内的默认密码短语,如果没有默认的,安装器会停下来提醒。

--escrowcert=<url>

从<url>加载X.509认证。存储用证书加密过的数据加密密钥。只在--encrypted指定时有效。

--backuppassphrase

只在--escrowcert指定时相关。除了存储数据加密密钥之外,产生一个随机密码短语并将其添加到该分区。然后使用--escrowcert指定的证书加密并存储于/root。如果不止一个LUKS卷使用--backuppassphrase,它们将共享该密码短语。
Stop (medium size).png
如果分区失败,诊断信息将会被输出到虚拟终端3.

poweroff

安装完成后关闭机器。通常,kickstart在重起之前会显示一条消息并等待用户键入任意字符。

raid

装配一个软件RAID设备,命令形式如下:

raid <mntpoint> --level=<level> --device=<mddevice> <partitions*>

<mntpoint>

RAID文件系统挂载的地方。如果是/,RAID级别必须是1,除非存在boot分区(/boot)。如果存在boot分区,root分区的RAID级别必须是1,而根分区(/)可以是任意可用的类型。<partitions*>(可以列举多个分区)列出了添加到RAID阵列的RAID标示符。

--level=

要使用的RAID级别(0, 1, 4, 5, 6, or 10).

--device=

Name of the RAID device to use (such as 'fedora-root' or 'home'). As of Fedora 19, RAID devices are no longer referred to by names like 'md0'. If you have an old (v0.90 metadata) array that you cannot assign a name to, you can specify the array by a filesystem label or UUID (eg: --device=LABEL=fedora-root).
要使用的RAID设备名(例如'fedora-root'或者'home')。到Fedora 19为止,RAID设备不再由名字(如'md0')引用。如果你有比较旧的(v0.90 metadata)、不能分配名字的阵列,可以通过文件系统标签或者UUID来指定阵列(例如: --device=LABEL=fedora-root)。

--spares=

指定分配给RAID阵列剩余的驱动器数量。剩余的驱动器再驱动器失效时重建阵列。

--fstype=

设置RAID阵列的文件系统类型。有效值包括ext4,ext3,ext2,btrfs,swap以及vfat。其它的文件系统是否有效依赖于传递给anaconda来使能其它文件系统的命令行参数。

--fsoptions=

指定一个挂载文件系统用到的自由格式的字符串选项。字符串将会引号括起来并被拷贝到安装系统的/etc/fstab文件中,

--label=

指定要制作的文件系统的标签。如果该标签已经存在,新的标签会被创建。

--noformat

使用一个已经存在的RAID设备而且不格式化阵列。

--useexisting

使用一个已经存在的RAID设备并且重新格式化。

--encrypted

说明RAID设备应该被加密。

--passphrase=

指定加密RAID设备时用到的密码短语。如果没有上述的--encrypted选项,该选项无效。如果没有指定密码短语,会使用系统范围内默认的,如果默认的不存在,安装器会停下来提醒。

--escrowcert=<url>

<url>加载一个X.509认证。用/root目录下的文件来存储使用证书加密过的RAID设备的数据加密密钥。--encrypted指定时起作用。

--backuppassphrase

仅在--escrowcert指定时相关。除了存储数据加密密钥外,生成一个随机密码短语,并添加到RAID设备。然后将其用--escrowcert指定的证书加密,并以文件的形式存储在/root中。如果不止一个LUKS卷使用--backuppassphrase,它们会使用相同的密码短语。

下面的例子展示了如何为/创建一个RAID1的分区,以及如何为/usr创建一个RAID5的分区(假定系统上有3个磁盘)。也创建了3个swap分区,每个驱动器一个。

part raid.01 --size=6000 --ondisk=sda
part raid.02 --size=6000 --ondisk=sdb
part raid.03 --size=6000 --ondisk=sdc

part swap1 --size=512 --ondisk=sda
part swap2 --size=512 --ondisk=sdb
part swap3 --size=512 --ondisk=sdc

part raid.11 --size=6000 --ondisk=sda
part raid.12 --size=6000 --ondisk=sdb
part raid.13 --size=6000 --ondisk=sdc

raid / --level=1 --device=md0 raid.01 raid.02 raid.03
raid /usr --level=5 --device=md1 raid.11 raid.12 raid.13

realm

连接FreeIPA域的一个活动目录。

realm join <domain.example.com>

--computer-ou=

指定创建计算机账户的组织单元的可以区分的名字。该名字的格式是否正确依赖于客户端软件及成员软件。名字通常可以省略DSE部分。

--no-password

完成无密码自动连接。

--one-time-password=

使用命令行指定的一次性密码完成连接。不可能适用于所有的realm.

--client-software=

仅连接我们指定可用的客户端软件的realm。可能的值包括sssd或者winbind。并不是所有的realm都支持所有的值。默认情形下,客户端软件会自动选择。

--server-software=

仅连接运行指定服务器端软件的realm。可能的值是active-directory或者freeipa

--membership-software=

连接realm使用的软件。可能的值是samba或者adcli。并不是所有的realm都支持所有值。默认会自动选择。
realm join --one-time-password=12345 DC.EXAMPLE.COM

reboot

安装完成后重启。通常情况下,kickstart显示消息并在重启之前等待用户按键。

--eject

重启之前尝试弹出CD或者DVD。

repo

Configures additional yum repositories that may be used as sources for package installation. Multiple repo lines may be specified. By default, anaconda has a configured set of repos taken from /etc/anaconda.repos.d plus a special Installation Repo in the case of a media install. The exact set of repos in this directory changes from release to release and cannot be listed here. There will likely always be a repo named "updates".

Note: If you want to enable one of the repos in /etc/anaconda.repos.d that is disabled by default (like "updates"), you should use --name=<repoid> but none of the other options. anaconda will look for a repo by this name automatically. Providing a baseurl or mirrorlist URL will result in anaconda attempting to add another repo by the same name, which will cause a conflicting repo error.

repo --name=<name> [--baseurl=<url>|--mirrorlist=<url>] [options]

--name=

The repo id. This option is required. If a repo has a name that conflicts with a previously added one, the new repo will be ignored. Because anaconda has a populated list of repos when it starts, this means that users cannot create new repos that override these names. Please check /etc/anaconda.repos.d from the operating system you wish to install to see what names are not available.

--baseurl=

The URL for the repository. The variables that may be used in yum repo config files are not supported here. You may use one of either this option or --mirrorlist, not both. If an NFS repository is specified, it should be of the form nfs://host:/path/to/repo. Note that there is a colon after the host--Anaconda passes everything after "nfs://" directly to the mount command instead of parsing URLs according to RFC 2224. Variable substitution is done for $releasever and $basearch in the url (added in F19).

--mirrorlist=

The URL pointing at a list of mirrors for the repository. The variables that may be used in yum repo config files are not supported here. You may use one of either this option or --baseurl, not both. Variable substitution is done for $releasever and $basearch in the url (added in F19).

--cost=

An integer value to assign a cost to this repository. If multiple repositories provide the same packages, this number will be used to prioritize which repository will be used before another. Repositories with a lower cost take priority over repositories with higher cost.

--excludepkgs=

A comma-separated list of package names and globs that must not be pulled from this repository. This is useful if multiple repositories provide the same package and you want to make sure it comes from a particular repository.

--includepkgs=

A comma-separated list of package names and globs that must be pulled from this repository. This is useful if multiple repositories provide the same package and you want to make sure it comes from this repository.

--proxy=[protocol://][username[:password]@]host[:port]

Specify an HTTP/HTTPS/FTP proxy to use just for this repository. This setting does not affect any other repositories, nor how the install.img is fetched on HTTP installs. The various parts of the argument act like you would expect.

--ignoregroups=true

This option is used when composing installation trees and has no effect on the installation process itself. It tells the compose tools to not look at the package group information when mirroring trees so as to avoid mirroring large amounts of unnecessary data.

--noverifyssl

For a https repo do not check the server's certificate with what well-known CA validate and do not check the server's hostname matches the certificate's domain name.

rescue

Automatically enter the installer's rescue mode. This gives you a chance to repair the system should something catastrophic happen.

rescue [--nomount|--romount]

--nomount|--romount]

Controls how the installed system is mounted in the rescue environment. By default, the installer will find your system and mount it in read-write mode, telling you where it has performed this mount. You may optionally choose to not mount anything or mount in read-only mode. Only one of these two options may be given at any one time.

rootpw

This required command sets the system's root password to the <password> argument.

rootpw [options] <password>

--iscrypted|--plaintext

If this is present, the password argument is assumed to already be encrypted. --plaintext has the opposite effect - the password argument is assumed to not be encrypted. To create an encrypted password you can use python: python -c 'import crypt; print(crypt.crypt("My Password", "$6$My Sault"))' This will generate sha512 crypt of your password using your provided salt.

--lock

If this is present, the root account is locked by default. That is, the root user will not be able to login from the console.

selinux

Sets the state of SELinux on the installed system. SELinux defaults to enforcing in anaconda.

selinux [--disabled|--enforcing|--permissive]

--disabled

If this is present, SELinux is disabled.

--enforcing

If this is present, SELinux is set to enforcing mode.

--permissive

If this is present, SELinux is enabled, but only logs things that would be denied in enforcing mode.

services

Modifies the default set of services that will run under the default runlevel. The services listed in the disabled list will be disabled before the services listed in the enabled list are enabled.

services [--disabled=<list>] [--enabled=<list>]

--disabled=

Disable the services given in the comma separated list.

--enabled=

Enable the services given in the comma separated list.

shutdown

At the end of installation, shut down the machine. This is the same as the poweroff command. Normally, kickstart displays a message and waits for the user to press a key before rebooting.

sshpw

The installer can start up ssh to provide for interactivity and inspection, just like it can with telnet. The "inst.sshd" option must be specified on the kernel command-line for Anaconda to start an ssh daemon. The sshpw command is used to control the accounts created in the installation environment that may be remotely logged into. For each instance of this command given, a user will be created. These users will not be created on the final system - they only exist for use while the installer is running.

Note that by default, root has a blank password. If you don't want any user to be able to ssh in and have full access to your hardware, you must specify sshpw for username root. Also note that if Anaconda fails to parse the kickstart file, it will allow anyone to login as root and have full access to your hardware.

sshpw --username=<name> <password> [--iscrypted|--plaintext] [--lock]

--username=

Provides the name of the user. This option is required.

--iscrypted|--plaintext

If this is present, the password argument is assumed to already be encrypted. --plaintext has the opposite effect - the password argument is assumed to not be encrypted. The default is plaintext.

--lock

If this is present, the new user account is locked by default. That is, the user will not be able to login from the console.

skipx

If present, X is not configured on the installed system.

text

Perform the kickstart installation in text mode. Kickstart installations are performed in graphical mode by default.

timezone

This required command sets the system time zone to <timezone> which may be any of the time zones listed by timeconfig.

timezone [--utc] <timezone>

--utc

If present, the system assumes the hardware clock is set to UTC (Greenwich Mean) time.
Idea.png
To get the list of supported timezones, you can either run this script: http://vpodzime.fedorapeople.org/timezones_list.py or look at this list: http://vpodzime.fedorapeople.org/timezones_list.txt


Important.png
Starting with Fedora 18 the timezone command has two new options:

timezone [--utc] [--nontp] [--ntpservers=<server1>,<server2>,...,<serverN>] <timezone>

--nontp

Disable automatic starting of NTP service.

--ntpservers=<server1>,<server2>,...,<serverN>

Specify a list of NTP servers to be used (comma-separated list with no spaces).
For example:
timezone --ntpservers=ntp.cesnet.cz,tik.nic.cz Europe/Prague

updates

Specify the location of an updates.img for use in installation. See anaconda-release-notes.txt for a description of how to make an updates.img.

updates [URL]

If present, the URL for an updates image.
If not present, anaconda will attempt to load from a floppy disk.

upgrade

Important.png
Note that from F18 onward, upgrades are no longer supported in anaconda and should be done with FedUp, the Fedora update tool.

Tells the system to upgrade an existing system rather than install a fresh system. You must specify one of cdrom, harddrive, nfs, or url (for ftp and http) as the location of the installation tree. Refer to install for details.

--root-device=<root> (optional)

On a system with multiple installs, this option specifies which filesystem holds the installation to be upgraded. This can be specified by device name, UUID=<uuid>, or LABEL=<fslabel> just like the harddrive command may be.

user

Creates a new user on the system.

user --name=<username> [--gecos=<string>] [--groups=<list>] [--homedir=<homedir>] [--password=<password>] [--iscrypted|--plaintext] [--lock] [--shell=<shell>] [--uid=<uid>]

--name=

Provides the name of the user. This option is required.

--gecos=

Provides the GECOS information for the user. This is a string of various system-specific fields separated by a comma. It is frequently used to specify the user's full name, office number, and the like. See man 5 passwd for more details.

--groups=

In addition to the default group, a comma separated list of group names the user should belong to.

--homedir=

The home directory for the user. If not provided, this defaults to /home/<username>.

--lock

If this is present, the new user account is locked by default. That is, the user will not be able to login from the console.

--password=

The new user's password. If not provided, the account will be locked by default.
If this is present, the password argument is assumed to already be encrypted. --plaintext has the opposite effect - the password argument is assumed to not be encrypted. To create an encrypted password you can use python: python -c 'import crypt; print(crypt.crypt("My Password", "$6$My Sault"))' This will generate sha512 crypt of your password using your provided salt.


--iscrypted|--plaintext

Is the password provided by --password already encrypted or not? --plaintext has the opposite effect - the password argument is assumed to not be encrypted.

--shell=

The user's login shell. If not provided, this defaults to the system default.

--uid=

The user's UID. If not provided, this defaults to the next available non-system UID.

vnc

Allows the graphical installation to be viewed remotely via VNC. This method is usually preferred over text mode, as there are some size and language limitations in text installs. With no options, this command will start a VNC server on the machine with no password and will print out the command that needs to be run to connect a remote machine.

vnc [--host=<hostname>] [--port=<port>] [--password=<password>]

--host=

Instead of starting a VNC server on the install machine, connect to the VNC viewer process listening on the given hostname.

--port=

Provide a port that the remote VNC viewer process is listening on. If not provided, anaconda will use the VNC default.

--password=

Set a password which must be provided to connect to the VNC session. This is optional, but recommended.

volgroup

Use to create a Logical Volume Management (LVM) group.

volgroup <name> <partitions*> <options>

<name>

Name given to the volume group. The <partitions*> (which denotes that multiple partitions can be listed) lists the identifiers to add to the volume group.

--noformat

Use an existing volume group. Do not specify partitions when using this option.

--useexisting

Use an existing volume group. Do not specify partitions when using this option.

--pesize=

Set the size of the physical extents.

--reserved-space=

Specify an amount of space to leave unused in a volume group, in megabytes. (new volume groups only)

--reserved-percent=

Specify a percentage of total volume group space to leave unused. (new volume groups only)

Create the partition first, create the logical volume group, and then create the logical volume. For example:

part pv.01 --size 3000
volgroup myvg pv.01
logvol / --vgname=myvg --size=2000 --name=rootvol

xconfig

Configures the X Window System. If this option is not given, anaconda will use X to attempt to automatically configure. Please try this before manually configuring your system.

--defaultdesktop=

Specify either GNOME or KDE to set the default desktop (assumes that GNOME Desktop Environment and/or KDE Desktop Environment has been installed through %packages).

--startxonboot

Use a graphical login on the installed system.

zerombr

If zerombr is specified, any disks whose formatting is unrecognized are initialized. This will destroy all of the contents of disks with invalid partition tables or other formatting unrecognizable to the installer. It is useful so that the installation program does not ask if it should initialize the disk label if installing to a brand new hard drive.

zfcp

--devnum=

--fcplun=

--wwpn=

 %include

Use the %include /path/to/file or %include <url> command to include the contents of another file in the kickstart file as though the contents were at the location of the %include command in the kickstart file.

 %ksappend

The %ksappend url directive is very similar to %include in that it is used to include the contents of additional files as though they were at the location of the %ksappend directive. The difference is in when the two directives are processed. %ksappend is processed in an initial pass, before any other part of the kickstart file. Then, this expanded kickstart file is passed to the rest of anaconda where all %pre scripts are handled, and then finally the rest of the kickstart file is processed in order, which includes %include directives.

Thus, %ksappend provides a way to include a file containing %pre scripts, while %include does not.

Chapter 3. 包的选择

Use the %packages command to begin a kickstart file section that lists the packages you would like to install.

Packages can be specified by group or by individual package name. The installation program defines several groups that contain related packages. Refer to the repodata/*comps.xml file on the first CD-ROM for a list of groups. Each group has an id, user visibility value, name, description, and package list. In the package list, the packages marked as mandatory are always installed if the group is selected, the packages marked default are selected by default if the group is selected, and the packages marked optional must be specifically selected even if the group is selected to be installed.

In most cases, it is only necessary to list the desired groups and not individual packages. Note that the Core group is always selected by default, so it is not necessary to specify it in the %packages section.

The %packages section is required to be closed with %end. Also, multiple %packages sections may be given. This may be handy if the kickstart file is used as a template and pulls in various other files with the %include mechanism.

Here is an example %packages selection:

%packages
@X Window System
@GNOME Desktop Environment
@Graphical Internet
@Sound and Video
dhcp
%end

As you can see, groups are specified, one to a line, starting with an @ symbol followed by the full group name as given in the comps.xml file. Groups can also be specified using the id for the group, such as gnome-desktop. Specify individual packages with no additional characters (the dhcp line in the example above is an individual package).

You can also specify environments using the @^ prefix followed by full environment name as given in the comps.xml file. If multiple environments are specified, only the last one specified will be used. Environments can be mixed with both group specifications (even if the given group is not part of the specified environment) and package specifications.

Here is an example of requesting the GNOME Desktop environment to be selected for installation:

%packages
@^gnome-desktop-environment
%end

Additionally, individual packages may be specified using globs. For instance:

%packages
vim*
kde-i18n-*
%end

This would install all packages whose names start with "vim" or "kde-i18n-".

You can also specify which packages or groups not to install from the default package list:

%packages
-autofs
-@Sound and Video
%end

The following options are available for the %packages option:

--default
Install the default package set. This corresponds to the package set that would be installed if no other selections were made on the package customization screen during an interactive install.
--excludedocs
Do not install any of the documentation from any packages. For the most part, this means files in /usr/share/doc* will not get installed though it could mean other files as well, depending on how the package was built.
--ignoremissing
Ignore any packages or groups specified in the packages section that are not found in any configured repository. The default behavior is to halt the installation and ask the user if the installation should be aborted or continued. This option allows fully automated installation even in the error case. It is used as follows:
%packages --ignoremissing
--instLangs=
Specify the list of languages that should be installed. This is different from the package group level selections, though. This option does not specify what package groups should be installed. Instead, it controls which translation files from individual packages should be installed by setting RPM macros. Note: this option is not supported by anaconda at the moment, but is recognized by pykickstart for use in such tools as livecd-creator.
--multilib
Enable yum's "all" multilib_policy as opposed to the default of "best".
--nocore
Do not install the @core group (installed by default, otherwise).

In addition, group lines in the %packages section can take options as well:

--nodefaults
Only install the group's mandatory packages, not the default selections.
--optional
In addition to the mandatory and default packages, also install the optional packages. This means all packages in the group will be installed.

Chapter 4. Pre-installation Script

You can add commands to run on the system immediately after the ks.cfg has been parsed and the lang, keyboard, and url options have been processed. This section must be at the end of the kickstart file (after the commands) and must start with the %pre command. You can access the network in the %pre section; however, name service has not been configured at this point, so only IP addresses will work.

Preinstallation scripts are required to be closed with %end.

Stop (medium size).png
If your script spawns a daemon process, you must make sure to close stdout and stderr. Doing so is standard procedure for creating daemons. If you do not close these file descriptors, the installation will appear hung as anaconda waits for an EOF from the script.
Stop (medium size).png
Note that the pre-install script is not run in the chroot environment.
--interpreter /usr/bin/python
Allows you to specify a different scripting language, such as Python. Replace /usr/bin/python with the scripting language of your choice.
--erroronfail
If the pre-installation script fails, this option will cause an error dialog to be displayed and will halt installation. The error message will direct you to where the cause of the failure is logged.
--log=
Log all messages from the script to the given log file.

Example

Here is an example %pre section:

%pre
#!/bin/bash
hds=""
mymedia=""

for file in /sys/block/sd*; do
hds="$hds $(basename $file)"
done

set $hds
numhd=$(echo $#)

drive1=$(echo $hds | cut -d' ' -f1)
drive2=$(echo $hds | cut -d' ' -f2)


if [ $numhd == "2" ]  ; then
echo "#partitioning scheme generated in %pre for 2 drives" > /tmp/part-include
echo "clearpart --all" >> /tmp/part-include
echo "part /boot --fstype ext4 --size 512 --ondisk sda" >> /tmp/part-include
echo "part / --fstype ext4 --size 10000 --grow --ondisk sda" >> /tmp/part-include
echo "part swap --recommended --ondisk $drive1" >> /tmp/part-include
echo "part /home --fstype ext4 --size 10000 --grow --ondisk sdb" >> /tmp/part-include
else
echo "#partitioning scheme generated in %pre for 1 drive" > /tmp/part-include
echo "clearpart --all" >> /tmp/part-include
echo "part /boot --fstype ext4 --size 521" >> /tmp/part-include
echo "part swap --recommended" >> /tmp/part-include
echo "part / --fstype ext4 --size 2048" >> /tmp/part-include
echo "part /home --fstype ext4 --size 2048 --grow" >> /tmp/part-include
fi
%end

This script determines the number of hard drives in the system and writes a text file with a different partitioning scheme depending on whether it has one or two drives. Instead of having a set of partitioning commands in the kickstart file, include the line:

%include /tmp/part-include

The partitioning commands selected in the script will be used.

Chapter 5. Post-installation Script

You have the option of adding commands to run on the system once the installation is complete. This section must be at the end of the kickstart file and must start with the %post command. This section is useful for functions such as installing additional software and configuring an additional nameserver.

You may have more than one %post section, which can be useful for cases where some post-installation scripts need to be run in the chroot and others that need access outside the chroot.

Each %post section is required to be closed with a corresponding %end.

Stop (medium size).png
If you configured the network with static IP information, including a nameserver, you can access the network and resolve IP addresses in the %post section. If you configured the network for DHCP, the /etc/resolv.conf file has not been completed when the installation executes the %post section. You can access the network, but you can not resolve IP addresses. Thus, if you are using DHCP, you must specify IP addresses in the %post section.
Stop (medium size).png
If your script spawns a daemon process, you must make sure to close stdout and stderr. Doing so is standard procedure for creating daemons. If you do not close these file descriptors, the installation will appear hung as anaconda waits for an EOF from the script.
Stop (medium size).png
The post-install script is run in a chroot environment; therefore, performing tasks such as copying scripts or RPMs from the installation media will not work.
--nochroot
Allows you to specify commands that you would like to run outside of the chroot environment.
--interpreter /usr/bin/python
Allows you to specify a different scripting language, such as Python. Replace /usr/bin/python with the scripting language of your choice.
--erroronfail
If the post-installation script fails, this option will cause an error dialog to be displayed and will halt installation. The error message will direct you to where the cause of the failure is logged.
--log=
Log all messages from the script to the given log file.

Examples

Run a script named runme from an NFS share:

%post
mkdir /mnt/temp
mount 10.10.0.2:/usr/new-machines /mnt/temp
open -s -w -- /mnt/temp/runme
umount /mnt/temp
%end

Copy the file /etc/resolv.conf to the file system that was just installed:

%post --nochroot
cp /etc/resolv.conf /mnt/sysimage/etc/resolv.conf
%end
Stop (medium size).png
If your kickstart is being interpreted by the livecd-creator tool, you should replace /mnt/sysimage above with $INSTALL_ROOT.

Chapter 6. Making the Kickstart File Available

A kickstart file must be placed in one of the following locations:

  • On a boot diskette
  • On a boot CD-ROM
  • On a network

Normally a kickstart file is copied to the boot diskette, or made available on the network. The network-based approach is most commonly used, as most kickstart installations tend to be performed on networked computers.

Let us take a more in-depth look at where the kickstart file may be placed.

Creating a Kickstart Boot Diskette

To perform a diskette-based kickstart installation, the kickstart file must be named ks.cfg and must be located in the boot diskette's top-level directory. Refer to the section Making an Installation Boot Diskette in the Red Hat Enterprise Linux Installation Guide for instruction on creating a boot diskette. Because the boot diskettes are in MS-DOS format, it is easy to copy the kickstart file under Linux using the mcopy command:

mcopy ks.cfg a:

Alternatively, you can use Windows to copy the file. You can also mount the MS-DOS boot diskette in Linux with the file system type vfat and use the cp command to copy the file on the diskette.

Creating a Kickstart Boot CD-ROM

To perform a CD-ROM-based kickstart installation, the kickstart file must be named ks.cfg and must be located in the boot CD-ROM's top-level directory. Since a CD-ROM is read-only, the file must be added to the directory used to create the image that is written to the CD-ROM. Refer to the Making an Installation Boot CD-ROM section in the Red Hat Enterprise Linux Installation Guide for instruction on creating a boot CD-ROM; however, before making the file.iso image file, copy the ks.cfg kickstart file to the isolinux/ directory.

Making the Kickstart File Available on the Network

Network installations using kickstart are quite common, because system administrators can easily automate the installation on many networked computers quickly and painlessly. In general, the approach most commonly used is for the administrator to have both a BOOTP/DHCP server and an NFS server on the local network. The BOOTP/DHCP server is used to give the client system its networking information, while the actual files used during the installation are served by the NFS server. Often, these two servers run on the same physical machine, but they are not required to.

To perform a network-based kickstart installation, you must have a BOOTP/DHCP server on your network, and it must include configuration information for the machine on which you are attempting to install Fedora or Red Hat Enterprise Linux. The BOOTP/DHCP server will provide the client with its networking information as well as the location of the kickstart file.

If a kickstart file is specified by the BOOTP/DHCP server, the client system will attempt an NFS mount of the file's path, and will copy the specified file to the client, using it as the kickstart file. The exact settings required vary depending on the BOOTP/DHCP server you use.

Here is an example of a line from the dhcpd.conf file for the DHCP server:

filename "/usr/new-machine/kickstart/";
server-name "blarg.redhat.com";

Note that you should replace the value after filename with the name of the kickstart file (or the directory in which the kickstart file resides) and the value after server-name with the NFS server name.

If the filename returned by the BOOTP/DHCP server ends with a slash ("/"), then it is interpreted as a path only. In this case, the client system mounts that path using NFS, and searches for a particular file. The filename the client searches for is:

<ip-addr>-kickstart

The <ip-addr> section of the filename should be replaced with the client's IP address in dotted decimal notation. For example, the filename for a computer with an IP address of 10.10.0.1 would be 10.10.0.1-kickstart.

Note that if you do not specify a server name, then the client system will attempt to use the server that answered the BOOTP/DHCP request as its NFS server. If you do not specify a path or filename, the client system will try to mount /kickstart from the BOOTP/DHCP server and will try to find the kickstart file using the same <ip-addr>-kickstart filename as described above.

HTTP Headers

When Anaconda requests the kickstart over the network it includes several custom HTTP headers:

X-Anaconda-Architecture: x86_64 indicates the architecture of the system being installed to.

X-Anaconda-System-Release: Fedora indicates the product name being installed.

There are also 2 optional headers, controlled by the kernel command line options kssendmac and kssendsn

Chapter 7. Making the Installation Tree Available

The kickstart installation needs to access an installation tree. An installation tree is a copy of the binary Fedora or Red Hat Enterprise Linux CD-ROMs with the same directory structure.

If you are performing a CD-based installation, insert the Fedora or Red Hat Enterprise Linux CD-ROM #1 into the computer before starting the kickstart installation.

If you are performing a hard-drive installation, make sure the ISO images of the binary Fedora or Red Hat Enterprise Linux CD-ROMs are on a hard drive in the computer.

If you are performing a network-based (NFS, FTP, or HTTP) installation, you must make the installation tree available over the network. Refer to the Preparing for a Network Installation section of the Red Hat Enterprise Linux Installation Guide for details.

Chapter 8. Starting a Kickstart Installation

To begin a kickstart installation, you must boot the system from a Fedora or Red Hat Enterprise Linux boot diskette, Fedora or Red Hat Enterprise Linux boot CD-ROM, or the Fedora or Red Hat Enterprise Linux CD-ROM #1 and enter a special boot command at the boot prompt. In order to get to the boot prompt you must hit escape at the CD or DVD boot menu. In case you don't know what I'm talking about I took a screenshot. The installation program looks for a kickstart file if the ks command line argument is passed to the kernel.

https://fedoraproject.org/wiki/File:Fedora_boot_screen.png

Boot Diskette

If the kickstart file is located on a boot diskette as described in the Section called Creating a Kickstart Boot Diskette in Chapter 6, boot the system with the diskette in the drive, and enter the following command at the boot: prompt:

linux ks=floppy

CD-ROM #1 and Diskette

The linux ks=floppy command also works if the ks.cfg file is located on a vfat or ext2 file system on a diskette and you boot from the Fedora or Red Hat Enterprise Linux CD-ROM #1.

An alternate boot command is to boot off the Fedora or Red Hat Enterprise Linux CD-ROM #1 and have the kickstart file on a vfat or ext2 file system on a diskette. To do so, enter the following command at the boot: prompt:

linux ks=hd:fd0:/ks.cfg

With Driver Disk

If you need to use a driver disk with kickstart, specify the dd option as well. For example, to boot off a boot diskette and use a driver disk, enter the following command at the boot: prompt:

linux ks=floppy dd

Boot CD-ROM

If the kickstart file is on a boot CD-ROM as described in the Section called Creating a Kickstart Boot CD-ROM in Chapter 6, insert the CD-ROM into the system, boot the system, and enter the following command at the boot: prompt (where ks.cfg is the name of the kickstart file):

linux ks=cdrom:<device>:/ks.cfg

Other kickstart options:

ks=nfs:<server>:/<path>

The installation program will look for the kickstart file on the NFS server <server>, as file <path>. The installation program will use DHCP to configure the Ethernet card. For example, if your NFS server is server.example.com and the kickstart file is in the NFS share /mydir/ks.cfg, the correct boot command would be ks=nfs:server.example.com:/mydir/ks.cfg.

ks=http://<server>/<path>

The installation program will look for the kickstart file on the HTTP server <server>, as file <path>. The installation program will use DHCP to configure the Ethernet card. For example, if your HTTP server is server.example.com and the kickstart file is in the HTTP directory /mydir/ks.cfg, the correct boot command would be ks=http://server.example.com/mydir/ks.cfg.

ks=floppy

The installation program looks for the file ks.cfg on a vfat or ext2 file system on the diskette in /dev/fd0.

ks=floppy:/<path>

The installation program will look for the kickstart file on the diskette in /dev/fd0, as file <path>.

ks=hd:<device>:/<file>

The installation program will mount the file system on <device> (which must be vfat or ext2), and look for the kickstart configuration file as <file> in that file system (for example, ks=hd:sda3:/mydir/ks.cfg).

ks=bd:<biosdev>:/<path>

The installation program will mount the file system on the specified partition on the specified BIOS device <biosdev> (for example, ks=bd:80p3:/mydir/ks.cfg). Note this does not work for BIOS RAID sets.

ks=file:/<file>

The installation program will try to read the file <file> from the file system; no mounts will be done. This is normally used if the kickstart file is already on the initrd image.

ks=cdrom:/<path> or in newer versions ks=cdrom:<cdrom device>:/<path>

The installation program will look for the kickstart file on CD-ROM, as file <path>.

ks

If ks is used alone, the installation program will configure the Ethernet card to use DHCP. The kickstart file is read from the "bootServer" from the DHCP response as if it is an NFS server sharing the kickstart file. By default, the bootServer is the same as the DHCP server. The name of the kickstart file is one of the following:
* If DHCP is specified and the bootfile begins with a /, the bootfile provided by DHCP is looked for on the NFS server.
* If DHCP is specified and the bootfile begins with something other then a /, the bootfile provided by DHCP is looked for in the /kickstart directory on the NFS server.
* If DHCP did not specify a bootfile, then the installation program tries to read the file /kickstart/1.2.3.4-kickstart, where 1.2.3.4 is the numeric IP address of the machine being installed.

ksdevice=<device>

The installation program will use this network device to connect to the network. For example, to start a kickstart installation with the kickstart file on an NFS server that is connected to the system through the eth1 device, use the command ks=nfs:<server>:/<path> ksdevice=eth1 at the boot: prompt. For more information, see Anaconda_Boot_Options.

Example Kickstart Script

Since I got tons of errors I thought I would share an example of a kickstart script that works. This also has an example of an lvm setup. I couldn't find a good example of an lvm anywhere else. I also added comments where I thought would help. Please modify if you think you have some other good examples.

# Kickstart file automatically generated by anaconda.

#version=DEVEL
#url --url http://mirrors.kernel.org/fedora/releases/7/Fedora/i386/os
#ks=http://127.0.0.1/ks.cfg
#ks=http://localhost/ks.cfg
url --url http://ftp.usf.edu/pub/fedora/linux/releases/14/Fedora/i386/os
install
cdrom
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
timezone --utc America/New_York
rootpw  --iscrypted $6$s9i1bQbmW4oSWMJc$0oHfSz0b/d90EvHx7cy70RJGIHrP1awzAgL9A3x2tbkyh72P3kN41vssaI3/SJf4Y4qSo6zxc2gZ3srzc4ACX1
selinux --permissive
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
firewall --service=ssh
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work

#I am deleting the old partitions with this
clearpart --all --drives=sda

#I am creating partitions here
#I will create the lvm stuff farther down
part /boot --fstype=ext4 --size=500 --ondisk=sda --asprimary
part pv.5xwrsR-ldgG-FEmM-2Zu5-Jn3O-sx9T-unQUOe --grow --size=500 --ondisk=sda --asprimary

#Very important to have the two part lines before the lvm stuff
volgroup VG --pesize=32768 pv.5xwrsR-ldgG-FEmM-2Zu5-Jn3O-sx9T-unQUOe
logvol / --fstype=ext4 --name=lv_root --vgname=VG --size=40960
logvol /home --fstype=ext4 --name=lv_home --vgname=VG --size=25600
logvol swap --fstype swap --name=lv_swap --vgname=VG --size=4096

bootloader --location=mbr --driveorder=sda --append="rhgb quiet"

%packages
@admin-tools
#@editors
#@fonts
@gnome-desktop
#@games
#@graphical-internet
#@graphics
@hardware-support
@input-methods
#@java
#@office
#@online-docs
@printing
@sound-and-video
@text-internet
@base-x
xfsprogs
mtools
#gpgme
#openoffice.org-opensymbol-fonts
#gvfs-obexftp
hdparm
#gok
#iok
#vorbis-tools
jack-audio-connection-kit
#ncftp
gdm
%end

# Reboot after installation
reboot