Thursday, January 20, 2011

Netboot on CarterFamily.ca network

Table of Contents:

  1. Installing NetBoot Server Step
  2. Starting up a NetBoot
  3. Installing Fedora
  4. Backing up Hard Drive
  5. Booting from a LiveOS
  6. Performing a manual Fedora Upgrade
Installing NetBoot Server Step

Currently I have various packages setup to install netboot on a network. However the key package CFG_NetBoot-DHCP may need to be customized depending on where you are.    Currently I only have files setup for my location (CFG_NetBoot-DHCP.noarch) and GCDS location (CFG_NetBoot-DHCP-192.168.noarch).   If you need one setup let me know.
CFG_NetBoot-Common.noarch
CFG_NetBoot-DHCP.noarch
CFG_NetBoot-DHCP-192.168.noarch
CFG_NetBoot-Fedora-f14.noarch
CFG_NetBoot-Register-fc13.noarch
CFG_NetBoot-Register-fc13-fs.noarch
CFG_NetBoot-Ubuntu-10.10.noarch
CFG_NetBoot-Ubuntu-fs-10.10-amd64.noarch
CFG_NetBoot-Ubuntu-fs-10.10-i386.noarch
CFG_NetBoot-dsl.noarch
CFG_NetBoot-freedos.noarch
CFG_NetBoot-gparted.noarch
CFG_NetBoot-reactOS.noarch

Just select the packages for the OS you wish to be able to boot into.

NOTE: Currently I have no steps for creating the /u2/Repositories directory. It's huge (+200G) I've been doing that manually and NFS mounting the drives where needed.   This is only needed for the Fedora install packages.  The other LiveCD type packages will still function without the repositories.

Starting Up a NetBoot

Most modern computers have netbooting (PXE) capabilities in the wired network card. -- wireless doesn't work for netbooting nor would you want it, you want something rock solid and fast --

On booting most bios screens have a boot menu or will say PXE boot. (Usually F12 or F10) You will need to consult the computer's manual to see how to enable network booting for your computer. As an alternative, if your computer doesn't support network booting, you can also netboot from a floppy, USB key or CD. Just burn one of these files and you can insert it into your computer:

[mcarter@liandra Output]$ rpm -ql gpxe-bootimgs.noarch
/usr/share/gpxe/gpxe.dsk  <-- disk drive/floppy boot
/usr/share/gpxe/gpxe.iso  <-- cdrom drive boot
/usr/share/gpxe/gpxe.usb  <-- usb key boot

When booting you will see a screen similar to this:

Booting
Boot Menu
Just select what OS or Installer you wish to use and it will start your computer.

Installing Fedora

To install Fedora select "Fedora F14" or the Latest version. This will bring you to the install menu:

From here there will be several options.

  • i386 is for 32 bit systems with less than 3.9 G of ram
  • i386-PAE is for 32 bit systems with more than 3.9 G of ram (but if you have more than 4 G of ram your CPU is probably 64 bit so you may want to consider the x86_64)
  • x86_64 is for 64 bit systems.   (Note: 64-bit installs are larger as they have both 32 and 64 bit components.  Also as of Jan 20th, 2011 there is no stable release of Adobe Flash for 64 bit machines.  It's currently in beta and should be release some time in 2011)
  • First menu option for each of the three types is a normal install. This will install a brand new system and give you the option of replacing the current hard drive or re-partitioning for a dual booting with your existing OS (please BACKUP your hard drive first).
  • Option (VNC) is a normal install like above but uses VNC for the screen so you can monitor from another computer.   (ie: if I'm doing 4 computers at once it's nice to use a single computer to monitor all 4 installs)
  • Option (Upgrade) is an upgrade so you can upgrade a previous version of Fedora to the latest version
Once you select your options you will start the installation process. During the install process you will be asked some basic questions:
Root Password

Hard Drive Setup
Formatting Hard Drive

Each process is controlled by a kickstart file and will install all of the software we most commonly use.  The install image requires about 15G, and this is loaded with games, productivity software and internet software to get you going. To add/remove software after the installation is complete just select the add/remove software menu item.  At last count the repository for i386 - Fedora 14 was 21G so there is plenty of software to keep you busy.

For hostname and machine specific setup it will show up on the first boot.  It's done this way so you can do an install, ship the computer, and the user can complete their personalization.

FirstBoot screens when the system starts


Note: If you get any dependency problems just before the install/upgrade starts, just click continue.  We install all the latest packages and it just means some dependencies have changed since the kickstart files were built.   As long as all the repositories are their the installer will figure out the packages it needs.

Booting from a LiveOS

Just follow the Starting up a NetBoot step and select one of the installed LiveCDs.  I recommend to try Ubuntu, it's similar to Fedora.

Note: these LiveCD's will not overwrite your hard drive, unless you specificity click install to hard drive and instruct it to wipe your hard drive.  So you can play with Linux or other LiveCDs without harm.   When your finished playing just reboot normally.

Backing up your Hard Drive

There are several ways to do this and all have various pros and cons.   This is a quick and dirty way to backup your hard drive that allows you to get at everything from a linux machine.  It also allows you to restore your hard drive exactly how it was before you started.   Con:  Takes up a lot of space, and time.

First boot your computer into ubuntu from the Netboot menu or any other type of LiveCD/DVD/USB.   Then plug-in a USB device, e-sata, or have enough space on another machine to contain the entire hard drive.   We're going to copy the entire hard drive, blank space and all.

If the drive is USB or e-sata:
dd if=/dev/sda of=/media/<name of your drive>/my_drive_c.img
Replace the /dev/sda with whatever hard drive your backing up.   Also the of= can be another hard drive in your computer if you have two hard drives.   But if your doing that I recommend disconnecting the drive during the upgrade.   Far less chance of screwing things up if the hard drive isn't even connected to the computer.

If the command returns errors you have a bigger problem as your hard drive is corrupt.  See ddrescue command for help on that one.

If the drive is over the network:

For this to work you need to have ssh enabled on a machine somewhere.   On the CF fedora Installs this is already setup.  Then type:
dd if=/dev/sda | ssh user@hostname dd of=my_drive_c.img

Performing a Manual Fedora Upgrade

Ref: Fedora Information Page

The following are the steps I normally follow to do a manual upgrade.  This is not the recommend way.  The recommended way is to use the NetBoot upgrade feature.  The reason for the manual steps are so I can remotely upgrade a machine or fix problems as they occur.  If the NetBoot upgrade fails in the middle it's very hard to recover from.

Preparation:
  1. Connect the computer over wired network.  Never try to do an upgrade or install on something as unstable as wireless
  2. If you don't have the /u2/Repositories mirror on this drive mount it. (ie mount 172.29.0.18:/u2/Repositories /u2/Repositories).   The reason for this is speed and space.  Normally the yum pulls it's packages from http or ftp.  This requires the installer to download the packages to your HD first before installing.   If you have 20G of software installed you could need +20G of space to store all the packages needed for the upgrade.
  3. Open a console window CTRL-ALT-F2 or CTRL-ALT-F3.   You should see a black screen with a login prompt.
  4. Type init 3   This will shutdown the graphics server as we don't want it running during the upgrade, creates a mess if it's running.
  5. Type yum -y update  This is just to make sure your running the latest software.   
  6. Type package-cleanup --orphans  This will list packages which no longer have a home.   Any that you don't use delete by doing yum remove <package name>
Upgrading:

  1. Type: yum -y --releasever=14 distro-sync --skip-broken  If you get dependency errors, that stop the upgrade, take note of the packages causing the error.   Then remove them using yum remove <package name>.  Write down what it removed so you can reinstall if needed.   Chances are the new version of Fedora has completely re-done how they get the packages.
  2. Reboot.   (Take note of which kernel your booting into.  If it's the old kernel you'll get all sorts of weird problems)
Cleanup (This isn't completely necessary but I do it so everything is clean.):
  1. From a terminal window type sudo -i to log into root.  (best to do this from init 3 prompt but not 100% necessary)
  2. Type cf_yumlist.sh  This just makes sure all the latest package information is in the cache files
  3. Type grep  -e "/10" -e "/11" -e "/12" -e "/13" /tmp/yumInstalled.txt | awk '{print $1}' | sort -u > /tmp/to_reinstall.txt    From this we will now have a list of most of the packages which didn't actually upgrade because the version we have now is newer or equal.
  4. Type yum -y reinstall $(cat /tmp/to_reinstall.txt)   This will reinstall all the packages from the current repository.  We do this just so everything is nice and clean.
  5. Type package-cleanup --orphans  This will list packages which no longer have a home.   Any that you don't use delete by doing yum remove <package name>
  6. Type cf_yumlist.sh

No comments:

Post a Comment