Total Pageviews

Saturday, 27 October 2012

Anaconda的选项

最新的 Anaconda 可使用的选项在官方的 Wiki 中有详细介绍,不过其中包含了最新的“特性”,可能只有最新发行的 Fedora Project 发行的最新版的 RedHat Linux Fedora Core 才能使用。不过通常需要用到的“选项”已经早就实现了。
查看当前发行版的 Anaconda 的可用选项的方法是安装 anaconda 包,然后查看 /usr/share/doc/anaconda-$VERSION/command-line.txt 文件。多说一句,/usr/share/doc/anaconda-$VERSION 目录下的文档,几乎涵盖了 Anaconda 相关的所有主题,值得详细阅读。
下面以RHEL5为例,介绍几个非常有用(以解决“生产”问题为目的)的“选项”:
text Force text mode install. 强制以文本方式安装。不指定的话,Anaconda会试图从图型安装。
updates Prompt for floppy containing updates (bug fixes).
updates=ftp://<path>
Image containing updates over FTP.
updates=http://<path>
Image containing updates over HTTP.
ks Kickstart over NFS.
ks=cdrom: Kickstart from CDROM
ks=nfs(:options):<path>
Kickstart from NFS.  NFS mount options are optional.
ks=<url> Kickstart via HTTP.
ks=hd:<dev> Kickstart via harddrive (dev = ‘hda1′, for example)
ks=file:<path> Kickstart from a file (path = ‘fd0/ks.cfg’)
ks=ftp://<path> Kickstart from FTP.
ks=http://<path> Kickstart from HTTP.
kssendmac Adds HTTP headers to ks=http:// request that can be helpful for provisioning systems.  Includes MAC address of all nics in CGI environment variables of the form: “X-RHN-Provisioning-MAC-0: eth0 01:23:45:67:89:ab”. 这个对于要编程解决安装问题的开发人员,非常有用。最新的 Anaconda 还提供了一个 kssendsn 功能:Adds an HTTP header to ks=http:// requests that can be helpful for provisioning systems. Includes the system’s serial number (according to dmidecode) in an HTTP header of the form “X-System-Serial-Number: 1234567890″.
ksdevice Takes one of 4 types of argument which tells install what network device to use for kickstart from network:
- An argument like ‘eth0′ naming a specific interface
- An argument like 00:12:34:56:78:9a indicating the MAC address of a specific interface
- The keyword `link’ indicating that the first interface with link up
- The keyword `bootif’ indicating that the MAC address indicated by the BOOTIF command line option will be used to locate the boot interface. BOOTIF is automagically supplied by pxelinux when you include the option `IPAPPEND 2′ in your pxelinux.cfg file
ip=<ip> IP to use for a network installation, use ‘dhcp’ for DHCP. 可以在安装的时候就传递 IP 信息给 Anaconda,这样就需要DHCP去获取地址了。
noipv4 Disable IPv4 networking during installation.
noipv6
Disable IPv6 networking during installation. 假如使用了 ip=dhcp ,那么 noipv6 可以提高网络初始化速度。
netmask=<nm>
Netmask to use for a network installation.
gateway=<gw> Gateway to use for a network installation.
dns=<dns> Comma separated list of nameservers to use for a network installation.
dhcptimeout=<sec> Set different dhcp timeout to workaround STP delays with some Cisco switches. 假如你的交换机上开启了 STP,那么从网络 Link 加电亮灯,到网络就绪通常需要 30 秒(默认是30秒,跟据本地的网络管理策略可能会不同)的时间,假如 dhcptimeout 的时候小于30秒或者接近于30秒,那么将一直获取不到 IP地址,从而无法继续进行安装。
method=nfs:<path> Use <path> for an NFS installation.
method=http://<path> Use <path> for an HTTP installation
method=ftp://<path> Use <path> for an FTP installation
method=hd://<dev>/<path> Use <path> on <dev> for a hard drive installation
loglevel=<level> Set the minimum level required for messages to be logged.  Values for <level> are debug, info, warning, error, and critical.  The default value is info.
syslog=<host>[:<port>] Once installation is up and running, send log messages to the syslog process on <host>, and optionally, on port <port>.  Requires the remote syslog process to accept connections (the -r option).
loglevel 与 syslog 两个选项,可以将 Anaconda 运行过程中的信息发送到远端的 syslog 服务器。
当然假如你想使用非常规的方式观察安装的过程,可以使用 vnc,可以使用 串口
vnc Enable vnc-based installation. You will need to connect to the machine using a vnc client application.
vncpassword=<password> Enable a password for the vnc connection. This will prevent someone from inadvertantly connecting to the vnc-based installation. Requires ‘vnc’ option to be specified as well.
vncconnect=<host>[:<port>] Once installation is up and running, connect to the vnc client named <host>, and optionally use port <port>.
serial Turns on serial console support. 开启 Anaconda 的 “serial console” 支持。使用这个功能可以通过串口与 Anaconda 进行交互,并且“监视” Anaconda 的运行情况(这时需要传递给内核参数 console=ttySN,9600 这样的参数,详情可以查看内核文档 Documentation/serial-console.txt)。

小结:
1. 使用 ks 的几个选项,可以指定 Kickstart 文件的地址,使用 Kickstart 来 “自动应答” Anaconda,从而实现自动化安装系统。
2. 使用 ip=<ip> netmask=<nm> gateway=<gw> dns=<dns>,可以引导之前设定 “机器的网络参数”。
3. 使用 ksdevice=<NICIF> 可以指定使用哪个网卡连接网络。
4. syslog=<host>[:<port>] 可以将安装过程中的信息发送到指定的 syslog 服务器。
5. 使用method批定安装源。这个选项将要被 repo=<…>代替。
6. 阅读 Anaconda 的文档
7. 查看 anaconda 的选项:/usr/sbin/anaconda –help
……

Anaconda 的邮件列表
http://listman.redhat.com/mailman/listinfo/anaconda-devel-list