{"id":706,"date":"2010-05-13T00:45:40","date_gmt":"2010-05-12T22:45:40","guid":{"rendered":"http:\/\/raftaman.net\/?p=706"},"modified":"2022-01-29T23:20:53","modified_gmt":"2022-01-29T21:20:53","slug":"setting-up-a-tftp-boot-environment-for-fedora","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=706","title":{"rendered":"Setting up a tftp boot environment for Fedora"},"content":{"rendered":"\n<p>I already wrote a little article, how to boot a <a href=\"https:\/\/possiblelossofprecision.net\/?p=491\">FreeDos via PXE<\/a>. Of course, you can boot Fedora (or CentOS) in like manner.<br \/>\n<!--more--><\/p>\n<h2>0. Setting up the dhcp server<\/h2>\n<p>Depending on what actual dhcp server implementation you are using (ISC dhcp etc.)  ymwv here anyway. So instead of walking you through this this step-by-step, I suggest you have a look at the <a href=\"http:\/\/syslinux.zytor.com\/wiki\/index.php\/PXELINUX#How_Should_I_Setup_My_DHCP_server.3F\">sylinux wiki<\/a> or just ask google.<\/p>\n<h2>1. Installing packages<\/h2>\n<p>Well, this one is rather easy. Just pull the packages from your yum-repo:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\nyum install xinetd tftp-server syslinux\r\n<\/pre>\n<h2>2. Configuring xinetd<\/h2>\n<p>Enabling xinetd (and tftp) is no big deal:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\nchkconfig xinetd on\r\nchkconfig tftp on\r\n<\/pre>\n<p>You may want to find out (or adjust) the tftp root path. Simply edit <code>\/etc\/xinetd.d\/tftp<\/code> with your favourite editor and change the line that says <code>server_args = -s \/tftpboot<\/code>. Make sure, the service is restarted after you changed something in the configuration file.<\/p>\n<h2>3. Setting up boot environment<\/h2>\n<p>This is the really beautiful part. Since the initial ramdisk and the kernel is different for every Fedora (even CentOS) release, I wrote a little script to automate this task:<\/p>\n<pre class=\"brush: bash; collapse: true; light: false; title: ; toolbar: true; notranslate\" title=\"\">\r\n#\/bin\/bash\r\n\r\n  # setupTftpboot\r\n  \r\n  # common source and destination\r\n  CMNSRC=rsync:\/\/mirrors3.kernel.org\/fedora\/releases\/12\/Fedora\/i386\/os\/isolinux\/\r\n  #CMNSRC=rsync:\/\/mirrors3.kernel.org\/centos\/5.4\/os\/i386\/isolinux\/\r\n  CMNDST=$1\r\n  PXECFGDIR=pxelinux.cfg\r\n  PXECFGFILE=default\r\n  \r\n  # options\r\n  RSYNCOPTS=&quot;-avh --progress --stats --exclude=isolinux.bin&quot;\r\n  \r\n  # syslinux\r\n  SYSLINUXSRC=http:\/\/www.kernel.org\/pub\/linux\/utils\/boot\/syslinux\/\r\n  SYSLINUXVER=syslinux-3.86\r\n  \r\n  # files\r\n  WGET=\/usr\/bin\/wget\r\n  MKDIR=\/bin\/mkdir\r\n  MV=\/bin\/mv\r\n  RSYNC=\/usr\/bin\/rsync\r\n\r\n\r\n  function usage() {\r\n        echo &quot;sh $0 &lt;targetdir&gt;&quot;\r\n  }\r\n\r\n  if &#x5B; -z $CMNDST ]\r\n  then\r\n     usage\r\n     exit 0\r\n  fi\r\n  \r\n  if &#x5B; ! -d $CMNDST ]\r\n  then\r\n     echo &quot;Error $CMNDST does not exist&quot;\r\n     exit 0\r\n  fi\r\n  \r\n\r\n   $RSYNC $RSYNCOPTS $CMNSRC $CMNDST\r\n  \r\n  if &#x5B; ! -d $CMNDST\/$PXECFGDIR ]; then $MKDIR -p $CMNDST\/$PXECFGDIR; fi\r\n  $MV $CMNDST\/isolinux.cfg $CMNDST\/$PXECFGDIR\/$PXECFGFILE\r\n\r\n  $WGET -O - $SYSLINUXSRC\/$SYSLINUXVER.tar.gz | tar xvz $SYSLINUXVER\/core\/pxelinux.0 -O&gt;$CMNDST\/pxelinux.0\r\n\r\n<\/pre>\n<p>The usage is quite self-explaining:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\nsh setupTftpboot &lt;targetdir&gt;\r\n<\/pre>\n<p><code>&lt;targetdir&gt;<\/code> could be <code>\/var\/lib\/tftpboot<\/code> (on Fedora > 9 (<a href=\"https:\/\/bugzilla.redhat.com\/show_bug.cgi?id=449264\">see Bugzilla<\/a>)) or something like <code>\/var\/lib\/tftpboot\/Fedora\/12\/<\/code> for a multi-distribution tftp setup.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I already wrote a little article, how to boot a FreeDos via PXE. Of course, you can boot Fedora (or CentOS) in like manner.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[13,7,85],"class_list":["post-706","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-centos","tag-fedora","tag-pxe"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/706","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=706"}],"version-history":[{"count":15,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/706\/revisions"}],"predecessor-version":[{"id":1824,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/706\/revisions\/1824"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=706"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=706"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=706"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}