<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     >
  <channel>
    <title>Topdog.za.net</title>
    <link>http://www.topdog.za.net</link>
    <description>A bored sysadmin</description>
    <pubDate>Fri, 26 Feb 2016 10:06:56 GMT</pubDate>
    <generator>Blogofile</generator>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>How to setup a network install server</title>
      <link>http://www.topdog.za.net/2008/01/29/how-to-setup-a-network-install-server</link>
      <pubDate>Tue, 29 Jan 2008 20:53:00 SAST</pubDate>
      <category><![CDATA[Kickstart]]></category>
      <category><![CDATA[Howto]]></category>
      <category><![CDATA[RHEL]]></category>
      <category><![CDATA[Centos]]></category>
      <category><![CDATA[Linux]]></category>
      <guid isPermaLink="true">http://www.topdog.za.net/2008/01/29/how-to-setup-a-network-install-server</guid>
      <description>How to setup a network install server</description>
      <content:encoded><![CDATA[<p>This howto will describe how to setup Linux network install server. We will be
using <a href="http://en.wikipedia.org/wiki/Preboot_Execution_Environment">pxeboot</a>
and dhcp to allow for bare metal installation without the need for physical
media. Network install servers are essential when large numbers of machines
need to be setup or in cases where machines are frequently setup as well as
for deployment of xen virtual machines.</p>
<p>I have used Centos 5.1 in this howto however i am sure it can be adapted to
work with any other Linux distribution as the concepts remain the same. The
main components that i have used are the following.</p>
<ul>
<li>http server - apache</li>
<li>tftp server</li>
<li>dhcp server - isc dhcp</li>
<li>dns server - isc bind</li>
</ul>
<h2>Installation of software</h2>
<p>I will assume that you already have an installed bare bones Centos 5.1 system
with the hostname server1.example.com. During this howto we will be using the
fictitious domain example.com please substitute with your own domain, and the
192.168.1.0/24 network</p>
<h3>DNS server</h3>
<p>For this how to we will be using a DNS server because our media is stored on a
virtual host, however it is possible to skip DNS setup and just use ip
addresses if the installation servers http server is only going to be used to
serve the media.</p>
<p>Install bind</p>
<pre><code># yum install bind bind-chroot
</code></pre>
<p>Configure bind and add the example.com zone, make the changes below to the file /var/named/chroot/etc/named.conf</p>
<pre><code>options {
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { any; };
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view single_view {
        match-clients      { any; };
        match-destinations { any; };
        recursion yes;
        include "/etc/named.rfc1912.zones";

        zone "example.com" {
                type master;
                file "data/example.com.hosts";
        };

        zone "1.168.192.in-addr.arpa" {
                type master;
                file "data/1.168.192.in-addr.arpa.hosts";
        };
};
</code></pre>
<p>Add this to the file /var/named/chroot/var/named/data/example.com.hosts</p>
<pre><code>$ttl 38400
@       IN      SOA     server1.example.com. root.example.com. (
                        2008012900
                        10800
                        3600
                        604800
                        38400 )
@       IN      NS      server1.example.com.
server1 IN A 192.168.1.2
kickstart IN A 192.168.1.2
</code></pre>
<p>Add this to the file /var/named/chroot/var/named/data/1.168.192.in-addr.arpa.hosts</p>
<pre><code>$ttl 38400
@       IN      SOA     server1.example.com. root.example.com. (
                        2008012900
                        10800
                        3600
                        604800
                        38400 )
@       IN      NS      server1.example.com.
2 IN PTR server1.example.com.
</code></pre>
<p>Setup bind to start at boot</p>
<pre><code># chkconfig --level 345 named on
# service named start
</code></pre>
<h3>DHCP server</h3>
<p>We need a dhcp server to allow for pxebooting and automatic assignment of
network parameters.</p>
<p>Install dhcp server</p>
<pre><code># yum install dhcp
</code></pre>
<p>Configure the dhcp server make changes to /etc/dhcpd.conf to look like below</p>
<pre><code>option domain-name-servers 192.168.1.2;
allow booting;
allow bootp;

next-server 192.168.1.2;
filename "pxelinux.0";

subnet 192.168.1.0 netmask 255.255.255.0
{
        range 192.168.1.50 192.168.1.250;
        allow unknown-clients;
        ignore client-updates;
}
</code></pre>
<p>Enable dhcp server to start at boot</p>
<pre><code># chkconfig --level 345 dhcpd on
# service dhcpd start
</code></pre>
<h3>Tftp server</h3>
<p>The tftp server is used to serve the boot images that are required to pxe boot
the machines to be installed.</p>
<p>Install tftp server</p>
<pre><code># yum install tftp-server
</code></pre>
<p>Configure tftp-server to start at boot</p>
<pre><code># chkconfig --level 345 tftp-server on
</code></pre>
<p>Copy syslinux image to tftp server directory</p>
<pre><code># cp /usr/lib/syslinux/pxelinux.0 /tftpboot
</code></pre>
<p>Create pxeboot directory structure</p>
<pre><code># mkdir /tftpboot/{pxelinux.cfg,msgs,os}
</code></pre>
<p>Start tftp server</p>
<pre><code># service xinetd restart
</code></pre>
<h3>Http server</h3>
<p>The http server is used to serve our install tree</p>
<p>Install apache</p>
<pre><code># yum install httpd
</code></pre>
<p>Configure virtual hosts, Since i need to allow for the server to be used for other purposes i am going to setup virtualhosts. The first virtual host is the default virtual host and the second one is the one that will be serving our network install. Edit the file /etc/httpd/conf/httpd.conf and add the following.</p>
<pre><code>NameVirtualHost *:80
&lt;VirtualHost *:80&gt;
   Servername server1.example.com
&lt;/VirtualHost&gt;
&lt;VirtualHost *:80&gt;
   Servername kickstart.example.com
   DocumentRoot /srv/www
   ErrorLog logs/kickstart.example.com-error_log
   CustomLog logs/kickstart.example.com-access_log common
   &lt;Directory /srv/www/&gt;
   Options +Indexes
   &lt;/Directory&gt;
&lt;/VirtualHost&gt;
</code></pre>
<h2>Setup distributions</h2>
<p>You can setup as many distributions as you want, i will be setting up Centos
to serve as an example on how it is done.</p>
<h3>Centos 5.1</h3>
<p>Create directories to hold the install tree</p>
<pre><code># mkdir -p /srv/www/centos/5.1/os/i386
</code></pre>
<p>Copy files from the DVD or CD's</p>
<pre><code># mount /media/cdrom
# cp /media/cdrom/* /srv/www/centos/5.1/os/i386
</code></pre>
<p>Create the directory to hold pxe boot images</p>
<pre><code># mkdir /tftpboot/os/centos_5.1
</code></pre>
<p>Copy pxeboot images to server</p>
<pre><code># cp /media/cdrom/images/pxeboot/{vmlinuz,initrd.img} /tftpboot/os/centos_5.1
</code></pre>
<p>Create a minimal kickstart to point to http installation, create file /srv/www/centos_5.1.ks and add the following</p>
<pre><code>install
url --url http://kickstart.example.com/centos/5.1/os/i386/
</code></pre>
<p>Add Centos 5.1 to tftpboot menu, edit the file /tftpboot/pxelinux/default and add the following</p>
<pre><code>default centos5.1
prompt 1
timeout 600
display boot.msg

label centos5.1
        kernel os/centos_5.1/vmlinuz
        append ks=http://kickstart.example.com/centos_5.1.ks initrd=os/centos_5.1/initrd.img
</code></pre>]]></content:encoded>
    </item>
  </channel>
</rss>
