Installation
First, you should Install and configure
DHCP server on your PXE server. To install and configure DHCP server,
refer the following link:
Now, install the following packages for setting up PXE environment:
# yum install httpd xinetd syslinux tftp-server -y
Configure PXE Server
# tree /var/lib/tftpboot/├── CentOS6.5
│ ├── initrd.img
│ └── vmlinuz
├── centos6_5_x86_64
│ └── CentOS-6.5-x86_64-bin-DVD1.iso
├── CentOS7.0
│ ├── initrd.img
│ └── vmlinuz
├── centos_7_x86_64
│ └── CentOS-7-x86_64-DVD-1511.iso
├── chain.c32
├── images
│ ├── centos-6.5-64
│ ├── initrd.img
│ └── vmlinuz
├── initrd.img
├── mboot.c32
├── memdisk
├── menu.c32
├── pxelinux.0
├── pxelinux.cfg
│ └── default
├── Ubuntu14.04
├── ubuntu14.04_64
│ └── ubuntu-14.04.4-server-amd64.iso
├── Ubuntu16.04
├── ubuntu16.04_64
│ └── ubuntu-16.04-server-amd64.iso
└── vmlinuz
Copy the following TFTP configuration files to the /var/lib/tftpboot/ directory.
#cd /usr/share/syslinux/ #cp pxelinux.0 menu.c32 memdisk mboot.c32 chain.c32 /var/lib/tftpboot/
Edit file /etc/xinetd.d/tftp
#vi /etc/xinetd.d/tftp
Enable TFTP server. To d this, change “disable=yes” to “no”.
# default: off # description: The tftp server serves files using the trivial file transfer \ # protocol. The tftp protocol is often used to boot diskless \ # workstations, download configuration files to network-aware printers, \ # and to start the installation process for some operating systems. service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /var/lib/tftpboot disable = no per_source = 11 cps = 100 2 flags = IPv4 }
Next, create a directory to store CentOS
installation ISO image. and mount the image to that directory as shown
below. I have CentOS 6.5 32bit ISO image on my /root directory.
#mkdir /var/lib/tftpboot/centos6.5
#mount -o loop /var/lib/tftpboot/CentOS-6.5-bin-DVD1.iso /mnt
#cp /mnt/images/pxeboot/vmlinuz, initrd.img /CentOS6.5
Create a apache configuration file for PXE server under /etc/httpd/conf.d/ directory:
#vi /etc/httpd/conf.d/pxeboot.conf
Add the following lines:
Alias /centos6_5 /mnt <Directory /mnt> Options Indexes FollowSymLinks Order Deny,Allow Deny from all Allow from 58.x.x.0/26 </Directory>
Save and close the file.
Then, create a configuration directory for PXE server:
#mkdir /var/lib/tftpboot/pxelinux.cfg
Now, create PXE server configuration file under the pxelinux.cfg:
#vi /var/lib/tftpboot/pxelinux.cfg/default
Add the following lines:
prompt 0
timeout 300
ONTIMEOUT local
Menu title ########## PXE Boot Menu ##########
LABEL CENTOS 6.5 Installation
MENU LABEL centos-6.5-64
KERNEL CentOS6.5/vmlinuz
APPEND initrd=CentOS6.5/initrd.img method=http://58.x.x.50
*Ubuntu
Make sure you are using the one from /install/netboot/ubuntu-installer/amd64
LABEL HardDisk
MENU LABEL ^Hard DIsk
LOCALBOOT 0x80
Configure DHCP Server
Now, we have to configure the DHCP server to work with PXE server.
Edit file /etc/dhcp/dhcpd.conf,
#vi /etc/dhcp/dhcpd.conf
Add the following lines at the end:
allow booting; allow bootp; next-server 58.x.x.50; filename "pxelinux.0";
Save and close the file.
Now, We have come to the end of PXE server configuration. Restart all the services to complete the configuration.
service xinetd restart service httpd restart service dhcpd restart
Configure HTTPD Server
DocumentRoot "/var/www/html"
ServerName 58.x.x.50
#cp /mnt/* /var/www/html/
Installation with Kickstart File
#vi /var/lib/tftpboot/pxelinux.cfg/default
prompt 0
timeout 300
ONTIMEOUT local
menu title ########## PXE Boot Menu ##########
LABEL CENTOS 6.5 Installation
MENU LABEL centos-6.5-64
KERNEL CentOS6.5/vmlinuz ksdevice=eth0
APPEND initrd=CentOS6.5/initrd.img ks=http://IP Address/ks.cfg
LABEL CENTOS 7.0 Installation
MENU LABEL centos-7.0-64
KERNEL CentOS7.0/vmlinuz
APPEND initrd=CentOS7.0/initrd.img ks=http://IP Address/centos7/ks.cfg
LABEL Ubuntu 14.04 Installation
MENU LABEL Ubuntu 14.04
KERNEL
APPEND
LABEL HardDisk
MENU LABEL ^Hard DIsk
LOCALBOOT 0x80
CentOS 6.5
#vi ks.cfg# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
url --url=http://IP Address/
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp
rootpw --iscrypted $6$VW.mEEJY9d2fKaNb$3fPvVgdrgrKVwYNVmtU5sWzB3BbiCo.1W5gO4FVE3/6vU.gBZCDtrJ4Urf.f2T3c87gSlPqQYqkKU39tzVsCN1
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone --utc Asia/Seoul
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --drives=sda
#volgroup VolGroup --pesize=4096 pv.008002
#logvol /home --fstype=ext4 --name=lv_home --vgname=VolGroup --grow --size=100
#logvol / --fstype=ext4 --name=lv_root --vgname=VolGroup --grow --size=1024 --maxsize=51200
#logvol swap --name=lv_swap --vgname=VolGroup --grow --size=7968 --maxsize=7968
part /boot --fstype=ext4 --size=500
part swap --fstype=swap --recommended
part / --fstype=ext4 --size=940000
#part pv.008002 --grow --size=1
repo --name="CentOS" --baseurl=http://IP Address --cost=100
reboot
%packages
@core
@server-policy
@workstation-policy
%end
CentOS 7.0
#vi ks.cfg
#version=DEVEL # System authorization information auth --enableshadow --passalgo=sha512 # Use network installation url --url="http://IP Address/centos7" # Use graphical install graphical # Run the Setup Agent on first boot firstboot --enable ignoredisk --only-use=sda # Keyboard layouts keyboard --vckeymap=us --xlayouts='us' # System language lang en_US.UTF-8 # Network information network --bootproto=dhcp --device=eno1 --onboot=on --ipv6=auto network --bootproto=dhcp --device=eno2 --onboot=on --ipv6=auto network --hostname=localhost.localdomain # Root password rootpw --iscrypted $6$b.HgyW9b6uH9fHvQ$mjPxiumdpTatP3GXL9ziIaUpxUVcreGFjG0Vb8iEU9nJuXISLnlAzcGnFQB1I2svRvdodz8zWw4qqeCzYnkH50 # System timezone timezone Asia/Seoul --isUtc # System bootloader configuration bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda # Partition clearing information clearpart --all --initlabel --drives=sda # Disk partitioning information part /boot --fstype="xfs" --ondisk=sda --size=500 part pv.369 --fstype="lvmpv" --ondisk=sda --size=953368 volgroup centos --pesize=4096 pv.369 logvol / --fstype="xfs" --grow --maxsize=51200 --size=1024 --name=root --vgname=centos logvol swap --fstype="swap" --size=8064 --name=swap --vgname=centos logvol /home --fstype="xfs" --grow --size=500 --name=home --vgname=centos reboot %packages @^minimal @core kexec-tools wget net-tools %end %addon com_redhat_kdump --enable --reserve-mb='auto' %end