Linux Basic Learning 21st Day Automated installation of Linux systems (Kickstart)

Source: Internet
Author: User
Tags time zones

Content:

Automated installation of Linux systems with kickstart

Make CD, u disk boot disk

first, the System Automation installation :

1, Anaconda

From the previous study we know that the system starts the process:

Bootloader-->kernel (INITRAMFS)-->rootfs-->/sbin/init

Therefore, the bootloader can be fully bootable by the CD, and during the boot process, the process is automatically installed with the help of Kickstart.

Anaconda is the installation management program for Linux such as Redhat, CentOS, and Fedora. It can provide text, graphics and other installation management methods, and support kickstart and other scripts to provide automatic installation of features.

In addition, it supports many start-up parameters, and familiarity with these parameters can bring a lot of convenience to the installation. The function of this program is to install the packets located on the CD or other source to the host based on the settings.

To achieve this custom installation, it provides a custom interface that enables an interactive interface for user-selectable configurations (such as selecting languages, keyboards, time zones, etc.). Most of the modules in Anaconda are written in Python, with a few loading modules written in C.


2. The format of the kickstart file can be divided into three parts:

Command segment: Indicates various pre-installation configuration, such as keyboard type;

Package Segment: Indicates the package group or package to be installed, packages not installed, etc.;

%packages

@group_name

Package

-package

%end

Script segment:

%pre: Pre-installation script

Operating environment: Micro-Linux environment running on installation media

%post: Post-installation script

Operating Environment: Installation of the completed system;

Anaconda Supported Management modes:

(1) Automatic installation provided by Kickstart;

(2) Implement upgrade for a redhat;

(3) Rescuse mode to troubleshoot systems that cannot be started.

To enter the installation steps, a boot program is required to boot a special Linux installation environment system; There are several ways to boot:

(1) Network-based small boot image, need to provide a small boot image;

(2) USB drive boot, boot the installation process through a small boot image in the bootable storage media;

(3) PXE-based network installation mode, to provide a complete PXE installation environment;

(4) Other Bootloder boot (such as grub).

Available installation methods: Local CDROM, hard drive, network mode (NFS, FTP, HTTP).

3. Kickstart file creation

How to create a Kickstart file:

(1) Direct manual editing;

Modify according to a template:

After the system installation is complete, a anaconda-ks.cfg configuration is generated in the/root/directory, and the options and parameters for installing the system are documented:

[20:29 [email protected]~]# cat anaconda-ks.cfg # kickstart file  Automatically generated by anaconda. #version =develinstallcdromlang en_us. utf-8keyboard usnetwork --onboot no --device eth0 --bootproto dhcp -- noipv6rootpw  --iscrypted $6$dc0koom3dedyui88$dudzzmhqdsg.j.pqkxe1xsxc4plkq/demo1pj/pbbjeh/ gvdzq1hzfp4lxbveo5bwhhmeiauweolqvchmxu0j.firewall --service=sshauthconfig --enableshadow -- Passalgo=sha512selinux --enforcingtimezone --utc asia/shanghaibootloader --location=mbr  --driveorder=sda --append= "Crashkernel=auto rhgb quiet" # the following is  the partition information you requested# Note that any  Partitions you deleted are not expressed# here so unless you  clear all partitions first, this&Nbsp;is# not guaranteed to work#clearpart --none#part /boot --fstype=ext4  --size=200#part / --fstype=ext4 --size=50000#part /testdir --fstype=ext4 - -size=20000#part swap --size=4000repo --name= "CentOS"   --baseurl=cdrom:sr0 -- cost=100% Packages@base@core@debugging@basic-desktop@desktop-debugging@desktop-platform@directory-client@fonts@general-desktop@grap Hical-admin-tools@input-methods@internet-applications@internet-browser@java-platform@kde-desktop@legacy-x@network-file-sy Stem-client@office-suite@print-client@remote-desktop-clients@server-platform@server-policy@workstation-policy@x11mtoolspa Xpython-dmidecodeoddjobwodimsgpiogenisoimagedevice-mapper-persistent-dataabrt-guiqt-mysqlsamba-winbindcertmongerpam _krb5krb5-workstationxtermxorg-x11-xdmlibxmurdesktop

(2) can use the graphical creation tool: System-config-kickstart (the tool system does not have its own, need to install the System-config package)

It is recommended to use a graphical tool to create:

In the graphical terminal input command: System-config-kickstart to run the Kickstart Script Creation wizard

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/87/3E/wKiom1fYtXaw10trAAE7uyaIjgI273.png "style=" float: none; "title=" 1.png "alt=" Wkiom1fytxaw10traae7uyaijgi273.png "/>

Enter the location of the Linux image file to be installed and support multiple ways

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/87/3E/wKiom1fYtXfh4PTiAAC6GbRdOTU452.png "style=" float: none; "title=" 2.png "alt=" Wkiom1fytxfh4ptiaac6gbrdotu452.png "/>

Grub Options

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/87/3B/wKioL1fYtXewVV7YAADvpumA_go946.png "style=" float: none; "title=" 3.png "alt=" Wkiol1fytxewvv7yaadvpuma_go946.png "/>

Plan your zoning ahead of time

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/87/3E/wKiom1fYtXizLUEIAAEKXwB3c1E540.png "style=" float: none; "title=" 4.png "alt=" Wkiom1fytxizlueiaaekxwb3c1e540.png "/>

Configure Network Information

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/87/3B/wKioL1fYtXiBOIzTAADXcNI8qnM712.png "style=" float: none; "title=" 5.png "alt=" Wkiol1fytxiboiztaadxcni8qnm712.png "/>

Configure additional Options

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/87/3B/wKioL1fYtXnBZ_peAAC4w05T0TI192.png "style=" float: none; "title=" 6.png "alt=" Wkiol1fytxnbz_peaac4w05t0ti192.png "/>

Select the packages you want to install

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/87/3E/wKiom1fYtXnwUsAZAAET8br3Odw288.png "style=" float: none; "title=" 7.png "alt=" Wkiom1fytxnwusazaaet8br3odw288.png "/>

Scripts before and after system installation can be written

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/87/3E/wKiom1fYtXqyBiFxAAC4GZykGYY149.png "style=" float: none; "title=" 8.png "alt=" Wkiom1fytxqybifxaac4gzykgyy149.png "/>

Important step: When the disc starts, press ESC to enter boot mode and enter the Kickstart profile path

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/87/3B/wKioL1fYtXqDluZGAAALPRk6Fgs763.png "style=" float: none; "title=" 9.png "alt=" Wkiol1fytxqdluzgaaalprk6fgs763.png "/>

Auto-Install after carriage return

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/87/3E/wKiom1fYtXqjTQJ9AAAZiHhp9GE721.png "style=" float: none; "title=" 10.png "alt=" Wkiom1fytxqjtqj9aaazihhp9ge721.png "/>


The kickstart script generated automatically after writing is as follows:

[21:09 [email protected]~]# cat mylinux-ks.cfg  #platform =x86, amd64, or  intel em64t#version=devel# firewall configurationfirewall --disabled# install  os instead of upgradeinstall# use network installationurl --url= "http ://10.1.0.1/cobbler/ks_mirror/centos-6-x86_64/"# root passwordrootpw --iscrypted $1$ly. d8e4v$unqw3sajszyg9hxr.yjao/# system authorization informationauth  --useshadow   --passalgo=sha512# use text mode installtext# system keyboardkeyboard  us# system languagelang en_us# selinux configurationselinux --enforcing#  do not configure the x window systemskipx# installation logging  levellogging --level=info# Reboot after installationreboot# System  timezonetimezone --isutc  asia/shanghai# network informationnetwork  --bootproto=dhcp --device=eth0 -- Onboot=on# system bootloader configurationbootloader --location=mbr# clear the  master boot recordzerombr# partition clearing informationclearpart --all   # disk partitioning informationpart / --fstype= "Ext4"  --size= 20000part /boot --fstype= "Ext4"  --size=200part swap --fstype= "swap"  --size=4000% postecho  "Welcome to use mylinux"  >> /etc/issueecho -e  "[base]\ Nbaseurl=/msic/cd\ngpgcheck=0 " > /etc/yum.repo.d/base.repo%end% packages@base@basic-desktop@desktop-debugging@desktop-platform@fonts@general-desktop@graphical-admin-tools@input-methods@ Kde-desktop@legacy-x@remote-desktop-clients@x11%end



4, Kickstart file use (Automatic installation system):

Mount the disc into rescue mode, in the Select menu, press ESC, enter command mode, enter the location of the Kickstart file: Linux ks=

eg.

DVD Drive:ks=cdrom:/path/to/kickstart_file

Hard Drive:ks=hd:device:/directory/kickstart_file

HTTP Server:ks=http://host:port/path/to/kickstart_file

FTP Server:ks=ftp://host:port/path/to/kickstart_file

HTTPS Server:ks=https://host:port/path/to/kickstart_file

NFS Server:ks=nfs:host:/path/to/kickstart_file

Second, make CD and U disk Startup disk

To create a bootable disc:

#cp/media/cdrom/isolinux//tmp/myiso/

#vi/tmp/myiso/isolinux/isolinux.cfg

Initrd=initrd.imgtext ks=cdrom:/myks.cfg

#cp/root/myks.cfg/tmp/myiso/

#cd/tmp

# mkisofs-r-j-t-v--no-emul-boot--boot-load-size 4--boot-info-table-v "CentOS 6.6 x86_64 Boot"-B isolinux/isolinux . bin-c Isolinux/boot.cat-o/root/boot.isomyiso/

Create a USB drive boot disk

#ddif =/dev/sr0 Of=/dev/sdb


This article from the "6638225" blog, reproduced please contact the author!

Linux Basic Learning 21st Day Automated installation of Linux systems (Kickstart)

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.