Dec 20, 2012

Install Linux Through Windows Deployment Server (WDS) - Good Bye Kickstart

This article going to show you how to setup automated installation for Linux distros (RHEL, Fedora, CentOS), similar to how we deploy our Windows installations via PXE. This article wont cover the initial WDS installation process.



What you will need:
  • Windows server running WDS (and working via DHCP).
  • A recent copy of SYSLINUX (extracted to a folder somewhere on the WDS server).
  • An HTTP or anonymous FTP server to hold your installation media.
Currently when I boot my computer with PXE enabled, I am prompted to hit F12 for network boot. When I press F12, I am prompted by “Windows Boot Manager” to select my boot images that I setup in WDS. Since I can’t install Linux images directly using the WDS interface, an alternative boot image is necessary. 

That is where SYSLINUX/PXELINUX takes over.

Pre-Setup:
  • Create the necessary directory structure inside the WDS RemoteInstall directory (this was specified during the WDS installation).
  • Inside the x86 folder (RemoteInstall\Boot\x86\), create the following folders
    • img
    • knl
    • pxelinux.cfg

Preparing Installation Media:
Setup an FTP server to hold your installation media (HTTP works also): Currently the average size of a Red Hat distribution is about 5GB, so make sure the server you select will have the necessary disk space. You will need separate installation media for both distribution specific 32bit and 64bit installs. If you want Fedora 9, CentOS 5.2, and RHEL 5.2 images (both 32bit and 64bit), that will be about 30GB. As long as you’re not archiving old distributions, this should not be an issue.
On my FTP server in the root/path, I created a directory for each of my installation media. Also, creating a standard naming convention will help with editing the configuration files later and any case sensitivity issues. Example: My directory names are DistroVersion_arc (Fedora9_32bit), as you will see later on.
Copy the entire installation dvd media to the corresponding directories you created (not the .iso, extract its entire contents).
In the FTP root directory for the media you copied, create a kickstart file (ks.cfg). (Example: ftp://ftpserver.domain.com/Fedora9_32bit/ks.cfg) I have included example kickstart files at the bottom of this article.
Once you have copied the installation media for a distro to your FTP server, you need to copy 2 files from that specific distro media to your WDS server.
From the (installation media\images\pxeboot) directory, copy the following:
Copy vmlinuz to the following directory on the WDS server (RemoteInstall\Boot\x86\knl\). Rename the file to an identifying name such as vmlinuz-fedora9-32bit.
Copy initrd.img to the following directory on the WDS server (RemoteInstall\Boot\x86\img\). Rename the file to an identifying name such as initrd-fedora9-32bit.
When it comes time to configure your option menus, you will need to specify these files for each version/distro you plan on making available.

Configuring WDS

From inside the downloaded SYSLINUX archive, copy the following files:
    • pxelinux.0 from the (syslinux\core) directory to your (RemoteInstall\Boot\x86\) directory on the WDS server.
    • menu.c32 and vesamenu.c32 from the (syslinux\com32\menu) directory to your (RemoteInstall\Boot\x86\) directory on the WDS server.
Inside the (RemoteInstall\Boot\x86\) directory, create copies of the following files, rename them accordingly (you can copy paste then rename):
Make a copy of pxeboot.n12, save it as pxeboot.0
Make a copy of abortpxe.com, save it as abortpxe.0
Inside (RemoteInstall\Boot\x86\pxelinux.cfg\), create a file called default. This will be the initial menu you see during PXE boot, edit the file and give it the following contents: 

# Default boot option to use
DEFAULT menu.c32
TIMEOUT 50
# Prompt user for selection
PROMPT 0
# Menu Configuration
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
MENU TITLE Main Menu
 

# Menus
 

# Windows
LABEL Windows
MENU LABEL Windows Installer
KERNEL pxeboot.0
 

LABEL CentOS 6.0 32bit
MENU LABEL CentOS 6.0 32bit
KERNEL knl/vmlinuz-centos6-32bit
APPEND initrd=img/initrd-centos6-32bit.img ks=ftp://192.168.16.1/Kickstart/centos6-ks.cfg
 

# Windows
LABEL Exit
MENU LABEL Exit
KERNEL abortpxe.0


Lastly, set WDS to use the pxelinux.0 boot image. If you need to get to the normal WDS boot image, you can use the Windows Installer option created in your default menu.
Open Windows Deployment Services on your WDS server. Right click your server -> Properties. Under the Boot tab, set the Default boot program for x86 architecture (Boot\x86\pxelinux.0), or browse to the pxelinux.0 file we created earlier. You may leave the other architectures alone or change as you see fit.
For Windows 2008 R2 installations you must set the bootimage via command-line as followed:
  • wdsutil /set-server /bootprogram:boot\x86\pxelinux.0 /Architecture:x86 
  • wdsutil /set-server /bootprogram:boot\x86\pxelinux.0 /Architecture:x64
  • wdsutil /set-server /N12bootprogram:boot\x86\pxelinux.0 /Architecture:x86 
  • wdsutil /set-server /N12bootprogram:boot\x86\pxelinux.0 /Architecture:x64


Example Kickstart File:

Here is an example kickstart file for Fedora 9. For each new distro I normally perform a cd install with my desired options, then use the resulting /root/anaconda-cfg.ks for assistance. Note that the kickstart file specifies the FTP path of your installation media that you created in the beginning of this article.
install 
text
url --url ftp://ftpserver.mydomain.com/Fedora9_32bit
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp 
rootpw --iscrypted $1$X.qPQYdk$L.YRbuORBd30 
firewall --disabled
authconfig --enableshadow --enablemd5 --passalgo=sha512
selinux --disabled
timezone America/Chicago
bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
clearpart --all --drives=sda
part /boot --fstype ext3 --size=1000
part swap --size=2048
part / --fstype ext3 --size=1 --grow
%packages
@editors
@development-tools
@text-internet
@core
@base
@hardware-support
@admin-tools
grub
openldap
openldap-devel
openldap-client
net-snmp* 
ntp

Post a Comment

 
TECH SUPPORT © 2012-2016