Linux Automated Batch Deployment installation system

Source: Internet
Author: User

System installation of operation and maintenance automation

System startup process (see the previous document for details):

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


Anaconda: System Installation Tool (Install Operating system wizard)

GUI: Graphics window

tui:curses installation; text mode with blue background window installation

Mbr:isolinux/boot.cat

Phase II: Isolinux.bin

Configuration file: Isolinux/isolinux.cfg (CD-Enabled installation menu, the ^ in the file represents the key for the shortcut key)

Timeout Countdown is a very second

Menu Default represents the choice after entering the menu

Nomodeset: Does not modify the mode settings, it will load the most basic driver of the video card

Rescue: Rescue mode

In the CD-launched menu, press ESC and enter Linux Askmethod Select how to use the installation system

Text Character Interface installation


Primary:

Semi-automatic installation:

When the system is installed, the root home directory generates a anaconda.cfg answer file with a series of steps to install the system

1 System-config-kickstart: Used to make unattended answer files #生成应答文件

2 after the completion of the production will be saved as a ks.cfg file, the final need to install what package to edit in the file, you can refer to the Anaconda.cfg file; #修改应答文件

3 Ksvalidator ks.cfg #检查文件语法是否有误

4 Storing the Ks.cfg file in the FTP shared directory

5 Start with disc, type Tap key in the menu, enter Ks=ftp://172.18.0.6/pub/ks.cfg ip=172.18.0.123 netmask=255.255.0.0 # after initrd.img Read the Ks.cfg file and configure the IP address


CENTOS7:

7 The top System-config-kickstart open after the package location may not have a packet, in the Yum source to change the first warehouse to [development];


Steps to build PXE batch installation system


1 yum-y Install dhcpd tftp-server httpd syslinux #安装后续所需的服务

2 DHCP Service:

Statically specified

Dynamic acquisition: BOOTP protocol: Mac and IP one by one static counterpart

DHCP: Dynamically assigned Addresses

DHCP work process

67 (server-side) 68 (client) port for UDP protocol


Assigning IP addresses across network segments:

DHCP Relay: Dhcrelay (receives a broadcast from a client discover unicast to a DHCP server that spans a route)

DHCP Server:

Yum-y Install DHCPD #安装dhcp服务

cp/usr/share/doc/dhcp-4.2.5/dhcpd.conf.example/etc/dhcp/dhcpd.conf #将范例文件拷贝并覆盖到指定位置

vim/etc/dhcp/dhcpd.conf #编辑配置文件

Option Domain-name "kaikai.com"; #客户端获取的域名

Option Domain-name-servers 114.114.114.114,8.8.8.8; #客户端获取到的dns

Option routers 192.168.27.1; #客户端获取到的网关


Default-lease-time 86400; #指定默认租约时间

Max-lease-time 864000; #最大租约时间

Log-facility Local7; #日志

Subnet 192.168.27.0 netmask 255.255.255.0 {#指定网段与掩码

Range 192.168.27.50 192.168.27.200; #指定IP地址池

option routers 192.168.27.1;#设置网关

Option Domain-name-servers114.144.144.144; #设置dns

FileName "pxelinux.0"; #启动文件名称

Next-server 192.168.27.144; #存放后续启动文件IP地址

}

/var/lib/dhcpd/dhcpd.leases #客户端获取ip后的日志记录 (service side)

/var/lib/dhclient/dhclient.leases #客户端获取dhcp服务端的详细信息 (client)

Systemctl Enable DHCPD #设置dhcpd服务器开机自动启动

Systemctl start dhcpd#启动dhcpd服务


3 TFTP Server: Lightweight file Transfer Server (UDP 69 port)

Working directory/var/lib/tftpboot;

1 yum-y Install Tftp-server #安装tftp服务

2 systemctl enable TFTPD #设置tftpd服务开机启动

3 systemctl start tftp #启动tftpd服务


4 mkdir/var/www/html/centos/{6,7}-PV #在httpd服务的工作目录下创建两个文件夹用来存放分别挂载不同系统的光盘

MOUNT/DEV/SR0/VAR/WWW/HTML/CENTOS/7 #将第一块centos7磁盘挂载到后方目录

MOUNT/DEV/SR1/VAR/WWW/HTML/CENTOS/6 #将第二块centos6的系统挂载到后方目录


5 yum-y Install System-config-kickstart #安装图形化的回应文件

System-config-kickstart #分别在centos6与centos7的图形界面键入此命令生成ks. cfg file

The case is minimized installation, configuration interface is graphical, no difficulty, in this no longer an example, according to the actual situation configuration, finally saved in the root home directory named Ks.cfg file

Create a Ksdir folder to hold the Ks.cfg files for both systems under the/var/www/html/of CentOS 7

SCP ~root/ks.cfg [Email Protected]:/var/www/html/ksdir will ceonts 6 above the resulting file SCP to the server, which is CentOS 7 above

After the last installation of the graphical options, the script can write the following:

rm-rf/etc/yum.repos.d/*

Cat >/etc/yum.repos.d/base.repo <<eof

[Base]

Name=xxxxxx

Baseurl=http://172.18.0.1/centos/7

Gpgcheck=0

Enabled=1

Eof

Cat >/root/.ssh/authorized_keys <<eof

Ssh-rsa aaaab3nzac1yc2eaaaadaqabaaabaqdkxh6zjolmjadhqvzvc+ho1rdq2hnejdey+ vfbqqzxafq6w7fwvwctqveofyvomelkhbytjaqwg720j

fvg5zpf8+up7ms1yjxd4d220aaaiqjm1/ql5wjihiotp+8bipdpkmquqc4751zumcb6hetv9lblea6jglu9ddtxpryfkkj8yd/ 2a3v38vtzj0triqzoco

xexvy2fc4v0p+jxcsrrxkv2u5aub8zxbyiibzbmxnfbokunfoqopr4w2jomioxpyhtldymcjxfofjze4jb3kmpes6ak/3rw0kg8mypzphy/ Ndandzyoxz

q+dpg0uty8ttta6xfxewmgeizf517 [email protected]

Eof

chmod 664/root/.ssh/authorized_keys

Useradd Fang

Echo Fang | --stdin Fang &>/dev/null

Systemctl set-default multi-user.target: Automatic Restart after installation is complete


6 CP/USR/SHARE/SYSLINUX/{PXELINUX.0,MENU.C32}/var/lib/tftpboot #将此文件拷贝到tftp的工作目录

MENU.C32: Menu Style

Cp/var/www/html/centos/7/isolinux/{initrd.img,vmlinuz}/var/lib/tftpboot #将启动文件和内核拷到tftp的工作目录

Mkdir/var/lib/tftpboot/pxelinux.cfg #创建pxelinux. CFG directory, for storing isolinux.cfg

Cp/var/www/html/centos/7/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/default #将文件拷贝并改名为default

Note: If you have 6 and 7, you can also copy the 6 kernel series files separately


7 Vim/var/lib/tftpboot/pxelinux.cfg/default

Default Menu.c32

Timeout 600


Menu Title PXE INSTALL CentOS


Label Desktop

Menu Label ^install Desktop CentOS 7

Kernel 7/vmlinuz

Append initrd=7/initrd.img ks=http://192.168.27.7/ksdir/ks7-pxe.cfg


Label Mini

Menu Label Install ^destkop CentOS 6

Kernel 6/vmlinuz

Append initrd=6/initrd.img ks=http://192.168.27.7/ksdir/ks6-desktop.cfg


Label Local

Menu default

Menu label Boot from ^local Drive

Localboot 0xFFFF

Menu End


Linux Automated Batch Deployment installation system

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.