Showing posts with label PXE Server. Show all posts
Showing posts with label PXE Server. Show all posts

Monday, 13 April 2015

SLES 11 - Complete PXE Server configuration to install SuSE Liunx Enterprise Server 11

Hello Friends

Its been long time i did not put any contents in my blog. I was doing research in some interesting stuffs in linux and also busy with work. This time i am coming up with SuSE Linux Enterprise Server 11 not with Redhat. ! 
Let us discuss about how do we configure PXE server to install SuSE Linux Enterprise server OS into Clients. Similar post on RHEL 7 can be found on the following link : Complete Guide for PXE Server configuration in RHEL 7.0

Breaking down the task to configure PXE Server, Here is the list :

1. DHCP server  ( To provide IP address to client )
2. Apache2 Server configuration ( To transfer the DVD image to Client for OS installation)
3. TFTP server configuration ( To Transfer the PXE kernel and other supporting files to Client System )
Check the version of SUSE Linux using the following command.

suse release





Let us configure DHCP Server first. for that we need to install the dhcp-server package into server.
I am using Zypper to install dhcp server pakage. or else you could run #yast dhcp-server to install and configure dhcp server.

# zypper in dhcp-server
dhcp-server package installation
Now configure dhcp server. edit the /etc/dhcpd.conf and update the following entries.
(Move original /etc/dhcpd.conf file to some other name and create new dhcpd.conf with the following entries.)
Here IP range is from 192.168.1.10 to 192.168.1.20

default-lease-time 14400;
ddns-update-style none;
subnet 192.168.1.0 netmask 255.255.255.0 {
  range dynamic-bootp 192.168.1.10 192.168.1.20;
  default-lease-time 14400;
  max-lease-time 172800;
  next-server 192.168.1.3;
  filename "pxelinux.0";
}











update the /etc/sysconfig/dhcpd file with the following entries.
DHCPD_INTERFACE="eth0"
dhcp startup








Restart the dhcpd service and enable it on start-up using the following command.
# rcdhcpd restart
#chkconfig --level 35 dhcpd on

dhcp service startup









Step1 is finished. Now lets configure http to share the DVD image.install the apache2 package using the following command.

# zypper in apache2



Mount the SuSE Linux DVD into /srv/www/suse-os/dvd directory.
#mkdir -p /srv/www/suse-os/dvd
#mount /dev/sr0 /srv/www/suse-os/dvd


dvd mount







DVD is mounted, make the mount point persistent across reboot. add the following entry in /etc/fstab
/dev/sr0             /srv/www/suse-os/dvd       iso9660 defaults        0 0

I am going to configure a virtual host in apache to provide the DVD image.
create a file named suse-os.conf under /etc/apache2/vhosts.d/ and add the following lines into suse-os.conf file.

<VirtualHost *:80>
    ServerAdmin vinil@vinizlinux.com
    ServerName pxe-suse.vinizlinux.com
    DocumentRoot /srv/www/suse-os
    <Directory "/srv/www/suse-os">
       Options Indexes FollowSymLinks
       AllowOverride None
       Order allow,deny
       Allow from all
    </Directory>

</VirtualHost>
vhost configuration


Start the apache using #rcapache2 start
rcapahe2 start

And enable the apache in startup using #chkconfig --level 35 apache2 on  and then check the apache in a web browser.


web browser















Now the final part  let us work on tftp part.
for configuring tftp we need to install the tftp package also we need the syslinux package which contains the pxelinux kernel to boot the client from PXE server.
Run the following command to install tftp and syslinux package.
# zypper in tftp syslinux
tftp syslinux pakage install

Edit the tftp configuration file /etc/xinetd.d/tftp and change the following line to "no".
 disable                 = no


create the tftpboot directory under / and create the pxelinux.cfg directory under /tftpboot
dir create

now copy the pxelinux.0 file to /tftpboot.

# cp /usr/share/syslinux/pxelinux.0 /tftpboot/
We need to copy some more supporting files for PXE boot for that we need to mount the SuSE OS DVD.

#mkdir -p /srv/www/suse-os/dvd

# mount  /dev/sr0 /srv/www/suse-os/dvd

This same mount point can be used in Apache for giving the OS image to PXE clients. cd to /srv/www/suse-os/dvd/boot/x86_64/loader/ directory where we have the kernel , initrd, boot tests etc.
# cd /srv/www/suse-os/dvd/boot/x86_64/loader/
# cp linux initrd bootlogo memtest message biostest /tftpboot/

Copy the isolinux.cfg file to /tftpboot/pxelinux.cfg/ as default
# cp isolinux.cfg /tftpboot/pxelinux.cfg/default


pxe linux








Now edit the default file and provide the installation source and method of installation. here i am using ssh based suse installation. you could use vnc or ssh to do installation. Entries in the default file is shown below.









































Now restart the xinetd services using the following command. and enable it on startup.
# rcxinetd start
#chkconfig --level 35 xinetd on

This installation is not fully automatic we need to give some inputs to complete the installation. for the automated installation we need to configure autoyast. i will put a new post on it later.
Now lets boot the client and check whether its able to boot or not. 
Yes !! Yes!! its able to boot from PXE Server

boot menu

Now type linux on the prompt it will start installation.
After sometime you will see the following screen to start installation. you need to connect this client from anywhere using ssh to provide inputs for finishing the installation.

Here we are using ssh -X , and  X is for X11/X.org forwarding. 
Let us connect the client and check the installation.

Now run yast on prompt it will open a GUI interface to start installation.
Follow the on-screen options and finish the installation.





That’s all! I will be coming up with few more interesting articles on Linux, till then stay tuned to Learn linux and don’t forget to add your valuable comments





Monday, 12 January 2015

Complete Guide for PXE Server configuration in RHEL 7.0

The Preboot Execution Environment (PXE) is an industry standard client/server interface that allows networked computers that are not yet loaded with an operating system to be configured and booted remotely by an administrator.
Let us work on RHEL 7.0 to configure a PXE Server to boot and install RHEL 7.0 OS in the client configuration. 
First setup Static IP Address for PXE server, this is important. you can edit the network configuration file or use nmcli command to setup.For setting up the static IP address click here to know more.


ip add show
Check the details with nmcli command more information about the Network settings.
# nmcli con show eno16777736
nmcli more info
Install vsftpd and createrepo packages into the server using YUM. this is to configure the software repo.
# yum install vsftpd createrepo
yum installation of vsftpd createrepo
Mount the RHEL 7.0 DVD in the server to copy the packages required to configure software repo.
# mount -t iso9660 /dev/sr0 /mnt

create a directory /rhel7/dvd/ under  /var/ftp/pub to hold the dvd packages. and copy the DVD contents to this directory.
# mkdir -p /var/ftp/pub/rhel7/dvd/
# cp -rv /mnt/* /var/ftp/pub/rhel7/dvd/
copy packages from dvd to pxe
create yum client configuration file under /etc/yum.repos.d. Enter the following details.

yum client
For running group commands like grouplist, groupinstall we need to copy *-comps-Server.x86_64.xml and using this file we need to update the metadata again using the following commands.
# cd /var/ftp/pub/rhel7/dvd/repodata/
# cp 76a190afa1c59e14d3a03f9b03c3eee31df0099f1193528ebb87d4d493d2b686-comps-Server.x86_64.xml /var/ftp/pub/rhel7/dvd/group-comps-Server.x86_64.xml
# createrepo -vg /var/ftp/pub/rhel7/dvd/group-comps-Server.x86_64.xml /var/ftp/pub/rhel7/dvd/
yum group files

createrepo
Test the yum configuration and yum group file settings using yum grouplist command.
yum grouplist
Now install the Kickstart packages using YUM for configuring the kickstart input file.
yum install kickstart
Install Apache software into this server using YUM .
 # yum install httpd
 apache installation
Now create a soft link of /var/ftp/pub into /var/www/html directory so that you can access this repository and installation tree using FTP or HTTP Protocol.
# ln -s /var/ftp/pub/ /var/www/html/Update the SELINUX context for these directory using restorecon command.
# restorecon -Rv /var/ftp/pub/
# restorecon -Rv /var/www/html/
Start the service for vsftpd and httpd using following commands.
#systemctl start vsftpd
#systemctl start httpd
#systemctl enable vsftpd
#systemctl enable httpd
enabling services
Note: there is no firewalld and SELINUX running in my server.
Now create a kickstart file for unattended installation of RHEL 7.0 OS. to create kickstart unattended file run # system-config-kickstart utility. now you could see a window similar to the below. provide the required information and save it under /var/ftp/pub directory.
kickstart utility
Another way to create kickstart file to copy the /root/anaconda-ks.cfg file to /var/ftp/pub and edit according to your requirement. Here is my kickstart file.
ks.cfg

Now restart the vsftp and httpd services.
# systemctl restart vsftpd
# systemctl restart httpd
restart ftp and httpd
Check whether you are able to access the ks.cfg using http. use firefox or links to check it.
# links http://192.168.1.25/pub/ks.cfg
if its successful then you will get this screen.
ks.cfg links
Now we need to install the packages for PXE boot. Install syslinux, xinetd, tftp-server and dhcp using YUM.
# yum install syslinux xinetd tftp-server dhcp -y
pxe packages
create a directory pxe configuration directory named "pxelinux.cfg" in /var/lib/tftpboot.
 # mkdir /var/lib/tftpboot/pxelinux.cfg
pxelinux cfg directory
Now copy the "/usr/share/syslinux/pxelinux.0" to /var/lib/tftpboot directory.
# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
pxe boot kernel
Enable tftp service. edit the /etc/xinetd.d/tftp file and enable the xinetd configuration. this is used to provide pxe kernel to client.
tftp enable
Start and enable tftp server (xinetd) service. run the following commands.
# systemctl start xinetd
# systemctl enable xinetd
xinetd service startup
Now configure DHCP service . More information on DHCP server configuration please click here.
This is used to give the IP address to clients. To configure DHCP copy the sample configuration from /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example to /etc/dhcp/dhcpd.conf

# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf

dhcp client configuration
Now edit the configuration file /etc/dhcp/dhcpd.conf and add the following lines.
allow booting;
allow bootp;
authoritative;

# This is a very basic subnet declaration.

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.26 192.168.1.40;
  option routers 192.168.1.25;
  default-lease-time 21600;
  max-lease-time 43200;
}

# This declaration allows BOOTP clients to get dynamic addresses,
# which we don't really recommend.

subnet 192.168.1.0 netmask 255.255.255.0 {
  range dynamic-bootp 192.168.1.101 192.168.1.111;
  option broadcast-address 192.168.1.255;
  option routers 192.168.1.25;
  option domain-name "vinzlinux.com";
  default-lease-time 21600;
  max-lease-time 43200;
  filename "pxelinux.0";
  next-server 192.168.1.25;
}


dhcp server config
Restart the dhcpd service and enabled it using the following command.
# systemctl restart dhcpd
# systemctl enable dhcpd
dhcp service restart
Now copy the following files from RHEL 7.0 to /var/lib/tftpboot/ for creating the PXE server.
# cd /var/ftp/pub/rhel7/dvd/images/pxeboot/
# cp initrd.img /var/lib/tftpboot/
# cp vmlinuz /var/lib/tftpboot/
# cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/
# cd /var/ftp/pub/rhel7/dvd/isolinux/
# cp -rvf * /var/lib/tftpboot/

pxe files copied
Now create a PXE boot menu. create a file named "default" under /var/lib/tftpboot/pxelinux.cfg directory. and add the following lines.
default vesamenu.c32
timeout 600
display boot.msg
menu background splash.png
ONTIMEOUT local

MENU TITLE Vinil's PXE Menu

label linux
  menu label ^Install System from PXE
  kernel vmlinuz
  append initrd=initrd.img ks=http://192.168.1.25/pub/ks.cfg ksdevice=eno16777736 ip=dhcp

label local
  menu label Boot from ^local drive
  localboot 0xffff


pxe boot menu
Now restart the vsftpd , httpd and httpd service and not boot the client and check the configuration.
You could see a below screen in the PXE client machine.
pxe client menu
select it and you would see that it start installing the RHEL7.0 os on the client.
os installation
Thats all about the PXE server configuration. Hope you found this useful.