Automating Linux Installation

Source: Internet
Author: User

The installation of Linux for personal use is not very difficult, but once in the production environment, the kind of random system, will give the server administrator a great deal of trouble, there needs to be a certain customization of the production system, customization depends on the company's computer type, The company's computers are often a type of a model. Customization is convenient here, the partition is set up, so that you can deploy a large number of machines in bulk.

aLinuxInstallation Principle

recall the steps to manually install a system:1 Choose a language,2 Choose a keyboard layout,3 allocate a partition,4 Choose an installation Type,5 Select an additional package,6 Select the time zone and 7 to set the root password. The subjective feeling of installation time is to configure one step of the system to perform a step, in fact, and so on all configurations are configured, the installation process only started, only the allocation partition is executed in real time.

The process that is installed is called Anaconda, and after you install the system using anaconda, a file anaconda-ks.cfg file is generated in the root directory . This file is all the configuration information when the current system is installed, and the lines of the partition are commented out. Hereinafter referred to as the KS file, we can directly remove the partition of the lines of the comments, directly using this configuration to install a system identical to the current system.

twoKsfile1 KSfile Format

The configuration file is divided into three segments:

The first paragraph is the main definition is partition,grub Password, user and password, etc., the format is as follows (here the configuration is only suitable for my network environment):

Install

url--url=http://172.16.0.1/cobbler/ks_mirror/6/

Lang en_US. UTF-8

Keyboard US

Network--onbootyes--device eth0--bootproto DHCP--noipv6

# Reboot Afterinstallation

Reboot

Firewall--disabled

Authconfig--useshadow--passalgo=sha512

Selinux--disabled

Timezoneasia/shanghai#part/boot--FSTYPE=EXT4--size=200

#part pv.008002--size=61440

#volgroup vg0--pesize=8192 pv.008002

#logvol/--FSTYPE=EXT4--name=root--vgname=vg0--size=20480

#logvol Swap--name=swap--vgname=vg0--size=2048

#logvol/USR--FSTYPE=EXT4--name=usr--vgname=vg0--size=10240

#logvol/VAR--FSTYPE=EXT4--name=var--vgname=vg0--size=20480

Repo--name= "CentOS"--baseurl=http://172.16.0.1/cobbler/ks_mirror/6/--cost=100

the lines that start with # are my partitions.

The second paragraph defines the package groups that are installed and the packages that are installed

%packages

@ represents a package group

Representative Package

%end

The third paragraph defines the scripts that are executed before and after the system is installed, in the following format

%pre

This section defines the pre-installation script

%end

%post

This section defines the post-installation script

%end

2configuration file Generation

The format of the configuration file is simpler and better understood, but it is still difficult tocustomize a KS file by hand, and Linux has a tool for customizing KS files based on a graphical interface .

install The KS file generation tool Kisckstart

Yum Install System-config-kickstart-y

Run Kisckstart

System-config-kickstart

This interface we follow the Linux interface basically similar, only two parts different, one is display configuration, here choose whether to install the graphical interface, do not install the graphical interface is the smallest installation The other is thepackage selection, which is the option to install the packages.

Centos7 Use this is a bit of a problem, you can refer to my other blog:http://oldking.blog.51cto.com/10402759/1876181

threeKsUse of files1Manual InputKsFile Location

install Linux , at the beginning of the choice to install or upgrade the system that one interface press exc, enter the command line mode, enter the location of the Linux ks=ks file

this ks file can be on an HTTP server,FTP server, or local file system. In the format of the local file system (this format only applies to me, you need to use the appropriate changes):

Ks=cdrom:/myks.cfg

In the format of the network (same as this format only applies to me)

Ks=http://172.16.29.1/myks.cfg

Ks=ftp://172.16.29.1/pub/myks.cfg

2Automatic Installation System

Here we need to customize the boot disk and customize the steps as follows:

    • cp/media/cdrom/isolinux//tmp/myiso/

    • vim/tmp/myiso/ Isolinux/isolinux.cfg

    • Timeout 600                this line is the time to select the installation wait after booting, 600=60s

    • initrd= Initrd.img textks=cdrom:/myks.cfg     text

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

    • cd/tmp

    • Mkisofs-r-j-t-v--no-emul-boo T--boot-loadsize 4--boot-info-table-v "CentOS 7.2 x86_64boot"-B isolinux/isolinux.bin-c isolinux/boot.cat-o/root/bo ot.isomyiso/

The Boot.iso file will be generated in the/root/ directory , and we can send this file to Windows and use it, or use DD directly command to write this file to a CD or u disk, you can automatically install the system.

Summary

This section is primarily designed to automate the installation of Linux and to deploy Linux ona large scale . First we need to have a KS file, use System-config-kisckstart to define the system style we want to install, and then make the boot CD Boot.iso


This article is from "Lao Wang Linux Journey" blog, please be sure to keep this source http://oldking.blog.51cto.com/10402759/1880509

Automating Linux Installation

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.