Linux+: Linux Install 09 – Scripted Installation There are cases when a large number of computer systems need to have an Operating System (OS) installed on them. It would be very tedious work to sit and install an OS on each system by having to answer the installation questions on each computer. This is where scripts come in handy to alleviate such a repetitive task. NOTE: Kickstart is used for Red Hat installations as well as other distros. Not all distros will run Kickstart. Once Kickstart is loaded, there are twelve sections to specify configuration options as shown in Figure 1. FIGURE 9-1 Basic Configuration Installation Method Boot Loader Options Partition Information Network Configuration Authentication User Configuration Firewall Configuration Display Configuration Package Selection Pre-installation Script Post-installation Script Basic Configuration In this section, the options are required to be set. The options specify the basic setup information such as: language, keyboard, mouse, time zone, language support and architecture type. The Mouse option allows for you to specify the mouse or select 'Probe for Mouse' where the Operating System (OS) will auto detect the attached mouse type. There are also options to select to force the system to reboot after the installation process is completed. The option can ensure that all system settings will take effect when the system restarts. The installation can also be performed completely in text-mode by selecting the appropriate check box. By default, the installation is performed within the Graphical User Interface (GUI) as a normal install. Any required options which are not included in the kickstart script will prompt the user to make a selection as needed. The last option on the screen is to allow Interactive Mode. As the GUI is used to allow a user to select install options the options will be selected by the script, but the user can till override the options. Instead of each screen being filled in by the script and moving to the next screen, the user must select to move to the next screen after approving the settings. Installation Method The Installation Method, as shown in Figure 9-2, specifies the installation source location as well as what the installation will perform. Figure 9-2 First, you can select a New Install or Upgrade an existing Installation. The Upgrade option is not always available depending on the distro. The other option is to specify the location of the source files. Boot Loader Options This section allows specifications to be made for the use of GRand Unified Bootloader (GRUB). GRUB allows for booting multiple Operating Systems on one Hard Disk Drive (HDD). NOTE: Depending on the OS on which Kickstart is being used, you may have the option for installing Linux Loader (LILO). Here, GRUB can be installed or skipped completely as shown in Figure 9-3. FIGURE 9-3 A password can be specified for GRUB which must be typed and retyped to verify that it is correct. You can also check the box to encrypt the password in the Kickstart script file so it is not simply saved as plain text. The boot loader can be placed on the Boot Record of the hard disk or placed in the first sector of the partition. The Kernel Parameters section allows for special parameters to be used when the system is booted. Partition Information This section allows for the setup of the hard disk space for the installation as shown in Figure 9-4. FIGURE 9-4 First, you can choose to delete the MBR. By deleting the MBR, you remove all traces of any Boot Loader from the hard disk. If you do not need one, or installing a different one, you will want to delete the MBR. The next option is the management of existing partitions. If you remove all partitions, then all data will be lost. Next, you can choose to label the partition you create. The label is automatic and based on the architecture of the system. For example, 'msdos' for x86 systems. Next, you specify a partition for creation and installation as shown in Figure 9-5. Figure 9-5 When adding a partition you first specify the mount point. Of course, multiple partitions can be made to manage the different mount points, but start with root and the swap partition. Next, a filesystem is specified as well as the partition size. The partition size can be a fixed amount. The size can be increased to a maximum amount if the space exists or all unused space can be used. If the filesystem is set to swap you have the option to use the recommended swap size. The disk used can be forced to be the primary drive if it is not currently the primary drive. A specific drive can also be used, such as sbc or sba. A specific partition can be used on the specified drive, such as sbc1 or sba2. Finally, there is the option to format the partition which is a good idea. There is also an option to set up a Redundant Array of Inexpensive Disks (RAID). It is managed the same as creating an individual partition. Implementations of RAID 0, 1 or 5 can be used. Network Configuration This section allows for the configuration of network devices for the system. The Network Configuration screen can be seen in Figure 9-6. FIGURE 9-6 Select 'Add a Network Device' and you will see Figure 9-7. FIGURE 9-7 You can select the network device, usually eth0, and then specify the Network Type: DHCP Static IP BOOTP The option for Dynamic Host Configuration Protocol (DHCP) allows a DHCP Server to auto-configure the TCP/IP settings for the system when it starts up. When you need to specify the TCP/IP Address, Netmask, Gateway and Name Server the option for Static IP should be selected. The BOOTP option is similar to DHCP when a network uses BOOTP and not DHCP. Authentication The Authentication option allows the specification of an encryption type for encrypting passwords as shown in Figure9-8. The various types are: NIS LDAP Kerberos 5 Hesiod SMB Name Switcher Cache FIGURE 9-8 User Configuration The User Configuration, as shown in Figure 9-9, is used to enable the root user and other users. If no root account is created other acounts must be created. FIGURE 9-9 NOTE: Be aware of the check box to encrypt password for root and users. Be sure Authentication is enabled. Firewall Configuration Security for the individual system is imperative in some environments. Here you can limit the device for incoming connections to specific devices by the service or port number. The screen is shown in Figure 9-10. FIGURE 9-10 NOTE: Be aware that if the option is not enabled, no incoming connection will be rejected. All connections will be allowed. Display Configuration On any system the display settings are important to be able to see what is occuring in the GUI. The Display Configuration is shown in Figure 9-11. FIGURE 9-11 On this screen you can specify the color depth, resolution and default desktop. You can also specify to load X Windows on startup, which is important for most users. The tabs for Video Card and Monitor can be left at 'Probe for the Video Card' and 'Probe for the Monitor'. These options allow for the system to detect the video card and monitor. If the script will be used on various types of systems, then this may be the best choice. Package Selection The Package Selection tab, Figure 9-12, allows for packages to be included in the install. FIGURE 9-12 NOTE: Kickstart does not allow for the inclusion of individual packages. You will need to edit the script file and include the packages in the %packages section. Pre-installation Script This tab allows for including external scripts as shown in Figure 9-13. You can specify the program to execute the script in the 'Use an interpreter' line. For example, select the Python application to execute a Python script. FIGURE 9-13 The script is then pasted or typed into the box. Post-installation Script Similar to the Pre-installation Script, this script is executed when the installation is completed. The tab is shown in Figure 9-14. FIGURE 9-14 NOTE: When running outside of chroot you must append '/mnt/sysimage' to the directory name. Finishing When done filling in the tabs, select File and Preview. You should see a preview of all the settings which will be placed into the script. You can then select 'Save to File'. The file is saved as 'ks.cfg' in the directory of your choice. Place the ks.cfg on the boot disk with the image. You may have to edit the ISO file and include the file and burn it. Boot from the disk as normal and you should have an unattended installation.