Centos 6.4 PXE unattended installation

Source: Internet
Author: User
Tags md5 encryption

The first part of the theoretical introduction:

Theoretical introduction is basically from the Internet to find, said very good, may seem a bit dull.

Plug two mouth, under normal circumstances we do not use this unattended installation system technology, after all, we rarely encounter large-scale server installation system situation, I also encountered two times, that is, batch installation of more than 20 servers, but the technology is not very smart, Is the first server raid to do the unattended installation, hehe! Of course there is a U disk unattended installation system technology, wood research, you can play when the egg hurts!

What is 1.1 PXE?

PXE (pre-boot execution environment, Pre-boot execution Environment) is the latest technology developed by Intel Corporation, working in the Client/server network mode, Support workstations download images from remote servers over the network, and thus support booting the operating system over a network, during startup, the terminal requires the server to assign IP addresses, and then TFTP (trivial file transfer  Protocol) or MTFTP (multicast trivial file transfer protocol) protocol to download a boot package to native memory execution, This boot package completes the Terminal basic software setup to boot the terminal operating system that is pre-installed on the server.

PXE is not a way to install, but a way to boot. A requirement for a PXE installation is that a PXE-supported network card (NIC) must be included on the computer to be installed, that is, the PXE Client must be in the network card. The PXE protocol enables a computer to boot over the network. This protocol is divided between the client side and the Server side, while the PXE client is in the ROM of the NIC. When the computer boots, the BIOS directs the PXE client into memory and then the files that are placed at the remote end by the PXE client are downloaded locally to run on the network. Running the PXE protocol requires setting up a DHCP server and a TFTP server. The DHCP server assigns an IP address to the PXE client (the host that will install the system), and because it assigns an IP address to the PXE client, the appropriate PXE settings need to be added when configuring the DHCP server. In addition, the TFTP client already exists in the PXE client ROM, so it can download the required files via the TFTP protocol to the TFTP Server.

Working process for PXE:

1. PXE Client starts from its own PXE network card and requests IP from the DHCP server in the network;

2. The DHCP server returns the IP that is assigned to the client and the location of the PXE file (the file is typically placed on a TFTP server);

3. The PXE Client requests the pxelinux.0 file from the TFTP server in the network;

4. The PXE Client obtains the pxelinux.0 file after the implementation of the file;

5. Load the kernel and file system via the TFTP server based on the results of pxelinux.0 execution;

6. Enter the installation screen, which can be installed by selecting one of the HTTP, FTP, and NFS modes;

Here is a flowchart from the online copy:

650) this.width=650; "class=" Alignnone size-medium wp-image-31 "src=" http://www.51niux.com/wp-content/uploads/2015/ 03/%e5%9b%be%e7%89%871-300x297.jpg "alt=" Picture 1 "width=" "height=" 297 "style=" height:auto;vertical-align:middle; "/ >

What is 1.2 kickstart?

Kickstart is an unattended installation method. It works by documenting typical parameters that require manual intervention during the installation process and generating a file named Ks.cfg. If you have to fill in the parameters during the installation process (not limited to the machine that generated the Kickstart installation files), the installer will first look for the files generated by the kickstart, and if the appropriate parameters are found, use the found parameters; Need to be manually intervened by the installer. So, if the kickstart file covers all the parameters that may be required during installation, then the installer can simply tell the installer where to fetch the ks.cfg file and then go to work on it. When the installation is complete, the installer restarts the system according to the settings in the Ks.cfg and ends the installation.

Here is a copy of the map from the internet

650) this.width=650; "class=" Alignnone size-medium wp-image-33 "src=" http://www.51niux.com/wp-content/uploads/2015/ 03/%e5%9b%be%e7%89%872-300x281.jpg "alt=" Picture 2 "width=" "height=" 281 "style=" height:auto;vertical-align:middle; "/ >

Part II: Operation steps

1.1 Environment Preparation

Here is the dhcp+http+tftp way to do the unattended installation.

Operating system: Centos 6.4

DHCP server ip:192.168.1.105

Http/ftp/nfs Server ip:192.168.1.105

TFTP server ip:192.168.1.105

Note: The firewall is shutting down. In particular, SELinux must be shut down, or wait until you all the steps are correct, but the client began to request the installation of the system when the client will be error, I was a pit, the problem has been a long time.

1.2 Server Setup

1.2.1 HTTP Server Setup

[email protected] ~]# yum install httpd*-y #这里就不用编译安装了

[[email protected] ~]#/etc/init.d/httpd start

1.2.2 Mount Disc copy content to the HTTPD site Directory

[Email protected] ~]# mount/dev/cdrom/mnt
Mount:block Device/dev/sr0 is write-protected, mounting read-only

[Email protected] ~]# cp-rf/mnt/*/var/www/html/#将光盘的所有内容复制到站点目录下面

1.2.3 Installation Configuration TFTP server

[email protected] ~]# Yum install tftp-server-y

[Email protected] ~]# vi/etc/xinetd.d/tftp

Service TFTP
{
Socket_type = Dgram
protocol = UDP
Wait = yes
user = root
Server =/USR/SBIN/IN.TFTPD
Server_args =-s/tftpboot #更改tftp的ftp目录位置
Disable = no #将yes变成了no to modify the path service above without the default path
Per_source = 11
CPS = 100 2
Flags = IPV4
}

[[email protected] ~]#/etc/init.d/xinetd start #启动tftp服务, some people will wonder why is the start xinetd service, down you can understand the XINETD service, Some other services like Vsftp can also be started with xinetd.
Starting xinetd: [OK]

1.2.4 Copy the associated boot file to the TFTP TFTP directory

[email protected] ~]# yum install syslinux-y #这是干什么? No, you can't find the pxelinux.0 file locally.

[Email protected] ~]# Mkdir/tftpboot
[Email protected] ~]# cp/usr/share/syslinux/pxelinux.0/tftpboot/

[Email protected] ~]# cp/var/www/html/images/pxeboot/initrd.img/tftpboot/
[Email protected] ~]# cp/var/www/html/images/pxeboot/vmlinuz/tftpboot/
[Email protected] ~]# cp/var/www/html/isolinux/*.msg/tftpboot/
[Email protected] ~]# mkdir/tftpboot/pxelinux.cfg
[Email protected] ~]# Cp/var/www/html/isolinux/isolinux.cfg/tftpboot/pxelinux.cfg/default

1.2.5 Building a DHCP server

[email protected] ~]# Yum install dhcp-y

[Email protected] ~]# vi/etc/dhcp/dhcpd.conf #具体参数什么意思留着以后的DHCP服务器讲解再细说

authoritative;
Next-server 192.168.1.108; #这里PXE服务器的IP地址
FileName "/pxelinux.0"; #这里是非常关键的一定要记住, this sentence and the above sentence must be above the subnet, or to error.
Subnet 192.168.1.0 netmask 255.255.255.0 {
Option routers 192.168.1.1;
Option Domain-name-servers 202.106.0.20,8.8.8.8;
Range DYNAMIC-BOOTP 192.168.1.100 192.168.1.254;
Default-lease-time 600;
Max-lease-time 7200;
Option broadcast-address 192.168.1.255;
Host Router {
Hardware Ethernet 00:0c:29:d5:d2:5e;
Fixed-address 192.168.1.108;
}
}

[[email protected] ~]#/ETC/INIT.D/DHCPD start
Starting dhcpd: [OK]

1.2.6 Configuring Ks.cfg Files (refer to file ~/anaconda-ks.cfg)

[Email protected] ~]# vi/var/www/html/ks.cfg

Auth--useshadow--enablemd5 # Select Encrypt user password in MD5 encryption form
Key--skip #这行很重要, used to skip the registration code input, or the installation failed
Bootloader--LOCATION=MBR
Text
Firewall--disabled #关闭防火墙
Firstboot--disable
Keyboard US
Lang Zh_cn. UTF-8
Logging--level=info
URL--url=http://192.168.1.108/#系统安装文件的位置
Network--bootproto=dhcp--device=eth0--onboot=on #网卡选择为dhcp模式
ROOTPW--iscrypted $6$jt2bigc7pihmvqzg$t/ rllxlg76vxp.zgqbv033squlcslrsjjfrjnfhvqefanqg8jpywhovots4g8swrnc08djs7cpi35oncpgsts/#这密码是123456
SELinux--disabled #关闭selinux
TimeZone--UTC Asia/shanghai
Install
ZEROMBR #清空mbr
Clearpart--all--initlabel #格式化所有的磁盘, if there is no above and this sentence, unattended installation will prompt you whether to format, also can not achieve unattended effect
Part/boot--FSTYPE=EXT4--size=200
Part swap--size=2048
Part/--FSTYPE=EXT4--grow--size=1 #这里是将剩余的空间分配给根分区, this sentence is hard to find
%packages
@base
@chinese-support
@core
@ha
@ha-management
@load-balancer
@performance
@system-MANAGEMENT-SNMP
@server-policy
@system-management
@system-admin-tools
Oddjob
Sgpio
Device-mapper-persistent-data
Sg3_utils
Ipmitool
Fence-agents
Pexpect
%end
Reboot

[Email protected] ~]# chmod 755/var/www/html/ks.cfg #一定要给执行权限不然安装会报错

1.2.7 Configuring the default file in the Tftpboot directory

[Email protected] ~]# Vi/tftpboot/pxelinux.cfg/default

#default VESAMENU.C32 #将这句注释掉不然安装过程中报错找不到文件
Path to the default Linux ks=http://192.168.1.108/ks.cfg #指定ks. cfg

1.2.8 This server has been configured, although to start a server to install the system according to F12 can automatically implement automatic installation, I am one side of the operation while writing blog, unless I make two wrong place, otherwise, according to this step is certain will succeed, write some humble hope letter.

This article from "Technology in the progress of sharing" blog, declined reprint!

Centos 6.4 PXE unattended installation

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.