How-to : Basic PXE infrastructure #4 – NFS server installation and setup on CentOS

pxe

Introduction

This is the fourth and last post from the How-to build a basic PXE infrastructure series, in which we are going to setup the NFS server. The NFS server goal is to provide PXE client with required distribution files, such as packages (rpm for a rpm based distro) as well as any other files that are to be ran after the initial distribution installation, e.g : the post-installation script(s).

The NFS server setup is quite easy, as it might already been up on your server.

You might want to check this post for more info about nfs.

Reminder : The goal of this series is, again, to setup a minimalist working PXE infrastructure, we will see an advanced setup that uses kickstart and complex automated installation later, let’s start by the beginning !

 

 

The other post from this series

 

 

1) Install the nfs server

Using the CentOS distribution packages manager (yum) we just have to issue the following command.

yum install nfs-utils.x86_64

 

2) Setup the nfs server for PXE process

As said in the introduction, the nfs server role is to provide the client with distribution files and post-installation files, if any.

In order to achieve this goal we only have to populate the /etc/exports file which is responsible for “exporting” (yep, you guessed it, i know !) the desired directory. In this case let’s use a meaningful directory such as : Distributions.

2.1 Create the exported tree structure

First create the upper level directory (create your own distributions tree, but keep in mind that you’d better be tidy and well organized, because when you will have to create custom distributions and so on it will become nothing but a big mess!) :

mkdir /Distributions/

Then create the distribution specific tree :

mkdir /Distributions/CentOS6.2-x86_64

Now we still have to “populate” the export file

echo "/Distributions  *(ro,no_root_squash)" >> /etc/exports

 

2.2 Copying distributions files to the exported directory

Let’s now put the distribution files into the correct tree.

Download (or get your hand by any means) the distribution DVD / CDs (CentOS can be downloaded from source to be chosen here).

Mount the DVD and copy its content to your nfs exported dir (i am here using an ISO) :

mount -o loop -t iso9660 /media/sf_Vbox_SHARED/CentOS-6.2-x86_64-bin-DVD1.iso /mnt/
cp -rvpf /mnt/* /Distributions/CentOS6.2-x86_64/

Warning : Make sure you do have the .treeinfo and .discinfo copied too (they are hidden files) otherwise you will not be able to get it works. You will be facing an error about the installation tree etc…

Now we got everything we need.

 

Note about the current state of our PXE infrastructure : At this point we do have something that works, but we still have some steps to get an (basic) automated installation process, as an example you do have to specify the nfs server IP address and distribution root path, as seen in this screenshot :

nfs server

The next steps will perfect this using kickstart files… Let’s use what we have for now, and polish it up.

 

2.3 NFS setup informations

The correct path that needs to be entered at the above step is the nfs root that contains the distributions files, in our example (we created the /Distributions/CentOS6.2-x86_64 subtree at section 2.1 Create the exported tree structure) as :

NFS server name : <enter_here_the_IP_address_or_DNS_name_of_your_NFS_server> e.g : 192.168.33.222
CentOS directory : <enter_here_the_path_to_the_CentOS_directory> e.g : /Distributions/CentOS6.2-x86_64
NFS mount options : This is optional and greatly depends on your local network and policies, you can leave this empty or use the default ro (read only) option

 

2.4 Last steps to perfect the nfs setup

Once you did the previous steps you may have something that works, for the sake of well done job, we still have some few steps to perform.

Enable the nfs services on startup :

chkconfig nfs on

You should now be facing this screen :

centos

This is where you will, manually, setup your PXE installation…

To avoid this manual part we need to :  Create the kickstart file !

 

3) Conclusion

We now have a working PXE infrastructure, but this is only the beginning ! Follow up to the next post of the series.

Tagged on: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site supports SyntaxHighlighter via WP SyntaxHighlighter. It can highlight your code.
How to highlight your code: Paste your code in the comment form, select it and then click the language link button below. This will wrap your code in a <pre> tag and format it when submitted.