Environment:
System: centos7.1
Platform: VirtualBox virtual machine
Installed systems: centos6.7, centos7.1
A rough process:
1. DHCP assigns addresses to clients and provides the files and TFTP server addresses required for client startup.
2. The client automatically downloads the files required for the first phase of bootloader from TFTP. pxelinux.0 file
3. Automatically start downloading the files required for the second phase of bootloader from TFTP (Provide the Window menu and launch the appropriate kernel and pass parameters).
Isolinux.cfg, splash.jpg, ESAMENU.C32,vmlinuz,initrd.img.
4. After the kernel is running, start the Anaconda Setup program and load the kickstart file to start the installation from the HTTP server download program.
First, install the centos6.7.
1. Install and configure DHCP, TFTP and httpd services.
[email protected] ~]# yum install httpd tftp-server tftp dhcp-y
Configure DHCPD. Configure Directory/etc/dhcp/. To copy a DHCP configuration sample file:
[Email protected] dhcp]# cp/usr/share/doc/dhcp-4.2.5/dhcpd.conf.example dhcpd.confcp:overwrite ' dhcpd.conf '? Y
Configuration results:
#option domain-name "star.com"; #指定搜索域, which we can't use here, commented. #option domain-name-servers 192.168.40.100; #DNSdefault-lease-time 3600; # Default Lease max-lease-time 7200; #最长租约log-facility local5; #日志. To add the LOCAL5 log facility in/etc/rsyslog.conf. You can also change the default without modification. subnet 192.168.40.0 netmask 255.255.255.0 { #添加作用域. range 192.168.40.10 192.168.40.20; #地址池 filename "pxelinux.0"; #客户端要去找的文件. next-server 192.168.40.100; #客户端去哪里找filename的文件. } #host node1 { #如果作地址保留, or simply install the system for a single console. Just set this up. # hardware ethernet 0:0:c0:5d:bd:95; ## filename "pxelinux.0"; # next-server 192.168.40.100;#}
If there is a problem when you start, you can always start DHCPD, which will show which lines have errors.
Boot Complete SS-UNL Find 67 port is open, no problem we test it with the client.
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7B/52/wKiom1bLGlbg8h2AAAAnFnT1E3k963.png "title=" Dhcp.png "alt=" Wkiom1blglbg8h2aaaanfnt1e3k963.png "/>
It seems to work fine.
Start TFTPD, in Centos7 inside, SYSTEMD already has xinetd characteristics, no need to use xinetd start tftp. All we have to do is start the socket and the main program SYSTEMD will be started.
Systemctl start Tftpd.socket, start and see if 69/UDP is turned on.
Start httpd. The default configuration is available.
2. Copy the required files to start the installation.
Install Syslinux. Inside this program is a bunch of bootloader files. It also includes the bootloader of the PXE network. Equivalent to the first stage boot of grub.
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ #pxelinux. 0 is syslinux generated. cp /mnt/cdrom/isolinux/{splash.jpg,vesamenu.c32} /var/lib/tftpboot/ #centos6光盘中的文件. Used to generate the boot window and load the corresponding kernel and pass parameters through the configuration file. Equivalent to the file required for the second phase of grub. cp /mnt/cdrom/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/ #用于pxe引导的内核与initrd文件, But here I use md5sum to find that the normal kernel and INITRD files in the CD are the same as those in the PXE directory, Centos7. mkdir /var/lib/tftpboot/pxelinux.cfg/ #这个里面就是要放vesamenu. C32 configuration file. Cp /mnt/cdrom/isolinUx/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
Once the pxelinux.0 is loaded, it will then load the files needed for the second phase from the same location. The second stage then loads the kernel and initrd.
So now the first and second stages of booting are good. It is left in the configuration menu to pass the KS parameter for the kernel. But before we do, we will provide the KS file and the software warehouse, and the software warehouse will use the CD-ROM.
The KS parameter passed to the kernel is used by the Anacoda program and is the key to automatic installation.
I'm here for the KS file content:
firewall --disabled install url --url= " rootpw --iscrypted $6$3hhx9zvz$shb3kpo0uehpetxnxejr2gynxg2rcg2lgcflftbuxn1yfubrumbju3p/ncd/ x467m1jn2yxinwnbexozzjafg1 textfirstboot --disablekeyboard uslang en_usselinux --disabledreboottimezone asia/shanghaibootloader --append= "rhgb crashkernel=auto Quiet " --location=mbr --driveorder=" SDA "Zerombr clearpart --all part /boot --fstype= "Ext4" --size=200part pv.008 --size=61440volgroup vg0 --pesize=8192 pv.008logvol / --fstype=ext4 --name=root --vgname=vg0 --size=20480logvol swap --name=swap --vgname=vg0 --size=2048logvol /usr --fstype=ext4 --name=usr --vgname=vg0 --size =10240logvol /var --fstype=ext4 --name=var --vgname=vg0 --size=20480% Packages@base@core%end
Some of the contents of this document is not very clear, the direct copy of the Marco, their own to simplify a bit. You can install the system-config-kickstart program to set up the KS file.
The file is placed in the home directory of the httpd server. Anaconda supports the HTTP protocol and does not use TFTP anymore.
[Email protected] ~]# LS/VAR/WWW/HTMLCENTOS6 centos6.cfg
At the same time the URL specified in the KS file is the location of the repository, and I am here under the centos6 of the same directory.
Sets the boot menu.
Vim/var/lib/tftpboot/pxelinux.cfg/default
Default vesamenu.c32#prompt 1timeout 20menu background splash.jpgmenu title Welcome to CentOS 6.7!menu color border 0 #fff FFFFF #00000000menu Color sel 7 #ffffffff #ff000000menu color title 0 #ffffffff #00000000menu color tabmsg 0 #ffffffff #00 000000menu Color Unsel 0 #ffffffff #00000000menu color hotsel 0 #ff000000 #ffffffffmenu Color Hotkey 7 #ffffffff #ff000000 Menu Color scrollbar 0 #ffffffff #00000000label Linux menu label ^install CentOS6 menu default kernel vmlinuz append I Nitrd=initrd.img ks=http://192.168.40.100/centos6.cfg
Removed all the unused. and add the parameter KS. is where to download the KS file.
Now the first and second phases of our guidance seem to be complete. If the kernel loads smoothly and starts anaconda, and then successfully downloads the KS file, anaconda if it can be successfully installed by the KS file, even if the installation is complete.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7B/52/wKiom1bLKSry2UeOAAAwinC155E974.png "title=" Dhcp5.png "alt=" Wkiom1blksry2ueoaaawinc155e974.png "/>
In the penultimate row here, you can see why you put a menu in Pxelinux.cfg/default. This is the pxelinux.0 file that is read by default.
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7B/52/wKiom1bLKKGDDt92AAPhodutgEk737.png "title=" Dhcp1.png "alt=" Wkiom1blkkgddt92aaphodutgek737.png "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7B/52/wKiom1bLKQiwyBzwAAAI0ZinmcE597.png "style=" float: none; "title=" Dhcp2.png "alt=" Wkiom1blkqiwybzwaaai0zinmce597.png "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7B/52/wKiom1bLKUKRpXVwAAAM8a8ODiA840.png "title=" Dhcp4.png "alt=" Wkiom1blkukrpxvwaaam8a8odia840.png "/>
The installation started. The results are also normal.
Second, install the centos7.1.
Personally think that in general, the 12th phase of the guidance and the system version of the relationship is not necessary. At least 6 and 7 versions of the CentOS system can be common.
Then that is the above our guide is done, here is only left to copy the kernel files, add boot menu, KS files and repositories.
KS file:
Installkeyboard--VCKEYMAP=CN--xlayouts= ' cn ' REBOOTROOTPW--iscrypted $6$3hhx9zvz$ Shb3kpo0uehpetxnxejr2gynxg2rcg2lgcflftbuxn1yfubrumbju3p/ncd/x467m1jn2yxinwnbexozzjafg1timezone Asia/Shanghaiurl --url= "Http://192.168.40.100/centos7" lang zh_cnfirewall--disablednetwork--bootproto=dhcp--device=eth0auth-- Useshadow--passalgo=sha512textfirstboot--disableselinux--permissiveignoredisk--only-use=sdabootloader-- LOCATION=MBR--boot-drive=sdazerombrclearpart--all--initlabelpart/boot--asprimary--fstype= "XFS"--size=512part Swap--fstype= "swap"--size=2048part/usr--fstype= "XFS"--size=20480part/--fstype= "XFS"--size=20480% Packages@base@core%end
Take a look at the root directory of the httpd now:
[Email protected] html]# LSCENTOS6 centos6.cfg centos7 centos7.cfg
Copy the kernel file: The current directory is in the TFTP root directory.
Cp/mnt/cdrom1/images/pxeboot/initrd.img Initrd.7.imgcp/mnt/cdrom1/images/pxeboot/vmlinuz Vmlinuz.7[[email Protected] tftpboot]# lsinitrd.7.img initrd.img pxelinux.0 pxelinux.cfg splash.jpg vesamenu.c32 vmlinuz vmlinuz.7
Note: Do not copy the kernel into the CENTOS6.
Modify the Boot menu.
default vesamenu.c32timeout 100 #时间改长了一点 , it is now 10 seconds. Menu background splash.jpgmenu title welcome to centos 6.7!menu color border 0 #ffffffff #00000000menu color sel 7 #ffffffff # ff000000menu color title 0 #ffffffff #00000000menu color tabmsg 0 #ffffffff #00000000menu color unsel 0 #ffffffff #00000000menu color hotsel 0 #ff000000 #ffffffffmenu color hotkey 7 #ffffffff # ff000000menu color scrollbar 0 #ffffffff #00000000label linux menu label ^Install CentOS6 menu default kernel vmlinuz Append initrd=initrd.img ks=http://192.168.40.100/centos6.cfglabel linux menu label ^Install centos7 kernel vmlinuz.7 append initrd=initrd.7.img ks=http:// 192.168.40.100/centos7.cfg~
That is, 4 more lines for the Centos7 menu. The menu default is used to start with the defaults.
Let's have a wisp. DHCP sends boot boot files. The client receives the file boot boot and starts loading the second phase. After successful, the kernel file is loaded and the kernel file is started anaconda. Anaconda loads the KS file and begins the installation process.
Let's test it out:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7B/54/wKioL1bLyvOjdhTHAAL5PMvi3RM146.png "title=" dhcp_ 2.png "alt=" Wkiol1blyvojdhthaal5pmvi3rm146.png "/>
It seems to work fine. Re-entry to 6 also works fine. The following is 7.
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7B/54/wKioL1bLwL-CelJFAAAPjTm8mTU936.png "title=" Dhcp9.png "alt=" Wkiol1blwl-celjfaaapjtm8mtu936.png "/>
The format was successful and the installer started, and we can see a total of 469 packages.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7B/54/wKiom1bLwUaDRjqXAAAFw-Ld3W0710.png "title=" Dhcp10.png "alt=" Wkiom1blwuadrjqxaaafw-ld3w0710.png "/>
The time here is a bit long, patience wait a moment. The results are also normal. Reboot into the system.
I do not know why the CENTOS7 CD inside the boot file will be a problem. It might be a different way of passing kernel parameters. I don't know much about it here. Friends are interested to try, VESAMENU.C32 files and isolinux.cfg menu files.
Then 7 of the boot is not good, and sometimes just want to install 7, and there is no 6 of the disc. Some documents can be brought with the Syslinux package.
Cp/usr/share/syslinux/{chain.c32,mboot.c32,menu.c32,memdisk}
Above these files, the use of the Menu.c32 file, the other two c32 files do not know what to do, and the other memdisk seems to be a kernel file.
I can use it only with MENU.C32 and a menu file.
The menu file is still the default, but you have to decide for yourself. Similar to the CENTOS6 above.
Default Menu.c32 #启动menu. c32prompt 5timeout 30MENU TITLE CentOS 7 PXE menulabel linuxmenu LABEL Install Cen TOS 7 X86_64kernel vmlinuz.7append initrd=initrd.7.img ks=http://192.168.40.100/centos7.cfg
My current TFTP directory:
Initrd.7.img initrd.img menu.c32 pxelinux.0 pxelinux.cfg vmlinuz vmlinuz.7
Of course, you can ignore CENTOS6 's initrd and kernel.
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7B/55/wKioL1bL1cmyyv3qAAAGRWOaes0045.png "title=" dhcp_ 4.png "alt=" Wkiol1bl1cmyyv3qaaagrwoaes0045.png "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7B/56/wKiom1bL1bSy1p-BAAAR_VmYmmY070.png "title=" dhcp_ 5.png "alt=" Wkiom1bl1bsy1p-baaar_vmymmy070.png "/>
Works fine. However, when you use it to install CENTOS6, there are times when you choose the keyboard manually. I do not know if there is a problem just set up, now it is installed automatically.
Plus after 6:
Now the menu file:
Default Menu.c32prompt 5timeout 30MENU TITLE centos 7 PXE menulabel linuxmenu LABEL Install centos 7 X86_64kernel vmlinuz. 7APPEND initrd=initrd.7.img ks=http://192.168.40.100/centos7.cfglabel linuxmenu LABEL Install CentOS 6 X86_64kernel Vmlinuzappend initrd=initrd.img ks=http://192.168.40.100/centos6.cfg
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7B/56/wKiom1bL2JngRx-LAAAQKe3HwIc088.png "style=" float: none; "title=" Dhcp_8.png "alt=" Wkiom1bl2jngrx-laaaqke3hwic088.png "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7B/55/wKioL1bL2QeTl7EFAAANCA2X5pw251.png "style=" float: none; "title=" Dhcp_10.png "alt=" Wkiol1bl2qetl7efaaanca2x5pw251.png "/>
This is done. It is now done in a virtual machine, and there may be a variety of problems in the real world. And sometimes it's possible to install multiple versions of the system, such as Ubuntu, fedora ... You will need to use cobbler to install it.
Cobbler is actually a PXE two-time package, some files or configurations can be generated automatically, easy to use.
Thank you for browsing. 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0003.gif "alt=" J_0003.gif "/>
This article is from the "Big Tomato" blog, be sure to keep this source http://fanqie.blog.51cto.com/9382669/1744240
PXE Install the CentOS system