PXE installed mode

Source: Internet
Author: User
Tags crypt

I. Concepts and principles
What is PXE
strictly speaking, PXE is not a way to install, but a way to boot. A requirement for a PXE installation is that the computer to be installed contains a PXE-supported network card (NIC), which must have a PXE Client on the network card. PXE (Pre-Boot execution Environment, the pre-launch Execution Environment) protocol enables a computer to boot over a network. The protocol is divided into client and server side, the PXE client is in the ROM of the NIC, when the computer boots, the BIOS puts the PXE client into memory execution, and the PXE client will place the remote files on the network to run locally. Running the PXE protocol requires setting up a DHCP server and a TFTP server. The DHCP server is used to assign an IP address to the PXE client (the host on which the system will be installed), 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. The PXE Client downloads the required files through the TFTP protocol to the TFTP Server.
What is Kickstart
Kickstart is an unattended installation method. Kickstart works by documenting the various parameters required for manual intervention during the typical installation process, and generate a file named Ks.cfg, in the subsequent installation process (not limited to the machine that generated the Kickstart installation file) when the request to fill in the parameters of the case, the installer will first go to find the kickstart generated files, when the appropriate parameters are found, the use of the found parameters, when the appropriate parameters are not found, Requires manual intervention by the installer. This way, if the kickstart file covers all the parameters that are required to be filled in during installation, 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 and ends the installation according to the restart option set in Ks.cfg.


Two, installation environment
Installing the Pxe+kickstart batch deployment system
1 DHCP service, this is used to distribute IP, bare metal used to communicate with PXE boot machine to get files
2 TFTP server used to transfer files with bare metal
3 HTTP service, FTP, or NFS shared file access
4 ks.cfg files are used for automatic partial matching system configuration during installation
5 syslinux Service provides pxelinux.0 file boot
61 NIC hosts that support the PXE protocol
7 Turn off SELinux and iptables firewalls

Installation Steps

confirm the operating system version
Uname-r
2.6.32-504.el6.x86_64
[Email protected] ~]# cat/etc/issue
CentOS Release 6.6 (Final)
Kernel \ r on an \m



Installing the required software using the Yum source
Mount Disc Image: mount/dev/cdrom/mnt/
Configure local Yum source
[[email protected] ] # Cat/etc/yum.repo/yum.repo
[Yum]
name=local Yum
baseurl=file:///mnt
enabled=1
gpgcheck=0



Configure static IP
Vim/etc/sysconfig/network-scripts/ifcfg-eth0
ipaddr=192.168.1.103
netmask=255.255.255.0
gateway=192.168.1.1





Installing the DHCP service
[[email protected] ~] # yum-y Install DHCP
Configure the DHCP service so that it can pass IP addresses for other servers
Configure 192.168.1.0 distribution network segment, subnet 255.255.255.0, configuration entries after each line must be;

Subnet 192.168.1.0 netmask 255.255.255.0 {
Range 192.168.1 ten 192.168.1.50;
Default-lease-time 6000;
max-lease-time 72000;
next-server 192.168.1.103;
filename "/pxelinux.0";
}

[Hide]

Install the HTTPD service (this article provides services via HTTP)


[[email protected] ~] # yum-y insatll httpd




here just let HTTP be able to provide services, without any configuration
set httpd to boot automatically
[Email protected] ~]# chkcpnfig httpd on

Installing the Tftp-server service side
yum-y Install tftp-server xinted
xinted is a daemon for TFTP that sets TFTP and xinted to boot
chkconfig tftp on
chkconfig xinted on #添加开机自启动



Modify the TFTP configuration file
vim/etc/xinetd.d/tftp//contents are as follows:
Service TFTP

{

Socket_type = Dgram

protocol = UDP

wait = yes

user = root

Server =/usr/sbin/in.tftpd

Server_args =-s/tftpboot

disable = no//Only the part that needs to be changed

Per_source = One

CPS = 2

flags = IPv4

}



Enable TFTP service
TFTP is initiated by xinted,
when you're done, remember to service xinetd restart


re-create the directory Mount disc for installation system use, providing critical files and packages for installing the system
mkdir/var/www/html/centos6/
Mount--bind/mnt//var/www/html/centos6/




start the HTTP service
/etc/init.d/httpd Start



Install Syslinux, this service provides pxelinux.0 files for PXE
yum-y Install Syslinux

copy PXE required system kernel boot file to tftp directory
[Email protected] /]# cp/mnt/images/pxeboot/vmlinuz/var/lib/tftpboot/
[Email protected] /]# cp/mnt/images/pxeboot/initrd.img/var/lib/tftpboot/
[Email protected] /]# cp/mnt/isolinux/boot.msg/var/lib/tftpboot/
[Email protected] /]# cp/mnt/isolinux/vesamenu.c32/var/lib/tftpboot/
[Email protected] /]# cp/mnt/isolinux/splash.jpg/var/lib/tftpboot/
[Email protected] /]# cp/usr/share/sysliux/pxelinux.0/var/lib/tftpboot/
[Email protected] /]# mkdir/var/lib/tftpboot/pxelinux.cfg
[Email protected] /]# cp/mnt/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/default


Modify/var/lib/tftpboot/pxelinux.cfg/default
defines the boot prompt, including the boot interface
Specifies the read Ks.cfg file method:
Append initrd=initrd.img ks=http://192.168.1.103/ks.cfg


provide Kictstart file
Kictstart file generation is available in two ways
1, directly copy/root/anaconda-ks.cfg template, use vim for editing configuration
2, using System-config-kiskstart to generate, it is recommended to use/root/anaconda-ks.cfg template to generate
This article builds in the first way, modifies the parameters that you need

Using MD5 encryption settingsAdministratorPassword


Copy the generated ks.cfg file to/var/www/html
the content is as follows, modified according to requirements
bootloader--location=mbr
Clearpart--none
Graphical
Firewall--disabled
firstboot--disabled
keyboard US
Lang en_US
Logging--level=info
URL--url=http://10.28.79.201/Centos6
network--bootproto=dhcp--device=eth0--onboot=on
reboot
Auth--useshadow--enablemd5
ROOTPW--iscrypted xiang1995
SELinux--disabled
timezone--ISUTC Asia/shanghai
Install
network--bootproto=dhcp device=eth0--onboot=on
#system bootloader Configuration
bootloader--append= "Crashkernel=auto rhgb quiet"--location=mbr--driveorder= "SDA"
#clear the master boot record
zerombr
Clearpart--all--initlabel
part/boot--fstype= "Ext4"--size=200
Part swap--size=2048
Part /--fstype= "Ext4"--grow--size=200

%packages
@base
@core
@debugging
@desktop-debugging
@desktop-platform
@directory-client
@fonts
@graphical-admin-tools
@input-methods
@internet-applications
@internet-browser
@java-platform
@legacy-X
@network-file-system-client
@office-suite
@print-client
@remote-desktop-clients
@server-platform
@server-policy
@workstation-policy
@x11
Mtools
Pax
Oddjob
Sgpio
Device-mapper-persistent-data
Abrt-gui
Samba-winbind
Certmonger
pam_krb5
krb5-workstation
LIBXMU
%end
[/hide]

the system can be installed automatically after boot without interference


Note: The boot installation configuration should be consistent with the network segment of the networking device
Modifying the roaming IP configuration of a Linux service
1, network card configuration static IP
2, configure the DHCP distribution IP segment, the same IP subnet as the PXE machine
3. Repair and changeThe KS file location in/var/tftpboot/pxelinux.cfg/default/
Such as:

Append initrd=initrd.img ks=http://192.168.1.103/ks.cfg

4. Modify the location of the specified installation image in the Ks.cfg file (CD mount directory)
Such as:

URL--url=http://10.28.79.201/centos6


About KS file MD5 encryption method


The password for root in Linux kickstart can be used in clear text or encrypted values can be used
Rootpw–iscrypted $1$bysimlw0$i515ylikzudlwkiskbqqe1

is to read the encrypted value, but how is this value generated?
This is the same as the Linux system Password shadow, which is generated as follows:
Perl-e ' Print crypt ("123456", Q ($1$bysimlw0)), "\ n" '
# # of which 123456 is the password to be set for the user, $1$bysimlw0 string is a custom string, shadow is generally used with $1$ followed by 8 characters in this format.
The resulting password string style is as follows:
$1$bysimlw0$i515ylikzudlwkiskbqqe1

In the middle there is a $, before the salt, the following encryption value, together called hash
Crypt itself by default with Des algorithm
If salt starts with $1$, it uses the MD5 algorithm

The DES algorithm commands are as follows:
Perl-e ' Print crypt ("123456", "/g"), "\ n" '
The resulting password string style is as follows:
/gulsxipk3qeu

Fully, if you want to set a custom password for "mypass-123"
This gives you the following:
Perl-e ' Print crypt ("mypass-123", Q ($1$bysimile)), "\ n" '
Your password is: $1$bysimile$lttb1n6ymsxp7ipq0qfqi0

The $1$bysimile here is a custom string.


Original post content: http://www.apelearn.com/bbs/thread-731-1-1.html


This article is from the "Linux Nest" blog, please be sure to keep this source http://xiangcc.blog.51cto.com/10201823/1741110

PXE installed mode

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.