Unattended automatic installation CentOS6.4

Source: Internet
Author: User
Tags manual writing administrator password

In the large-scale Linux application environment, such as Web cluster, distributed computing, etc., the server often does not have the optical drive device, in this case, dozens of or hundreds of server bare Metal rapid installation system, traditional U disk, mobile optical drive and other installation methods are obviously difficult and Below we will deploy the PXE-based network installed and implement the unattended automatic installation system in conjunction with the Kickstart configuration.

PXE technology

PXE is a client/server-based network boot technology developed by Inter, whose core function is to have the client download the boot image from the remote server over the network for network boot. Throughout the process, the client requires the server to assign an IP address, and then uses the TFTP protocol to download the boot-boot image on the server to the native memory and perform the system installation, but such technology means only the boot from the network, when the read into the installation interface, the remaining steps such as language settings, system Administrator password, Network parameters, etc. also need to be manually configured. Since then, we can only implement non-optical network boot, such as to achieve unattended automatic installation, but also need kickstart technology.

Kickstart Technology

KICKSATRT is currently the main type of unattended automatic deployment installation of operating systems, the core of this technology is the automatic answer file, the installation process will need to set the language, password, network parameters, etc. by reading automatic answer files automatically set.

The auto answer file (Kickstart file) can be generated in three ways as follows:

1. Manual Writing

2, through the System-config-kickstart graphical tools (this article uses this)

3. Anaconda automatically generated through Red Hat's setup program

Deployment topology diagram

Specific implementation steps

I. Installing and deploying a DHCP server

Yum install-y dhcp# vim/etc/dhcp/dhcpd.conflog-facility local7;subnet 192.168.3.0 netmask 255.255.255.0{    Range 192.168.3.200 192.168.3.250;    Option Domain-name-servers 8.8.8.8;    option routers 192.168.3.1;    Default-lease-time;    Max-lease-time 7200;    Next-server 192.168.3.253;    FileName "pxelinux.0";} Service DHCPD startchkconfig dhcpd on Configuration Description: Assign a dynamic IP address to the 192.168.3.0/24 network Dynamic address pool from 192.168.3.200 to 192.168.3.250; The client obtains a DNS of 8.8.8.8; The client obtains a gateway with a 192.168.3.1;tftp address of 192.168.3.253; the startup file is pxelinux0;

Ii. Install and deploy TFTP server

Yum install-y tftp-server# vim/etc/xinetd.d/tftpservice tftp{        socket_type             = dgram        protocol                = UDP        wait                    = yes        user                    = root        Server                  =/usr/sbin/in.tftpd        Server_args             =-s/var/lib/ tftpboot# Shared path        Disable                 = no        per_source              = one        cps                     = 2        flags                   = IPv4}

C. Copy the configuration files required by the client to the TFTP server

Yum Install-y syslinuxcp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/ Insert the centos6.4 CD into the optical drive, copy the boot image file from the CD and launch the configuration file to the TFTP shared directory Umount/dev/cdrommount/dev/cdrom/mediacp/media/isolinux/{vmlinuz, INITRD.IMG}/var/lib/tftpboot/mkdir/var/lib/tftpboot/pxelinux.cfgcp/media/isolinux/isolinux.cfg/var/lib/ Tftpboot/pxelinux.cfg/defaultchmod 644/var/lib/tftpboot/pxelinux.cfg/default Modify the boot configuration as follows # vim/var/lib/tftpboot/ Pxelinux.cfg/defaultdefault linuxtimeout 600display boot.msgmenu title Welcome to CentOS 6.4!label Linux menu label ^inst All or upgrade an existing system menu default kernel vmlinuz append initrd=initrd.img ks=nfs:192.168.3.254:/ks/ks.cfgl Abel Rescue Menu label ^rescue installed system kernel vmlinuz append initrd=initrd.img Rescue Configuration Note Default Specifies the way to boot; labe The start name is Linux normal boot, the other is the name of rescue rescue mode boot; default determines which boot setup is used kernel Specifies that the system kernel file reads the kickstart file by accessing the NFS share of the 192.168.3.254, restarting the TFTP service and setting it to boot, shutting down the Firewall service xinetd Restarchkconfig xinetd Onservice iptables Stop

Iv. Create Kickstart Auto answer file

Install the graphics software on the 192.168.3.254 host System-cofnig-kickstartyum install-y system-config-kickstartmkdir/ks/ System-config-kickstart

① configuration language is English, keyboard is American keyboard, time zone is Shanghai, root administrator password is defined by itself

The ② configuration is installed as a fresh installation, the installation files are read through NFS, and the NFS server is 192.168.3.254, shared directory/media

③ Install grub boot, do not set the boot password, install the system boot program in the MBR area

Correctly plan the partitioning scheme

For example, divide a 200MB/boot partition

Swap partition for 2GB

The remaining space is divided to the root partition

Note: Kickstart files generated by graphics cannot be partitioned using LVM logical volumes, and only the generated kickstart files can be modified using

④ Click the Add Network Device button to add eth0 and set to get network parameters via DHCP

⑤ authentication settings, all user passwords are encrypted using the SHA512 algorithm

⑥ Setting SELinux and Firewalls

⑦ display configuration, here we do not check the installation of the graphical interface

⑧ Selecting the installation package

⑨ here can write scripts that need to be run before the system is installed, and if there is no special need, the script can be empty

⑩ can be written to the deployment scripts that need to be run after the system is installed, common scripts to create Yum sources, initialize user account passwords, deploy software services, and so on without special requirements, the script can be empty

After all the configuration options are set, save the generated kickstart file to the/ks directory with save from the File menu and name it ks.cfg

# Ll/ks/ks.cfg-rw-r--r--. 1 root root 1067 Jul 06:41/ks/ks.cfg

V. Deployment of Server for NFS

Service iptables stop# rpm-qa|grep rpcbind# rpm-qa|grep nfs-utilsyum install-y rpcbind nfs-utils/etc/init.d/rpcbind STA rt# vi/etc/exports/ks       192.168.3.0/255.255.255.0 (RO)/media    192.168.3.0/255.255.255.0 (RO)/etc/init.d/nfs Start

VI. Share the system CD or ISO file via NFS

Mode one: Disc umount/dev/cdrom mount/dev/cdrom/media Mode II: ISO image file Mount-o loop-t iso9660 image file/media

Seven, start the client, install the deployment system

In the BIOS of all client hosts, the first boot mode is set to PXE network boot, and after Setup is complete, all client computers can complete a large-scale centralized installation of the operating system

Unattended automatic installation CentOS6.4

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.