Kickstart automatic installation of Linux

Source: Internet
Author: User


This evening to share with you how to use Kickstart automatic installation of Linux, of course, there are other tools can be fully automated installation of Linux, each tool has its own advantages and disadvantages, choose a suitable for you just fine.


Required Packages: nfs* dhcp* tftp*


First, install the software

Install the top three packages first.

Yum Install nfs*-yyum install dhcp*-yyum install tftp*-y

Second, copy the contents of the CD

Create a directory in the root partition

Mkdir/redhatinstall

Mount the disc and copy the contents of the disc into this directory

Mount-o loop/dev/cdrom/mediacp-r/media/*/redhatinstall


Third, configure NFS

Edit shared configuration file for NFS

echo "/redhatinstall * (Rw,sync)" >>/etc/exports

Share the directory we just copied near the CD, * indicates that any IP can mount this directory.


Iv. Configuring the DHCP server

[[email protected] ~]# cat/etc/dhcpd.conf # # DHCP Server Configuration file.# See/usr/share/doc/dhcp*/dhcpd.conf.sampl e #[[email protected] ~]# cp/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample/etc/dhcpd.conf cp:overwrite '/etc/dhcpd.conf ‘? Y[[email protected] ~]#

With the command we can see that there is no content in the DHCP default configuration file, there is a hint that we can refer to the/usr/share/doc/dhcp*/dhcpd.conf.sample sample file.

So we copy this file over and cover it directly.

Next we open this file for configuration

      1 ddns-update-style interim;       2 ignore client-updates;      3        4 subnet 192.168.21.0 netmask 255.255.255.0 {       5       6         option  routers                   192.168.21.1;      7          option subnet-mask               255.255.255.0;      8          range dynamic-bootp 192.168.21.100 192.168.21.200;      9          default-lease-time 21600;     10       11         next-server 192.168.21.10;      12         filename  " pxelinux.0 ";      13 }

This is my profile, where subnet represents the network segment where IP is to be assigned, option routers represents the default gateway, range DYNAMIC-BOOTP represents, the scope of the assigned IP, next-server indicates to go to that IP server to read the file, filename indicates which file to read.


V. Configuring TFTP

Modify File/etc/xinetd.d/tftp

      1 # default: off      2  # description: the tftp server serves files using the trivial  file transfer       3 #        protocol.  The tftp protocol is often used to boot  diskless       4 #        workstations, download configuration files to network-aware printers,        5 #       and to start  the installation process for some operating systems.       6 service tftp      7 {       8         socket_type              = dgram      9          protocol                 = udp     10         wait                      = yes     11         user                      = root     12          server                   = /usr/sbin/in.tftpd     13         server_args              = -s /tftpboot      14         disable                  = yes      15         per_source               = 11     16          cps                      = 100 2     17          flags                     = ipv4     18 } 

Change the value of the disable of 14 rows to No.

Then enter the/tftpboot directory

[[email protected] ~]# cd/tftpboot/[[email protected] tftpboot]# Lslinux-install[[email protected] tftpboot]#

There is only one directory where we need to copy several files to this Tftpboot directory

[[email protected] tftpboot]# Cp/redhatinstall/images/pxeboot/{initrd.img,vmlinuz}. [Email protected] tftpboot]# lsinitrd.img linux-install vmlinuz[[email protected] tftpboot]#

Then copy a file, which is the pxelinux.0 file that we just configured in the dhcpd.conf configuration file.

[Email protected] tftpboot]# cp/usr/lib/syslinux/pxelinux.0. [Email protected] tftpboot]# lsinitrd.img linux-install pxelinux.0 vmlinuz[[email protected] tftpboot]#

Let's create a directory and copy a file to this directory:

[Email protected] pxelinux.cfg]# pwd/tftpboot/pxelinux.cfg[[email protected] pxelinux.cfg]# cp/redhatinstall/ Isolinux/isolinux.cfg Default[[email protected] pxelinux.cfg]# lsdefault[[email protected] pxelinux.cfg]# lltotal 4- R-xr-xr-x 1 root root 366 Mar 22:39 default[[email protected] pxelinux.cfg]# chmod 755 default [[email protected] Pxeli nux.cfg]# lltotal 4-rwxr-xr-x 1 root root 366 Mar 22:39 Default[[email protected] pxelinux.cfg]#

Remember to modify the permissions, otherwise we can not edit. Next edit this file default

      1 default linux      2 prompt  1      3 timeout 600      4  display boot.msg      5 f1 boot.msg       6 F2 options.msg      7 F3 general.msg       8 f4 param.msg      9 f5 rescue.msg      10 label linux     11     kernel linuz     12    append ks=nfs:192.168.21.10:/ redhatinstall/ks.cfg initrd=initrd.img     13       14      15  #label  linux     16 #   kernel vmlinuz     17 #  append initrd=initrd.img      18 label text     19   kernel vmlinuz      20   append initrd=initrd.img text     21  label ks     22   kernel vmlinuz      23   append ks initrd=initrd.img     24  label local     25   localboot 1      26 label memtest86     27   kernel memtest      28   append -     29

The 10–12 line is my own add-in. Ks=nfs:192.168.21.10:/redhatinstall/ks.cfg indicates that we read the path to the Ks.cfg file on the NFS server.


VI. copy ks.cfg file

After the Linux system is installed we can see a anaconda-ks.cfg file in the root home directory, we copy this file to the/redhatinstall directory and rename it to Ks.cfg.

[[email protected] ~]# CP anaconda-ks.cfg/redhatinstall/ks.cfg[[email protected] ~]# Cd/redhatinstall/[[email Protected] redhatinstall]# ll ks.cfg-rw-------1 root root 1107 Mar 22:44 Ks.cfg[[email protected] redhatinstall]#

Change the price of this question to 777. And then edit this file, here is my configuration information, want to see what each option means, you can go here to see http://www.linuxidc.com/Linux/2013-07/87299.htm

      # Kickstart file automatically generated by  anaconda.            install       text      key --skip       Lang en_us. utf-8      keyboard us      xconfig -- Startxonboot      network --device eth0 --bootproto dhcp       rootpw oracle      firewall -- diabled      authconfig --enableshadow --enablemd5       nfs --server=192.168.21.10 --dir=/redhatinstall      selinux --diabled     timezone --utc asia/shanghai      bootloAder --location=mbr --driveorder=sda --append= "Rhgb quiet"       clearpart --linux     part /boot --fstype ext3 --size=200      part swap --size=3000     part / -- fstype ext3 --size=100 --grow     %packages       @admin-tools      @base       @core        @dialup       @editors       @gnome-desktop       @graphical-internet      @graphics        @legacy-software-support      @printing      @ system-tools      @text-internet      @base-x      kexec-tools     fipscheck     device-mapper-multipath      sgpio     emacs     libsane-hpaio      festival     audit     xorg-x11-utils      xorg-x11-server-xnest     reboot

After this file is configured, we start up the services we need

[[Email protected] redhatinstall]# [[email protected] redhatinstall]# service  dhcpd restartStarting dhcpd:                                              [  ok   ][[email protected] redhatinstall]# service xinetd restartStopping  xinetd:                                             [  OK  ]Starting xinetd:                                              [  OK  ][[email protected] redhatinstall]# service nfs  restartshutting down nfs mountd:                                    [FAILED]Shutting down NFS daemon:                                    [failed]shutting down nfs  quotas:                                   [ Failed]shutting down nfs services:                                 [failed] starting nfs services:                                       [  OK  ]Starting NFS quotas:                                          [  OK  ]Starting NFS daemon:                                         [  OK  ]Starting NFS  mountd:                                         [  ok  ][[email protected] redhatinstall]#

All OK, remember to start the DHCP service, you must ensure that the IP of the machine is static.

This time, we create a new virtual machine, so that the virtual machine and the server we have just configured to use bridge mode, we do not mount the CD-ROM, direct boot. It starts to install automatically.





This article is from the "focus on Java,linux Technology" blog, please be sure to keep this source http://wuqinglong.blog.51cto.com/9087037/1626259

Kickstart automatic installation of Linux

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.