Rhel6kickstart Unattended Installation

Source: Internet
Author: User

Rhel6kickstart Unattended Installation

Method: ftp + tftp + DHCP + kickstart + PXE

The practice of booting a system from the network does not have to boot a computer from a hard disk, a floppy disk, or a CD-ROM disc, but entirely over the network. This is easy to install, because it means you can sit next to the table, without having to go to the machine and insert a CD-ROM disc or floppy disk, You can boot a machine somewhere else from the network.

PXE acts like a small operating system in the ROM on the NIC. It uses a standard API to provide its own network boot function to the BIOS of the system, so that Linux can be started through the network; PXE network boot process: a host broadcasts a DHCP "Discover" request with the PXE option set, then a DHCP server responds to it with a DHCP packet containing the PXE option (the IP address of the boot server and the name of the boot file ). The client downloads the boot file through TFTP and then executes the boot file.

The tool used by Red Hat to execute automatic installation is Kickstart. The system-config-kickstart tool generates the configuration file KS. cfg.

Experiment environment: Prepare two virtual machines, one as the test environment (rhel6 with IP address 192.168.10.1), and the other as the installation end of rhel6, and set network boot installation.

Install the required services and modify the corresponding configuration file:

1. Use Yum to install the required software package. First, build the yum disc Source:

[[Email protected] ~] # Mount/dev/CDROM/mnt

Create a file ending with. Repo in the/etc/yum. Repos. d directory:

[[Email protected] ~] # Vi/etc/yum. Repos. d/serverl. Repo

The configuration is as follows:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/37/76/wKioL1Os5faw84YmAAByJzFivSY552.jpg "style =" float: none; "Title =" 1.png" alt = "wkiol1os5faw84ymaabyjzfivsy552.jpg"/>

2. Install the FTP service and enable the Service, and set it to start automatically upon startup.

[[Email protected] ~] # Yum install vsftpd-y

[[Email protected] ~] #/Etc/init. d/vsftpd start

[[Email protected] ~] # Chkconfig vsftpd on

3. Install TFTP, modify the TFTP configuration file, and enable the service.

[[Email protected] ~] # Yum install TFTP-y

[[Email protected] ~] # Yum install TFTP-server-y

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/37/77/wKiom1Os5iWB7zmJAADTnV4fpZg161.jpg "style =" float: none; "Title =" 2.png" alt = "wkiom1os5iwb7zmjaadtnv4fpzg161.jpg"/>

Modify Lines 13 and 14 in the configuration file

Restart the xinetd service and check whether the service port is enabled.

[[Email protected] ~] #/Etc/init. d/xinetd restart

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/37/76/wKioL1Os5ffSEBkjAABZMHr0r6s637.jpg "style =" float: none; "Title =" 3.png" alt = "wkiol1os5ffsebkjaabzmhr0r6s637.jpg"/>

OK. The tftp service starts normally. The xinetd service is started at startup, so we do not need to set it here.

4.InstallDHCP, Modify the configuration file and enable the Service:

[[Email protected] ~] # Yum install DHCP-y

Lines 9 and 10 are required for network boot.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/37/77/wKiom1Os5iWA4lzkAADL-ETIwqI519.jpg "style =" float: none; "Title =" 4.png" alt = "wKiom1Os5iWA4lzkAADL-ETIwqI519.jpg"/>

Start DHCP and set it to start

[[Email protected] ~] #/Etc/init. d/DHCPD start

[[Email protected] ~] # Chkconfig DHCPD on

After the preparation is complete, we start to configureKickstart

[[Email protected] ~] # Mkdir/tftpboot

[[Email protected] ~] # Mkdir/tftpboot/pxelinux. cfg

[[Email protected] ~] # Cp/usr/share/syslinux/pxelinux.0/tftpboot/

----If noSyslinuxDirectory, the installation package is requiredYum install syslinux-y

[[Email protected] ~] # Cp/mnt/isolinux. cfg/tftpboot/pxelinux. cfg/Default

[[Email protected] ~] # Cp/mnt/images/pxeboot/initrd. img/tftpboot/

[[Email protected] ~] # Cp/mnt/images/pxeboot/vmlinuz/tftpboot/

[[Email protected] ~] # Chmod 644/tftpboot/pxelinux. cfg/Default

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/37/76/wKioL1Os5ffSGDDGAAIY6kI_aPY262.jpg "style =" float: none; "Title =" 5.png" alt = "wkiol1os5ffsgddgaaiy6ki_apy262.jpg"/>

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/37/77/wKiom1Os5iXBrlyKAADA5Wa90H8553.jpg "style =" float: none; "Title =" 6.png" alt = "wkiom1os5ixbrlykaada5wa90h8553.jpg"/>

Modify the configuration file/tftpboot/pxelinux. cfg/default.

In the file, you need to modify two lines. Modify the 1st lines. Linux indicates to search for the label Linux of the following 18 lines, and then modify the 22 Lines (that is, add Ks = FTP to the end: // 192.168.10.1/KS. CFG ). Row 22nd means that the installer accesses the Kickstart file through the FTP server.

Row 1st: Default Linux indicates the default entry name; row 2nd: prompt 1 indicates whether to wait for the user to select; 1 indicates waiting for user control; lines 18th, 23, 27, and 31 labellinux indicate the defined boot portal, indicating different installation methods of the system. For example, lines 18th indicate graphical installation.

The configuration file has been modified. To start automatic installation, the installer must be able to access the Kickstart file. There are multiple methods to access the Kickstart file. One of the most common methods is to use a network server, such as an FTP server, web server, or NFS server. This method is very easy to deploy, it also makes management changes very simple. You can also use a USB disk, a CD-ROM, or a local hard disk. If the Kickstart file in a USB or CD-ROM is very accessible, simply place the Kickstart file in the boot medium used to start installation. The use of DHCP server, TFTP and PXE configuration is more complex.

The installation program directs to the Kickstart file in the following format:

Ks = ftp: // server/DIR/file such as: Ks = ftp: // FTP Server IP/KS. cfg

Ks = http: // server/DIR/file such as: Ks = http: // HTTP Server IP/KS. cfg

Ks = NFS: SERVER:/DIR/file such as: Ks = NFS: NFS server IP:/var/FTP/pub/KS. cfg

Ks = HD: Device:/DIR/file such as: Ks = HD: sdb1:/kickstar-files/KS. cfg

Ks = CDROM:/DIR/file such as: Ks = CDROM:/kickstart-files/KS. cfg

The above modification to the default configuration file is to access the Kickstart file through the FTP server. Next we will create an unattended installation file for Kickstart.

(Installation package requiredYum install system-config-kickstart.noarch-y)

Next, open the terminal and enter system-config-Kickstart to display the page.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/37/76/wKioL1Os5hKhkwMzAAITgw98mOY219.jpg "style =" float: none; "Title =" 7.png" alt = "wkiol1os5hkhkwmzaaitgw98moy219.jpg"/>

Set the default language, time zone, and root password, and then check the following installation and reboot. Then select the installation method.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/37/76/wKioL1Os5hKSzX2jAAE_PvPTbzk359.jpg "style =" float: none; "Title =" 8.png" alt = "wkiol1os5hkszx2jaae_pvptbzk359.jpg"/>

We configure the FTP Server Installation Method. Select to execute the new installation. Then click bootstrap loader option 650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/37/77/wKiom1Os5kHSfZqoAAF180nwSbY857.jpg "style =" float: none; "Title =" 9.png" alt = "wkiom1os5khsfzqoaaf180nwsby857.jpg"/>

Refer to my selection above. Next

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/37/77/wKiom1Os5kGgDhg3AAHCQUBGx_Q076.jpg "style =" float: none; "Title =" 10.png" alt = "wkiom1os5kggdhg3aahcqubgx_q076.jpg"/>

In this step, select my reference. Here, we can set the partition size.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/37/76/wKioL1Os5hPBJwmEAAFz5Mdknsg107.jpg "style =" float: none; "Title =" 11.png" alt = "wkiol1os5hpb1_meaafz5mdknsg107.jpg"/>

Network, no network by default. Click Add network. The device name is eth0 and the network type is DHCP.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/37/76/wKioL1Os5hSTllURAAEy0Ann6G8154.jpg "style =" float: none; "Title =" 12.png" alt = "wkiol1os5hstlluraaey0ann6g8154.jpg"/>

Refer to my configuration

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/37/77/wKiom1Os5kOjITFsAAEraRRPxgw333.jpg "style =" float: none; "Title =" 13.png" alt = "wkiom1os5kojitfsaaerarrpxgw333.jpg"/>

Firewall and SELinux can be enabled or disabled as needed

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/37/76/wKioL1Os5hSDWsTHAADKVxtPVec341.jpg "style =" float: none; "Title =" 14.png" alt = "wkiol1os5hsdwsthaadkvxtpvec341.jpg"/>

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/37/77/wKiom1Os5kOxBJ46AAGs5blEkUA839.jpg "style =" float: none; "Title =" 15.png" alt = "wkiom1os5koxbj46aags5blekua839.jpg"/>

Check some packages here. Desktop may not be checked by default. Select as needed. The remaining two items do not need to be configured.

Installation script: In the "pre-installation script" and "post-installation script" dialog box, you can add executable statements that automatically run before and after installation. This setting makes automatic server configuration easier. For example, you can automatically set the yum repository after the client completes the installation, as shown in. Note: ensure that the written code can be correctly executed to avoid installation failure.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/37/76/wKioL1Os5hWCrtqGAAIOFwLTJLE520.jpg "style =" float: none; "Title =" 16.png" alt = "wkiol1os5hwcrtqgaaiofwltjle5w.jpg"/>

Click Save in the upper-left corner, select the saved path, and copy the KS. cfg file to the/var/FTP directory:

[[Email protected] ~] # Cp ks. cfg/var/ftp

Note: Ks. CFG is the Kickstart file used for unattended installation. You can manually edit this file. If you manually edit the Kickstart file, use ksvalidator to verify that the file uses the correct keyword, however, writing errors such as URL paths, data packets, and groups cannot be verified. Ksvalidator is part of the system-config-kickstart package. Therefore, you must install this package.

---Recorded/Tftpboot/pxelinux. cfg/DefaultFileKs = ftp: // 192.168.10.1/KS. cfgTherefore, the preceding step must be executed.

RemountRhel6Install the CD/Var/FTP/pubDirectory to start the unattended installation of another machine:

[[Email protected] ~] # Umount/dev/CDROM // originally mounted to/mnt

[[Email protected] ~] # Mount/dev/CDROM/var/FTP/pub

Note:

We recommend that you disable the firewall and SELinux. If not, the TFTP service may be faulty. Try it if you don't believe it.

Set firewall:

# Iptables-F

# Service iptables save

Disable SELinux: There are two methods to achieve this:

1) permanently disable SELinux: Modify the/etc/sysconfig/SELinux file and change SELinux = enforcing to disable. The SELinux takes effect only after the system is restarted.

2) temporarily disable SELinux: # setenforce 0 does not need to restart the system

To use the vmwarevm, stop the DHCP function provided by the vmwarevm software.

Next, start the machine you want to install (set to network boot installation, you can rest and wait for your installation to complete)

Appendix:

Please think about: How to Implement HTTP + tftp + DHCP + kickstart + PXE Unattended Installation

This article is from the "I learn how to use" blog, please be sure to keep this source http://593095349.blog.51cto.com/8497121/1431532

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.