Tuesday, February 23, 2016

Install centos over network using pxe

****information****
pxe server ip: 192.168.0.208

1- install necessary software
$ sudo apt-get install dnsmasq syslinux apache2

2- download centos iso
$ wget http://mirror1.ku.ac.th/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso

3- prepare the tftp root directory
$ mkdir /var/www/html/centos/centos7 -p
$ mkdir /var/www/html/centos/pxelinux.cfg
$ sudo mount CentOS-7-x86_64-Minimal-1511.iso /var/www/html/centos/centos7 
$ cd /usr/lib/syslinux/ && cp  chain.c32  mboot.c32  meminfo.c32  menu.c32  pxelinux.0 /var/www/html/centos/

4- create pxelinux configuration as /var/www/html/centos/pxelinux.cfg/default with the following line
default menu.c32
prompt 0
timeout 300
ONTIMEOUT local
menu title ########## PXE Boot Menu ##########
label 1
menu label ^1) Install CentOS 7
kernel centos7/images/pxeboot/vmlinuz
append initrd=centos7/images/pxeboot/initrd.img method=http://192.168.0.208/centos/centos7 devfs=nomount
label 2
menu label ^2) Boot from local drive localboot




5- create bash create to start tftp, dhcp server name as dnsmasq-tftp.sh
#/bin/bash
#ifconfig eth0 192.168.1.10 up
#dnsmasq -i eth0 --dhcp-range=192.168.1.100,192.168.1.200 \
dnsmasq -i eth0 --dhcp-range=192.168.0.100,192.168.0.200 \
    --dhcp-boot=pxelinux.0 \
    --enable-tftp --tftp-root=/var/www/html/centos/ -d -p0 -K --log-dhcp --bootp-dynamic


6- start apache2 service
$ sudo service apache2 restart
7- run the script
$ sudo sh dnsmasq-tftp.sh

now client that use choose boot from pxe will be able to install from our pxe server




No comments:

Post a Comment