How to configure PXE server with YUM


STEP 1:- CONFIGURE YUM WITH FTP 

[root@alex] yum install vsftpd*  createrepo* -y

[root@alex] setsebool -P ftp_home_dir on    

[root@alex] service vsftpd restart

 [root@alex] chkconfig vsftpd on

NOW COPY YOU FULL DVD OR CD IN A SEPRATE LOCATION AS

 [root@alex] mkdir /var/ftp/pub/RHEL-5.2

[root@alex] cp -arvf /media/RHEL-5.2  /var/ftp/pub/RHEL-5.2

NOTE :- NOW REMEMBER ONE THING YOUR REPOSATRY SHOULD BE CREATED WITH -vg OPTION.

[root@alex] cd /var/ftp/pub/RHEL-5.2/Server

[root@alex] cp repodata/comps-rhel5-server-core.xml .

[root@alex] createrepo -vg comps-rhel5-server-core.xml .

[root@alex] cd /var/ftp/pub/RHEL-5.2/VT

[root@alex]cp repodata/comps-rhel5-vt.xml .

[root@alex]createrepo -vg comps-rhel5-vt.xml .

[root@alex] cd /var/ftp/pub/RHEL-5.2/Cluster

[root@alex]cp repodata/comps-rhel5-cluster.xml .

[root@alex]createrepo -vg comps-rhel5-cluster.xml .

[root@alex] cd /var/ftp/pub/RHEL-5.2/ClusterStorage

[root@alex]cp repodata/comps-rhel5-cluster-st.xml .

[root@alex]createrepo -vg comps-rhel5-cluster-st.xml .

[root@alex] vi /etc/yum.repos.d/server.repo

[Server]

name=Server

baseurl=ftp://172.24.0.2/pub/Server

gpgcheck=0

[VT]

name=VT

baseurl=ftp://172.24.0.2/pub/VT

gpgcheck=0

[Cluster]

name=Cluster

baseurl=ftp://172.24.0.2/pub/Cluster

gpgcheck=0

[ClusterStorage]

name=ClusterStorage

baseurl=ftp://172.24.0.2/pub/ClusterStorage

gpgcheck=0

[root@alex] yum clean all

[root@alex] yum list

STEP 2 :- export the /var/ftp/pub and /var/ftp/pub/RHEL-5.2 directory via nfs

[root@alex] vim /etc/exports

/var/ftp/pub                                  [root@alex](rw,sync)

/var/ftp/pub/RHEL-5.2           [root@alex](rw,sync)

 [root@alex]service portmap restart

[root@alex]service nfs restart

[root@alex]chkconfig portmap on

[root@alex]chkconfig nfs on

STEP 3 :- CONFIGURING TFTP FOR PXE :-

You need to install tftp, as it is not installed when you install your Linux box with “Customize Later” option selected.

[root@alex]rpm -ivh tftp-server-0.42-3.1.i386.rpm

NOTE :- tftp-server is a xinetd dependent, if xinetd is not installed, you need to install xinetd rpm.

STEP 4 :- tftp is an xinetd based service, and requires to be started manually as:

[root@alex]vi /etc/xinetd.d/tftp

replace the line disable = yes to disable = no

 [root@alex]service xinetd restart

[root@alex]chkconfig xinetd on

[root@alex]chkconfig tftp  on

STEP 5:- CONFIGURING DHCP SERVER FOR PXE

[root@alex] vim /etc/dhcp.conf

ddns-update-style interim;

ignore client-updates;

allow booting;

allow bootp;

set vendorclass = option vendor-class-identifier;

subnet 172.24.0.0 netmask 255.255.0.0 {

option routers                          172.24.0.2;

option subnet-mask                 255.255.0.0;

option nis-domain                   “RHCE”;

option domain-name               “example.com”;

option domain-name-servers   172.24.0.2;

option time-offset                   18000;

option ntp-servers                   172.24.0.2;

option netbios-name-servers   172.24.0.2;

range dynamic-bootp              172.24.0.100 172.24.0.222;

default-lease-time                   21600;

max-lease-time                        43200;

filename                                    “/linux-install/pxelinux.0”;

next-server                              172.24.0.2;

#we want the nameserver to appear at a fixed address

host ns {

next-server marvin.redhat.com;

hardware ethernet 12:34:56:78:AB:CD;

fixed-address 207.175.42.254;

}

}

NOTE :- 172.24.0.2 is the ip address of my server on which I am configuring PXE.

After dhcpd.conf file is being configured, start dhcpd service and chkconfig it so that it

start automatically on next boot.

[root@alex]service dhcpd start

[root@alex]chkconfig dhcpd on

STEP 6:- Now create your kickstart answer file

[root@alex]system-config-kickstart

 :- now your screen apear a kickstart wizard. configure your “ks.cfg” answer file according to your need  and save this file in /path/of/your/dvd/contain/directory.

/var/ftp/pub/RHEL-5.2

Now Open the ks.cfg file do this entry to install all packages on your client.

[root@alex] vi /var/ftp/pub/RHEL-5.2/ks.cfg

come to the bottom position of file.

#Package Selections

%packages

@everything  :- To install all available packages. save and exit from file.

OR

#Package Selections

%packages

*

To install all availabe packages.

STEP 7 :- PXE BOOT CONFIGURATION :-

The next step is to configure PXE boot configuration, so that tftp-server can serve client requests. This configuration can be done either through GUI tool

system-config-netboot or through CLI using pxeos command.

system-conf-netboot                           –> network install

Operating system identifier                –> /tftpboot/linux-install/

Description                                          –> HELLO

Select protocol for installation         –> ftp

Kickstart                                             –> /kickstart/ks.cfg

Server ip address                              –> 172.24.0.18 :- ip of pxe server.

Location                                              –> /var/ftp/pub

NOTE :-

*system-config-netboot is available if system-config-netboot-0.1.45.1-1.el5.noarch.rpm

is installed.

*pxeos and pxeboot commands are available if system-config-netboot-cmd-0.1.45.1 1.el5.noarch.rpm is installed.

*Both system-config-netboot-0.1.45.1-1.el5.noarch.rpm and system-config-netboot-cmd-0.1.45.1-1.el5.noarch.rpm are present on CD-2.

*In this post I have mentioned how to use cmd tool to configure PXE boot, so, installation of system-config-netboot-0.1.45.1-1.el5.noarch.rpm is not required. Installation of system-config-netboot-cmd-0.1.45.1-1.el5.noarch.rpm will serve our  purpose.

*We need to execute the following command to configure PXE configuration as:

pxeos -a -i “REDHAT-5.2” -p FTP -D 0 -s 172.24.0.2 -L /pub/RHEL-5.2/ -K ftp://172.24.0.2/pub/RHEL-5.2/ks.cfg RHEL-5.2

pxeos -a -i “REDHAT-5.2” -p NFS -D 0 -s 172.24.0.2 -L /var/ftp/pub/RHEL-5.2/ -K nfs:172.24.0.2:/var/ftp/pub/RHEL-5.2/ks.cfg RHEL-5.2

NOTE :- Where:

-a

add a new Operating System description

-i <description>

set short description not allowed with the Operating System.

-p <NFS | HTTP | FTP>

specify protocol used to access the Operating System

-D <1|0>

specify whether the configuration is diskless or not, zero specifies that it is not a diskless

configuration

-s <server name or ip address>

specify the machine containing the Operating System

-L <netlocation>

specify the directory on the sever machine containing the Operating System.

-K <kickstart-directory-location>

specify the location of the kickstart file, this should be spec-ified as a kernel parameter.

ftp://172.24.0.2/pub/RHEL-5.2/ks.cfg

<os-identifier>Specify the unique Operating System identifier, which is used as the directory

name in the /tftpboot/linux-install/directory.

After execution pxeos command, the initrd.img and vmlinuz files required are transferred from

/var/ftp/pub/rhel5.3/images/pxeboot/ to /tftpboot/linux-install/<os-identifier>

In our case <os-identifier> is RHEL-5.2

OR

system-conf-netboot               –> network install

Operating system identifier    –> /tftpboot/linux-install/

Description                              –> HELLO

Select protocol for installation–> FTP

Kickstart                                 –> /var/ftp/pub/RHEL-5.2/ks.cfg

Server ip address                     –> 172.24.0.18 :- ip of pxe server.

Location                                  –> /var/ftp/pub

OR

system-conf-netboot               –> network install

Operating system identifier    –> /tftpboot/linux-install/

Description                              –> HELLO

Select protocol for installation–> NFS

Kickstart                                 –> /var/ftp/pub/RHEL-5.2/ks.cfg

Server ip address                     –> 172.24.0.18 :- ip of pxe server.

Location                                  –> /var/ftp/pub

STEP 08 :- Make Sure Reboot your PXE server After Configuration .

NOTE :- NOW YOUR CLIENT WILL BE ABLE TO BOOT FROM YOUR PXE SERVER

ADDITIONAL STEPS :- FUN, MAZA, MASTI

STEP 1:- HOW TO CHANGE BOOT MESSAGES OF PXE

vi  /tftpboot/linux-install/msgs/boot.msg :- modify this file as you want to see on boot screen like.

09Welcome to 0cRed Hat Network09 Installer!07

0a

.-=-.          .–.

__        .’     ‘.       /  ” )

_     .’  ‘.     /   .-.   \     /  .-‘0ca

( \   / .-.  \   /   /   \   \   /  /    0c^0a

\ `-` /   \  `-‘   /     \   `-`  /

`-.-`     ‘.____.’       `.____.’

07

ENETER THE PARAMETER TO INSTALL YOUR OS ACCORDING TO YOUR NEED.

0.  Local Machine

IUOS. RHEL-5.2—UNATTENDED – REDHAT-5.2

IAOS. RHEL-5.2—ATTENDED – REDHAT-5.2

IUGOS. RHEL-5.2—UNATTENDED-GRAPHICS – REDHAT-5.2

TEST. RHEL-5.2 – REDHAT-5.2

TYPE “TEST” TO INSTALL RHEL-5.2 – REDHAT-5.2

05[F1-Main] [F2-General] [F3-Expert] [F4-Kernel] [F5-Rescue]

STEP 2:- HOW TO CHANGE  /tftpboot/linux-install/pxelinux.cfg/default FILE ACCORDING TO YOUR BOOT SCREEN.

[root@alex] vi /tftpboot/linux-install/pxelinux.cfg/default

now configure this file as you configure in ( /tftpboot/linux-install/msgs/boot.msg ). so that your pxe clients can boot according to our given parameter like.

default local

timeout 10000

prompt 1

display msgs/boot.msg

F1 msgs/boot.msg

F2 msgs/general.msg

F3 msgs/expert.msg

F4 msgs/param.msg

F5 msgs/rescue.msg

F7 msgs/snake.msg

label local

localboot 1

label 0

localboot 1

label IUOS

kernel RHEL-5.2—UNATTENDED/vmlinuz

append initrd=RHEL-5.2—UNATTENDED/initrd.img ramdisk_size=0 ks=ftp://172.24.0.2/pub/ks.cfg

label IAOS

kernel RHEL-5.2—ATTENDED/vmlinuz

append initrd=RHEL-5.2—ATTENDED/initrd.img ramdisk_size=7177 method=ftp://172.24.0.250/pub ip=dhcp

label IUGOS

kernel RHEL-5.2—UNATTENDED-GRAPHICS/vmlinuz

append initrd=RHEL-5.2—UNATTENDED-GRAPHICS/initrd.img ramdisk_size=7177 ks=ftp://172.24.0.250/pub/ksX11.cfg

label TEST

kernel RHEL-5.2/vmlinuz

append initrd=RHEL-5.2/initrd.img ramdisk_size=7177 method=ftp://172.24.0.250/pub ip=dhcp

NOTE :- NOW YOUR PXE CLIENTS CAN BOOT ACCORDING TO YOUR PARAMETER. MEANS BYE THE TYPING IUOS, IAOS, IUGOS, and TEST.

********************************************************************************

STEP 03 :- HOW TO CHANGE SPLASH SCREEN OF PXE, BOOT MESSAGES OF PXE, AND INSTALLING PARAMETERS.   

[root@alex] cp -rv /var/ftp/pub/isolinux/ /tftpboot/linux-install

[root@alex] cp -rv /tftpboot/linux-install/isolinux.cfg /tftpboot/linux-install/pxelinux.cfg/default

[root@alex] cp -rv /tftpboot/linux-install/boot.msg :- edit your boot messages according to you.

[root@alex] cp -rv /tftpboot/linux-install/pxelinux.cfg/default

edit and add the parameters of installation according to you or according to boot.msg file.

NOTE 1 :- NOW YOUR PXE CLIENTS WILL BE ABLE TO BOOT FROM PXE SPLASH SCREEN.

NOTE 2 :- MAKE SURE ONE THING AFTER COPYING OF THIS FILE 

[root@alex ] cp -rv /tftpboot/linux-install/isolinux.cfg /tftpboot/linux-install/pxelinux.cfg/default.

NEVER TRY TO EDIT YOUR  /tftpboot/linux-install/pxelinux.cfg/default file by “pxeos” command or by “system-config-netboot”.

BUT IF YOU STILL WANT TO MODIFY YOUR “default” FILE. OPEN THE FILE BY VI OR VIM AND MODIFY THE FILE DIRECTLY.

PXE WITHOUT YUM

STEP 1:- CONFIGURE FTP 

[root@hunt] yum install vsftpd* -y

[root@hunt] setsebool -P ftp_home_dir on

[root@hunt] service vsftpd restart

[root@hunt] chkconfig vsftpd on

NOW COPY YOU FULL DVD OR CD IN A SEPRATE LOCATION AS

[root@hunt] mkdir /var/ftp/pub/RHEL-5.2

[root@hunt]cp -rvf /media/RHEL-5.2  /var/ftp/pub/RHEL-5.2

STEP 2 :- export the /var/ftp/pub and /var/ftp/pub/RHEL-5.2 directory via nfs

[root@hunt]vi /etc/exports

/var/ftp/pub                             *(rw,sync)

/var/ftp/pub/RHEL-5.2           *(rw,sync)

[root@hunt] service portmap restart

[root@hunt] service nfs restart

[root@hunt] chkconfig portmap on

[root@hunt] chkconfig nfs on

STEP 3 :- CONFIGURING TFTP FOR PXE

[root@hunt] rpm -ivh tftp-server-0.42-3.1.i386.rpm

NOTE :tftp-server is a xinetd dependent, if xinetd is not installed, you need to install xinetd rpm.

STEP 4 :- Start TFTP

[root@hunt] vi /etc/xinetd.d/tftp

replace the line disable = yes to disable = no.

[root@hunt] service xinetd restart

[root@hunt] chkconfig xinetd on

STEP 5:- CONFIGURING DHCP SERVER FOR PXE

ddns-update-style interim;

ignore client-updates;

allow booting;

allow bootp;

set vendorclass = option vendor-class-identifier;

subnet 192.200.1.0  netmask 255.255.255.0 {

option routers                          192.200.1.1;

option subnet-mask                 255.255.0.0;

option domain-name               “example.com”;

option domain-name-servers   192.200.0.201;

range dynamic-bootp              192.200.1.220 192.200.1.225;

default-lease-time                   21600;

max-lease-time                        43200;

filename                                 “/linux-install/pxelinux.0”;

# If we want the nameserver to appear at a fixed address

host ns {

hardware ethernet 00:0C:29:3D:D4:02;

fixed-address 192.200.1.225;

}

}

NOTE :- 192.200.1.214 is the ip address of my server on which I am configuring PXE.

After dhcpd.conf file is being configured, start dhcpd service and chkconfig it so that it start automatically on next boot.

[root@hunt] service dhcpd start

[root@hunt] chkconfig dhcpd on

STEP 6:- Now create your kickstart answer file

[root@hunt] system-config-kickstart

now your screen apear a kickstart wizard. configure your “ks.cfg” answer file according to your need. and save this file in /path/of/your/dvd/contain/directory.

[root@hunt] /var/ftp/pub/RHEL-5.2

Now Open the ks.cfg file do this entry to install all packages on your client.

[root@hunt] vi /var/ftp/pub/RHEL-5.2/ks.cfg :- come to the bottom position of file.

# Package Selections

%packages

@everything

To install all available packages.save and exit from file.

OR

# Package Selections

%packages

*

To install all availabe packages.save and exit from file.

STEP 7 :- PXE BOOT CONFIGURATION

The next step is to configure PXE boot configuration, so that tftp-server can serve client requests. This configuration can be done either through GUI tool

system-config-netboot or through CLI using pxeos command.

NOTE :-

  • system-config-netboot is available if system-config-netboot-0.1.45.1-1.el5.noarch.rpm is installed.
  • pxeos and pxeboot commands are available if system-config-netboot-cmd-0.1.45.1-1.el5.noarch.rpm is installed.
  • Both system-config-netboot-0.1.45.1-1.el5.noarch.rpm and system-config-netboot-cmd-0.1.45.1-1.el5.noarch.rpm are present on CD-2.
  • In this post I have mentioned how to use cmd tool to configure PXE boot, so, installation of system-config-netboot-0.1.45.1-1.el5.noarch.rpm is not required.Installation of system-config-netboot-cmd-0.1.45.1-1.el5.noarch.rpm will serve our purpose.

We need to execute the following command to configure PXE configuration as:

[root@hunt] pxeos -a -i “REDHAT-5.2” -p FTP -D 0 -s 172.24.0.2 -L /pub/RHEL-5.2/ -K ftp://172.24.0.2/pub/RHEL-5.2/ks.cfg RHEL-5.2

OR

[root@hunt] pxeos -a -i “REDHAT-5.2” -p NFS -D 0 -s 172.24.0.2 -L /var/ftp/pub/RHEL-5.2/ -K nfs:172.24.0.2:/var/ftp/pub/RHEL-5.2/ks.cfg RHEL-5.2

NOTE :- Where:

-a

add a new Operating System description

-i <description>

set short description not allowed with the Operating System.

-p <NFS | HTTP | FTP>

specify protocol used to access the Operating System

-D <1|0>

specify whether the config is diskless or not, zero specifies that it is not a diskless config

-s <server name or ip address>

specify the machine containing the Operating System

-L <netlocation>

specify the directory on the sever machine containing the Operating System.

-K <kickstart-directory-location>

specify the location of the kickstart file, this should be spec-ified as a kernel parameter.

://192.200.1.214/pub/RHEL-5.2/ks.cfg

<os-identifier>Specify the unique Operating System identifier, which is used as the directory

name in the /tftpboot/linux-install/directory.

After execution pxeos command, the initrd.img and vmlinuz files required are transferred from

/var/ftp/pub/rhel5.3/images/pxeboot/ to /tftpboot/linux-install/<os-identifier>

In our case <os-identifier> is RHEL-5.2

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>OR>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

system-conf-netboot               –> network install

Operating system identifier    –> /tftpboot/linux-install/

Description                              –> HELLO

Select protocol for installation–> ftp

Kickstart                                 –> /kickstart/ks.cfg

Server ip address                     –> 192.200.1.214:- ip of pxe server.

Location                                  –> /var/ftp/pub

STEP 08 :- Make Sure Reboot your PXE server After Configuration.

NOTE :- NOW YOUR CLIENT WILL BE ABLE TO BOOT FROM YOUR PXE SERVER.

ADDITIONAL STEPS

STEP 1:- HOW TO CHANGE BOOT MESSAGES OF PXE.               

[root@hunt] # vi  /tftpboot/linux-install/msgs/boot.msg

:- modify this file as you want to see on boot screen like.

09Welcome to 0cRed Hat Network09 Installer!07

0a

.-=-.          .–.

__        .’     ‘.       /  ” )

_     .’  ‘.     /   .-.   \     /  .-‘0ca

( \   / .-.  \   /   /   \   \   /  /    0c^0a

\ `-` /   \  `-‘   /     \   `-`  /

`-.-`     ‘.____.’       `.____.’

07

ENTER THE PARAMETER TO INSTALL YOUR OS ACCORDING TO YOUR NEED.

0.  Local Machine

IUOS. RHEL-5.2—UNATTENDED – REDHAT-5.2

IAOS. RHEL-5.2—ATTENDED – REDHAT-5.2

IUGOS. RHEL-5.2—UNATTENDED-GRAPHICS – REDHAT-5.2

TEST. RHEL-5.2 – REDHAT-5.2

STEP 2:- HOW TO CHANGE /tftpboot/linux-install/pxelinux.cfg/default FILE ACCORDING TO YOUR BOOT SCREEN.     

[root@hunt] vi /tftpboot/linux-install/pxelinux.cfg/default

now configure this file as you configure in ( /tftpboot/linux-install/msgs/boot.msg ). so that your pxe clients can boot according to our given parameter like.

default local

timeout 10000

prompt 1

display msgs/boot.msg

F1 msgs/boot.msg

F2 msgs/general.msg

F3 msgs/expert.msg

F4 msgs/param.msg

F5 msgs/rescue.msg

F7 msgs/snake.msg

label local

localboot 1

label 0

localboot 1

label IUOS

kernel RHEL-5.2—UNATTENDED/vmlinuz

append initrd=RHEL-5.2—UNATTENDED/initrd.img ramdisk_size=0 ks=ftp://192.200.1.214/pub/ks.cfg

label IAOS

kernel RHEL-5.2—ATTENDED/vmlinuz

append initrd=RHEL-5.2—ATTENDED/initrd.img ramdisk_size=7177 method=ftp://192.200.1.214/pub ip=dhcp

label IUGOS

kernel RHEL-5.2—UNATTENDED-GRAPHICS/vmlinuz

append initrd=RHEL-5.2—UNATTENDED-GRAPHICS/initrd.img ramdisk_size=7177 ks=ftp://192.200.1.214/pub/ksX11.cfg

label TEST

kernel RHEL-5.2/vmlinuz

append initrd=RHEL-5.2/initrd.img ramdisk_size=7177 method=ftp://192.200.1.214/pub ip=dhcp

NOTE :- NOW YOUR PXE CLIENTS CAN BOOT ACCORDING TO YOUR PARAMETER. MEANS BYE THE TYPING IUOS, IAOS, IUGOS, and TEST.

STEP 03 :- HOW TO CHANGE SPLASH SCREEN OF PXE, BOOT MESSAGES OF PXE, AND INSTALLING PARAMETERS.   

[root@hunt] cp -rv /var/ftp/pub/isolinux/[root@hunt] /tftpboot/linux-install

[root@hunt] cp -rv /tftpboot/linux-install/isolinux.cfg /tftpboot/linux-install/pxelinux.cfg/default

[root@hunt] cp -rv /tftpboot/linux-install/boot.msg :- edit your boot messages according to you.

[root@hunt] vi  /tftpboot/linux-install/pxelinux.cfg/default

edit and add the parameters of installation according to you or according to boot.msg file.

NOTE 1 :- NOW YOUR PXE CLIENTS WILL BE ABLE TO BOOT FROM PXE SPLASH SCREEN.

NOTE 2 :- MAKE SURE ONE THING AFTER COPYING OF THIS FILE

cp -rv /tftpboot/linux-install/isolinux.cfg /tftpboot/linux-install/pxelinux.cfg/default.

NEVER TRY TO EDIT YOUR /tftpboot/linux-install/pxelinux.cfg/default file by “pxeos” command or by”system-config-netboot”. BUT IF YOU STILL WANT TO MODIFY YOUR “default” FILE. OPEN THE FILE BY VI OR VIM AND MODIFY THE FILE MANUALLY.

About Alex Hunt

Hi All I am Manish Kumar Jha aka Alex Hunt. I am currently working in VMware Software India Pvt Ltd as Operations System Engineer (vCloud Air Operations). I have around 5 Years of IT experience and have exposure on VMware vSphere, vCloud Director, RHEL and modern data center technologies like Cisco UCS and Cisco Nexus 1000v and NSX. If you find any post informational to you please press like and share it across social media and leave your comments if you want to discuss further on any post. Disclaimer: All the information on this website is published in good faith and for general information purpose only. I don’t make any warranties about the completeness, reliability and accuracy of this information. Any action you take upon the information you find on this blog is strictly at your own risk. The Views and opinions published on this blog are my own and not the opinions of my employer or any of the vendors of the product discussed.
This entry was posted in Server Configuration. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s