Derwynd's Weblog

Derwynd's Weblog

Steps for installing Linux over Network with PXE and tftpboot setup – Centos

Steps for installing Linux over Network with PXE and tftpboot setup - Centos
=============================================================================

Scenario
========
To setup a NFS server containing the CentOS4 customized distro and then booting via
a PXE bootrom on the client side to get the required info for installing the OS via
kickstart.

Step 1: DHCP server setup
==========================
- Install the dhcp server rpms
dhcp-devel-3.0.1-12_EL.centos4
dhcp-devel-3.0.1-12_EL.centos4
dhcp-3.0.1-12_EL.centos4

- Create the /etc/dhcpd.conf file.  Following is the configuration given below

ddns-update-style none;
ignore client-updates;
allow booting;
allow bootp;
authoritative;

subnet 192.168.0.0 netmask 255.255.255.0 {

option routers                  192.168.0.1;
option subnet-mask              255.255.255.0;
option broadcast-address        192.168.0.255;
option domain-name              “example.com”;
option domain-name-servers      192.168.0.1;
option time-offset              -18000; # Eastern Standard Time
range dynamic-bootp 192.168.0.127 192.168.0.130;
default-lease-time 21600;
max-lease-time 43200;

class “pxeclients” {
match if substring(option vendor-class-identifier, 0, 9) = “PXEClient”;
next-server 192.168.0.120;
filename “linux-install/pxelinux.0″;
}
}

- chkconfig –level 2345 dhcpd on
- service dhcpd restart

STEP 3: Configure NFS server
============================

- I have copied the base dir of the Distro (ie CD 1 and in the RPM folder all rpms of remaining cd 2,3,4…) to /data dir.  I my case i called it
“custom-install” dir
- Edit /etc/exports and add the following line
/data/custom-install        *(rw,sync,no_root_squash)
- service nfs restart
- service portmap restart

For Security related purpose edit /etc/hosts.allow and /etc/hosts/deny to limit the
connection to specific ip addresses

STEP 4: Configure TFTP server
==============================
- Install the syslinux, redhat-config-netboot, and tftp-server rpms
- Enable the tftp server in /etc/xinetd.d/tftp and changing the “disable” line from
“yes” to “no.”
- chkconfig –level 345 tftp on
- service xinetd restart
- Next step is to copy the files necessary to start the installation to the tftp
server so they can be found when the client requests them. The tftp server is
usually the same server as the network server exporting the installation tree.

- Type system-config-netboot on the command prompt
- 1st time when u start, select “Network Install” from the First Time Druid
OR

select Configure => Network Installation from the pulldown menu, and then click Add.

Enter the following in the fields:

- Operating system identifier - CentOS4

Provides a unique name using one word to identify the Linux version and variant. It
is used as the directory name in the /tftpboot/linux-install/ directory.

- Description - CentOS4 install

- Select Protocol for installation - NFS

- Kickstart - nfs:192.168.0.120:/data/custom-install/ks.cfg - Path to your kickstart
file

- Server IP address - 192.168.0.120 - Where UR NFS is residing

- Location - /data/custom-install

-  After clicking OK, the initrd.img and vmlinuz files necessary to boot the
installation program are transfered from images/pxeboot/ in the provided
installation tree to /tftpboot/linux-install//  on the tftp server

= CentOS4 - Given above

- The Directory /tftpboot/linux-install/CentOS4 contains 3 files

initrd.img
vmlinuz
ks.cfg

- Contents of the ks.cfg as as follows
#use NFS installation media
nfs –server 192.168.0.120 –dir /data/custom-install

In this way you can create a Menu for installation of different linux OSes by
specifying a diff  and pointing to different dirs.

Using the command line tool to do the above using pxeos

pxeos -a -i “” -p  -D 0 -s client.example.com -L
-k  -K

Substitue the respective values

STEP 4: Editing the default tftpboot server files
==================================================

Edit the /tftpboot/linux-install/pxelinux.cfg/default file and do the required
changes as show below:

default centos
timeout 100
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 centos
kernel CentOS4/vmlinuz
append initrd=CentOS4/initrd.img ramdisk_size=7000
ks=nfs:192.168.0.120:/data/custom-install/ks.cfg

STEP 5: Editing the main ks.cfg for installation
================================================

In the main ks.cfg of the distro change the install method to NFS

Eg:

In /data/custom-install/ks.cfg

nfs –server 192.168.0.120 –dir /data/custom-install

STEP 6: Checking for the installation
=====================================

Boot the PXE enabled client machine and check if the client get the IP via DHCP and
present a menu for installation

November 10, 2008 Posted by | Uncategorized | Comments Off on Steps for installing Linux over Network with PXE and tftpboot setup – Centos

RHEL4 Single DVD

################ Creation Of SINGLE DVD from ISO or CD’s ####################
# Install base system on IDE HD with RHEL4
# The same procedure can be used for Contos/Fedora or any redhat based system
# Make sure your base system and the rpms required are of that system
# Install the following RPM’s from disk
anaconda-10.1.1.13-1
anaconda-help-10.1.0-1
anaconda-product-4-1AS
busybox-anaconda-1.00.rc1-5
anaconda-runtime-10.1.1.13-1
comps-4AS-0.20050107
comps-extras-10.1-1
# If ISO are present mount the ISO onto one partion
# Else Dump the files from the 4 cd’s into /mnt/disk[no] partitions
# eg :
mkdir -p /mnt/disk{1,2,3,4}
mount -o loop RHEL4_Disk1.iso /mnt/disk1
mount -o loop RHEL4_Disk2.iso /mnt/disk2
mount -o loop RHEL4_Disk3.iso /mnt/disk3
mount -o loop RHEL4_Disk4.iso /mnt/disk4

# We now copy all the files from the directories to a single directory:
# My directory structure was /usr/RHEL4/RHEL4_OneDVD

mkdir -p /usr/RHEL4/RHEL4_OneDVD
cp -ar /mnt/disk1 /usr/RHEL4/RHEL4_OneDVD
cp -ar /mnt/disk{2,3,4}/RHEL4/RPMS/* /usr/RHEL4/RHEL4_OneDVD
cp /mnt/disk1/.discinfo /usr/RHEL4/RHEL4_OneDVD
=============================================================

PYTHONPATH=/usr/lib/anaconda /usr/lib/anaconda-runtime/pkgorder /usr/RHEL4/RHEL4_OneDVD RHEL4 > /usr/RHEL4/pkgorder

# This creates a list of files in the order it needs to install them
# in the file /data/isobuild/pkgorder Sometimes an occasional
# RPM will not provide the information anaconda needs. You can edit
# the file manually and insert your RPMs at the end.
# Ignore the errors during this process
=============================================================
# Next we need to generate the dependency file:
/usr/lib/anaconda-runtime/genhdlist –fileorder /usr/RHEL4/pkgorder /usr/RHEL4/RHEL4_OneDVD/

# No Errors after this step
=============================================================

# Building the DVD iso
# Now to build the iso:

cd /usr/RHEL4/RHEL4_OneDVD/
chmod a+w isolinux/isolinux.bin

mkisofs -r -T -J -V “Custom RHEL4 Build” -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /usr/RHEL4/ISOs/RHEL4.iso /usr/RHEL4/RHEL4_OneDVD/

# This Generates the RHEL4 iso in /usr/RHEL4/ISOs/RHEL4.iso

=============================================================

# Now we can burn the image to the DVD. I assume the DVD writer is already
# set up on your system. Better Usr Nero to burn the iso /usr/RHEL4/ISOs/RHEL4.iso

November 10, 2008 Posted by | Uncategorized | Comments Off on RHEL4 Single DVD