Use Kickstart to install CentOS automatically

Source: Internet
Author: User

Use Kickstart to install CentOS automatically

Preface

Because we need to centrally deploy CentOS in inspur x86 servers to build a Hadoop-based big data platform, and usually access SLES (SuSE Linux Enterprise Server) there are many and automatic installation Based on the Autoyast method using the CD or PXE network has been realized (the specific implementation method will be shared later ). This time, we will learn how to use Kisckstart to automate the installation of CentOS in the simplest CD mode. Most online tutorials are not fully applicable to our own environments. This article will not repeat the concepts of Kickstart, for details, refer to extended reading.

Kickstart is one of the most common Linux automated installation methods.

Update history

April May 20, 2015-first draft

Http://wsgzao.github.io/post/kickstart/

Additional reading

  • CentOS http://wiki.centos.org/zh/TipsAndTricks/KickStart
  • Fedora-https://fedoraproject.org/wiki/Anaconda/Kickstart/zh-cn
Environment preparation custom system

CentOS-6.4-x86_64

Official http://wiki.centos.org/Download

Install software package

Tips for proxy surfing, export http_proxy = ip: port

yum -y install createrepo mkisofs
Create process directory structure

Copy the original CentOS image without any streamlining

mkdir /mnt/centosmount /dev/sr0 /mnt/centosmkdir /tmp/isocp -r /mnt/centos/* /tmp/iso
Add Kickstart configuration file

The file path and installation method can be freely defined.

Cd/tmp/iso/isolinux # modify the boot guide. Note that ks = part of vi isolinux. cfglabel linux menu label ^ Install or upgrade an existing system menu default kernel vmlinuz append initrd = initrd. img ks = cdrom:/isolinux/ks. cfg # manually add the Kickstart configuration file vi ks. cfg
# Kickstart file automatically generated by anaconda. # version = DEVEL # Install OS instead of upgrade # indicates installation, instead of upgrading install # Use text mode install # text installation # Use network installation # url -- url = ftp: // ip/centos # Local installation Use CDROM installation media # Use a CD to install cdrom # Installation Number configuration # if it is a RedHat system, the key is required. skip this step, if you do not configure the installation will stop there ask the user to enter key # key-skip # System language # language environment # lang en_US.UTF-8lang zh_CN.UTF-8 # System keyboard # keyboard type keyboard us # Network information # Network Configuration # network -- device eth0 -- bootproto dhcp -- onboot yes # Root password # root password rootpw chinaums # Firewall configuration # disable firewall Firewall -- disabled # SELinux configuration # disable selinuxselinux -- disabled # Run the Setup agent on first boot # disable firstboot -- disable # System authorization information # user authentication configuration during the first startup, useshadow indicates local authentication, -- passalgo indicates the password encryption algorithm authconfig -- enableshadow -- passalgo = sha512 # System timezone # set the time zone to Shanghai timezone -- isUtc Asia/Shanghai # System bootloader configuration # specifies the installation location of the bootloader, indicates the sort of the drive, indicating that after the operating system is installed, the parameter bootloader -- location = mbr -- driveorder = sda -- append = "crashkernel = auto rhgb quiet" # Clear the Master Boot Record # Clear the MBR Boot Record zerombr yes # Partition clearing information # Clear all data on the hard Disk clearpart -- all -- initlabel # Disk partitioning information # custom partition # create a m partition Mount/the boot type is ext4part/boot -- fstype = ext4 -- size = 200 -- ondisk = sda # create a 20000 m SWAP partition part swap -- size = -- ondisk = sda # create/directory part/-- fstype = ext4 -- grow -- size = 1 -- ondisk = sda # Reboot after installation # restart reboot -- eject # This packages is for CentOS 6.4 # Software Package customized for CentOS 6.4% packages @ base @ core @ chinese -support # Run the script after installation % post # config service # Custom service NetworkManager stopchkconfig NetworkManager off # eject cdrom # After installation is complete, pop up the CD # eject # reboot # restart after execution # reboot-f # end automatic deployment % end
Generate dependency and ISO files

Note the accuracy of paths and commands

cd /tmp/isocreaterepo -g repodata/*comps.xml . mkisofs -o /tmp/CentOS-6.4_64_auto.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table  -joliet-long  -R -J -v -T /tmp/iso/
Test and Suggestions

Two references are recommended. We recommend that you perform repeated tests and verification on the Virtual Machine before deploying it on the physical machine.

Linux Kickstart Automatic Installation-http://liaoph.com/linux-kickstart/
Centos6.4 custom automatic mounting disk-http://www.wpython.com/444.html

Related Article

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.