pxe

All posts tagged pxe

Tuning the %packages section

When using %packages to define the set of packages that should be installed there are a number of more or less documented options that can be set:

–resolvedeps
Dependencies between packages will be automatically resolved. This option has been deprecated in Centos 5, dependencies are resolved automatically every time now.
–excludedocs

Skips the installation of files that are marked as documentation (all files that are listed when you do rpm -qld )
–nobase
Skips installation of @Base. This won’t work unless you know what you’re doing as it might leave out packages required by post installation scripts
–ignoremissing
Ignore missing packages and groups instead of asking what to do. This option has been deprecated in Centos 5, dependencies are resolved automatically every time now.

Example of minimal package selection for CentOS 4:

%packages –resolvedeps –excludedocs –nobase
kudzu

please note that essential stuff will be missing. There will be no rpm, no yum, no vim, no dhcp-client and no keyboard layouts. Kudzu is required, because the installer fails if it is missing.

Example of minimal package selection for CentOS 5:

%packages –excludedocs –nobase
@Core

Again, this will leave you with a *very* basic system that will be missing almost every feature you might expect.

The –resolvedeps used with CentOS 4 is not required for CentOS 5 as the newer installer always resolves dependencies.

Partitioning

If you start out with a unpartitioned disk, or a virtual machine on a unpartitioned image, use the –initlabel parameter to clearpart to make sure that the disklabel is initialized, or Anaconda will ask you to confirm creation of a disklabel interactively. For instance, to clean all partitions on xvda, and initialize the disklabel if it does not exist yet, you could use:

clearpart –all –initlabel –drives=xvda

Running anaconda in real text-mode

You probably already know that you can make anaconda run with a ncurses interface instead of the X11 interface by adding the line “text” to your kickstart file. But there’s another option: install in real shell-like textmode. Replace the “text”-line with a “cmdline”-line in your kickstart file and anaconda will do the whole installation in textmode. Especially when you use %packages –nobase or run complex %post scripts this will probably save hours of debugging, because you can actually see the output of all scripts that run during the installation.

Enable/disable firstboot

You all know firstboot, the druid that helps you to set up the system after install. It can be enabled and disabled by adding either “firstboot –enable” or “firstboot –disable” to the command section of your kickstart file.

What the different terminals display

Alt-F1
The installation dialog when using text or cmdline
Alt-F2
A shell prompt
Alt-F3
The install log displaying messages from install program
Alt-F4
The system log displaying messages from kernel, etc.
Alt-F5
All other messages
Alt-F7
The installation dialog when using the graphical installer

Logging %pre and %post

When using a %pre or %post script you can simply log the output to a file by using –log=/path/to/file

%post –log=/root/my-post-log
echo ‘Hello, World!’

Another way of logging and displaying the results on the screen would be the following:

%post
exec < /dev/tty3 > /dev/tty3
chvt 3
echo
echo “################################”
echo “# Running Post Configuration #”
echo “################################”
(
echo ‘Hello, World!’
) 2>&1 | /usr/bin/tee /var/log/post_install.log
chvt 1

Trusted interfaces for firewall configuration

You can use the –trust option to the firewall option multiple times to trust multiple interfaces:

# Enable firewall, open port for ssh and make eth1 and eth2 trusted
firewall –enable –ssh –trust=eth1 –trust=eth2

Use a specific network interface for kickstart

When your system has more than one network interface anaconda asks you which one you’d like to use for the kickstart process. This decision can be made at boot time by adding the ksdevice paramter and setting it accordingly. To run kickstart via eth0 simply add ksdevice=eth0 to the kernel command line.

A second method is using ksdevice=link. In this case anaconda will use the first interface it finds that has a active link.

A third method works if you are doing PXE based installations. Then you add IPAPPEND 2 to the PXE configuration file and use ksdevice=bootif. In this case anaconda will use the interface that did the PXE boot (this does not necessarily needs to be the first one with a active link).

Within the kickstart config itself you need to define the network interfaces using the network statement. If you are using method 2 or 3 then you don’t know which device actually will be used. If you don’t specify a device for the network statement anaconda will configure the device used for the kickstart process and set it up according to your network statement.

Forcing kickstart to ask for network configuration

Starting at CentOS 5, there a undocumented option that enable a prompt asking for network configuration during the installation. At the network statement, put the query keyword at the –bootproto= networking configuration, as we see below:

network –device=eth0 –bootproto=query

And a dialog box will appear asking for IP addressing, as well the hostname configuration.

askmethod
Do not automatically use the CD-ROM as the install source if we detect a Red Hat Enterprise Linux CD in your CD-ROM drive.

autostep
Make kickstart non-interactive.

debug
Start up pdb immediately.

dd
Use a driver disk.

dhcpclass=
Sends a custom DHCP vendor class identifier. ISC’s dhcpcd can inspect this value using “option vendor-class-identifier”.

dns=
Comma separated list of nameservers to use for a network installation.

driverdisk
Same as ‘dd’.

expert
Turns on special features:

allows partitioning of removable media

prompts for a driver disk

gateway=
Gateway to use for a network installation.

graphical
Force graphical install. Required to have ftp/http use GUI.

isa
Prompt user for ISA devices configuration.

ip=
IP to use for a network installation, use ‘dhcp’ for DHCP.

keymap=
Keyboard layout to use. Valid values are those which can be used for the ‘keyboard’ kickstart command.

ks=nfs::/ The installation program looks for the kickstart file on the NFS server , as file . The installation program uses 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:/// The installation program looks for the kickstart file on the HTTP server , as file . The installation program uses 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:/ The installation program looks for the kickstart file on the diskette in /dev/fd0, as file .

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

ks=file:/
The installation program tries to read the file from the file system; no mounts are done. This is normally used if the kickstart file is already on the initrd image.

ks=cdrom:/ The installation program looks for the kickstart file on CD-ROM, as file .

ks
If ks is used alone, the installation program configures 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 boot file begins with a /, the boot file provided by DHCP is looked for on the NFS server.

If DHCP is specified and the boot file begins with something other than a /, the boot file provided by DHCP is looked for in the /kickstart directory on the NFS server.

If DHCP did not specify a boot file, 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=
The installation program uses 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::/ ksdevice=eth1 at the boot: prompt.

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”.

lang=
Language to use for the installation. This should be a language which is valid to be used with the ‘lang’ kickstart command.

loglevel=
Set the minimum level required for messages to be logged. Values for are debug, info, warning, error, and critical. The default value is info.

lowres
Force GUI installer to run at 640×480.

mediacheck
Activates loader code to give user option of testing integrity of install source (if an ISO-based method).

method=cdrom
Do a CDROM based installation.

method=ftp:// Use for an FTP installation.

method=hd:/// Use on for a hard drive installation.

method=http:// Use for an HTTP installation.

method=nfs: Use for an NFS installation.

netmask=
Netmask to use for a network installation.

nofallback
If GUI fails exit.

nofb
Do not load the VGA16 framebuffer required for doing text-mode installation in some languages.

nofirewire
Do not load support for firewire devices.

noipv6
Disable IPv6 networking during installation.

nokill
A debugging option that prevents anaconda from terminating all running programs when a fatal error occurs.

nomount
Don’t automatically mount any installed Linux partitions in rescue mode.

nonet
Do not auto-probe network devices.

noparport
Do not attempt to load support for parallel ports.

nopass
Don’t pass keyboard/mouse info to stage 2 installer, good for testing keyboard and mouse config screens in stage2 installer during network installs.

nopcmcia
Ignore PCMCIA controller in system.

noprobe
Do not attempt to detect hw, prompts user instead.

noshell
Do not put a shell on tty2 during install.

nostorage
Do not auto-probe storage devices (SCSI, IDE, RAID).

nousb
Do not load USB support (helps if install hangs early sometimes).

nousbstorage
Do not load usbstorage module in loader. May help with device ordering on SCSI systems.

rescue
Run rescue environment.

resolution=
Run installer in mode specified, ‘1024×768’ for example.

serial
Turns on serial console support.

skipddc
Skips DDC probe of monitor, may help if it’s hanging system.

syslog=[:]
Once installation is up and running, send log messages to the syslog process on , and optionally, on port . Requires the remote syslog process to accept connections (the -r option).

text
Force text mode install.

updates
Prompt for floppy containing updates (bug fixes).

updates=ftp:// Image containing updates over FTP.

updates=http:// Image containing updates over HTTP.

upgradeany
Don’t require an /etc/redhat-release that matches the expected syntax to upgrade.

vnc
Enable vnc-based installation. You will need to connect to the machine using a vnc client application.

vncconnect=[:]
Once installation is up and running, connect to the vnc client named , and optionally use port .

Requires ‘vnc’ option to be specified as well.

vncpassword= Enable a password for the vnc connection. This will prevent someone from inadvertently connecting to the vnc-based installation.

Requires ‘vnc’ option to be specified as well.

To begin a kickstart installation, you must boot the system from boot media you have made or the Red Hat Enterprise Linux CD-ROM #1, and enter a special boot command at the boot prompt. The installation program looks for a kickstart file if the ks command line argument is passed to the kernel.

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 Red Hat Enterprise Linux CD-ROM #1.

An alternate boot command is to boot off the 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:

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:

Boot CD-ROM
If the kickstart file is on a boot CD-ROM as described in Section 1.8.1 Creating Kickstart Boot Media, 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):

Other options to start a kickstart installation are as follows:

ks=nfs:<server>:/<path>
The installation program looks for the kickstart file on the NFS server <server>, as file <path>. The installation program uses 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 looks for the kickstart file on the HTTP server <server>, as file <path>. The installation program uses 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 looks for the kickstart file on the diskette in /dev/fd0, as file <path>.

ks=hd:<device>:/<file>
The installation program mounts 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=file:/<file>
The installation program tries to read the file <file> from the file system; no mounts are done. This is normally used if the kickstart file is already on the initrd image.

ks=cdrom:/<path>
The installation program looks for the kickstart file on CD-ROM, as file <path>.

ks
If ks is used alone, the installation program configures 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 boot file begins with a /, the boot file provided by DHCP is looked for on the NFS server.
  • If DHCP is specified and the boot file begins with something other then a/, the boot file provided by DHCP is looked for in the /kickstart directory on the NFS server.
  • If DHCP did not specify a boot file, 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 uses 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.

The following table describes some of the Anaconda command line options:

lowres Force GUI installer to run at 640×480.
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>. Requires ‘vnc’ option to be specified as well.
ks=cdrom: Kickstart from CDROM
ks=nfs:<path> Kickstart from NFS.
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.
lang=<lang> Language to use for the installation. This should be a language which is valid to be used with the ‘lang’ kickstart command.
keymap=<keymap> Keyboard layout to use. Valid values are those which can be used for the ‘keyboard’ kickstart command.
ip=<ip> IP to use for a network installation, use ‘dhcp’ for DHCP.
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.
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 for a hard drive installation
method=cdrom Do a CDROM based installation.