Applicable to Fedora Versions
- All
Requirements
In order to use this installation method you must already have a linux distro installed which successfully boots using the grub bootloader. A network connection and a network device that anaconda can configure is also required (which rules out some wireless-only installations).
Doing the Work
NOTE: the grub "PXE" image installation method described here is not the same as a conventional PXE installation where the network card supports PXE netbooting of the images on a remotely configured tftp/dhcp server. In this case we're taking advantage of a system with a pre-existing bootloader by telling it to bootstrap the images directly on disk.
Summary of steps below: 1) put the pxe images in /boot; 2) configure grub.conf for a local or (advanced) remote vnc install; 3) point of no return: double-check & backup, backup, backup. 4) reboot and start the netinstall from a known mirror.
- Download the vmlinuz and initrd.img PXE images for the OS version and architecture you want to install, into your /boot directory. If you already have image filenames by those generic names in your /boot directory, download them to a temp directory instead, rename them to something unique and identifiable (such as vmlinuz.f10.pxe and initrd.img.f10.pxe), and then copy or move them to /boot/. (note: grub doesn't care about selinux or file permissions)
- Fedora 10 i386 (32bit): http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Fedora/i386/os/images/pxeboot/
- Fedora 10 x86_64 (64bit): http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Fedora/x86_64/os/images/pxeboot/
- Fedora 9 i386 (32bit): http://download.fedora.redhat.com/pub/fedora/linux/releases/9/Fedora/i386/os/images/pxeboot/
- Fedora 9 x86_64 (64bit): http://download.fedora.redhat.com/pub/fedora/linux/releases/9/Fedora/x86_64/os/images/pxeboot/
cd /boot/
wget 'http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Fedora/i386/os/images/pxeboot/vmlinuz'
wget 'http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Fedora/i386/os/images/pxeboot/initrd.img' - Configure grub to boot the PXE Images
- For a LOCAL install, add the following example grub entry to your /etc/grub.conf
title Install Fedora (PXE)
root (hd0,0)
kernel /vmlinuz
initrd /initrd.imgNOTE: The above assumes you have your /boot on a separate partition from the root partition, which is the default. If /boot was on the same device as your '/' root partition you would use, for example: "/boot/vmlinuz", instead.
SKIP TO STEP 3 IF DOING A LOCAL INSTALL
- For a REMOTE install, the grub.conf and VNC setup is more involved.
You will need to configure your boot loader for the new PXE images. At this point you will need information about the existing server and network. This is key to the success of the reboot. You must know that the PXE images will boot your hardware. Specifically hard disk drives and network interface cards are needed to do the install. The best way to check this is read (TODO:missing link) about it or test it. You must also know what your network adapter will show up as it is passed to the kernel at boot. Again, you have been warned. Also, it is good to make backups of your boot loader configs. As another note, please 'append' this information into your configs. Do not replace what you have, just add to it.
For this example we will use the following network settings. You must adjust them to your own network (or rely upon DHCP instead - see further below):
IP: 192.168.1.2
Netmask: 255.255.255.0
Gateway: 192.168.1.1
DNS: 192.168.1.1
Server Network Interface: eth0
Workstation Machine: 192.168.1.23
Hostname: test.mydomain.com
VNC Password: yourPassNote: Make sure your password is between 6-11 characters in length.
The following are example kernel configs for grub:
This is an example grub config section with our example static IP config:
title Install Fedora (PXE) - static. we connect to vnc server.
root (hd0,0)
kernel /vmlinuz vnc vncpassword=yourPass headless ip=192.168.1.2 noipv6 netmask=255.255.255.0 gateway=192.168.1.1 dns=192.168.1.1 hostname=test.mydomain.com ksdevice=eth0 method=http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Fedora/i386/os/ lang=en_US keymap=us
initrd /initrd.imgAnother way to run with a static network config, using vncconnect instead, which tells the installer to connect back to our listening VNC client:
title Install Fedora (PXE) - static. vnc server connects to us.
root (hd0,0)
kernel /vmlinuz vnc vncconnect=192.168.1.23 headless ip=192.168.1.2 noipv6 netmask=255.255.255.0 gateway=192.168.1.1 dns=192.168.1.1 hostname=test.mydomain.com ksdevice=eth0 method=http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Fedora/i386/os/ lang=en_US keymap=us
initrd /initrd.imgYou may also use DHCP, but you must make sure you will know the assigned IP address when the server reboots:
title Install Fedora (PXE) - dhcp. we connect to the vnc server.
root (hd0,0)
kernel /vmlinuz vnc vncpassword=yourPass headless ip=dhcp noipv6 ksdevice=eth0 method=http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Fedora/i386/os/ lang=en_US keymap=us
initrd /initrd.imgYet another way to use DHCP. This might be the best option if you do not know what the IP will be:
title Install Fedora (PXE) - dhcp. vnc server connects to us.
root (hd0,0)
kernel /vmlinuz vnc vncconnect=192.168.1.23 headless ip=dhcp noipv6 ksdevice=eth0 method=http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Fedora/i386/os/ lang=en_US keymap=us
initrd /initrd.imgAdapt one of the above examples to your environment, add it to your grub.conf, and change the "default=N" line to refer to it, where N equals the position of the new entry, counting from the top, starting at zero (e.g. if it was the 3rd entry, use "default=2").
- Configure Grub to boot once-only, then Fallback, in case Bootup Fails
If your new PXE grub config fails to boot and start the installation correctly the very first time, you are stuck, unless you have some way to recover. There are two ways to do so:
- Your server has an emergency IP KVM, or virtual ssh console of some kind. If you've got this kind of access you can fix the grub problem as if you were physically in front of the server. Even in this case, you can save time with a fallback setup as described below.
- Your server has a simple remote "reboot" facility provided via a web control panel of some sort. If you can AT LEAST reboot your server, or call a remote tech to do it manually, then you can setup grub to boot the PXE kernel once, and on the next boot fallback to the last used working kernel. If you can't reboot your server, then you probably shouldn't be attempting a remote install unless you have the experience to KNOW it will work the first time.
To configure grub to only boot an entry once, then fallback, you need to switch grub.conf from using the fixed "default=N" index number, to using "default=saved". You must then to tell grub which entry will be the saved default by putting "savedefault" in the good grub.conf entry, and by immediately saving it on the command line (see below). Finally, you tell grub to save a default entry that it will only boot once, afterwhich it will boot the previous savedefault until told otherwise.
See the example grub.conf below. The WORKING kernel entry is (#0) the one at the very top (yours should be as well), and the PXE VNC grub entry we want to boot next is the 3rd one down (#2).
default=saved
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title #0 - Fedora (2.6.21-1.3228.fc7)
root (hd0,0)
kernel /vmlinuz-2.6.21-1.3228.fc7 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.21-1.3228.fc7.img
savedefault
title #1 - Fedora (2.6.21-1.3194.fc7)
root (hd0,0)
kernel /vmlinuz-2.6.21-1.3194.fc7 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.21-1.3194.fc7.img
title #2 - Install Fedora (PXE) - dhcp. vnc server connects to us.
root (hd0,0)
kernel /vmlinuz vnc vncconnect=192.168.1.23 headless ip=dhcp noipv6 ksdevice=eth0 method=http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Fedora/i386/os/ lang=en_US keymap=us
initrd /initrd.imgFirst we need to initialize the "main fallback" saved default by telling grub to save the first (#0th) entry with the following command:
echo 'savedefault --default=0' | grub --batch
And finally, we need to tell grub which entry to attempt booting only once before rebooting to the saved fallback entry above. In this example, we want to boot #2 once
echo 'savedefault --default=2 --once' | grub --batch
- Setup your Workstation to Listen for the VNC Install to Start
This step is only needed if you choose to use vncconnect to tell the installer to connect back to your waiting VNC viewer, rather than you initiating a connection with the waiting VNC server. Having the installer connect back to your VNC client is very convenient, especially if its DHCP IP is dynamic, or in the case where it's easier to open a hole for VNC on your side of the firewall, or if you would just rather have the VNC install start when it's ready rather than you having to poll the server to see if it's ready yet. If you choose not to use this method, be sure to set a vncpassword so that no random hacker can connect to the VNC server before you do.
To be able to use vncconnect you must setup a vncviewer to listen and wait for the server to boot. Run the following on your workstation:
vncviewer --listen
This will setup vncviewer to listen on port 5500 by default. Other VNC clients may use a different port; see their documentation. Use netstat on your workstation to check to see if it is listening:
# netstat -panl | grep 5500
tcp 0 0 0.0.0.0:5500 0.0.0.0:* LISTEN 28370/vncviewerFinally, and most importantly, you must make sure that the server can connect to your client. You can do this from the server with the following netcat command:
# nc -vz 192.168.1.23 5500
Connection to 192.168.1.23 5500 port [tcp/fcp-addr-srvr1] succeeded!If you don't see "succeeded", and instead see "No route to host" or "Connection refused", then a firewall is mostly likely blocking the connection and you need to do one or both of the following: 1) open port 5500 on your workstation's firewall. 2) if you have a NAT router, and you're remotely installing to a server that's outside your local LAN, then you'll need to setup a port forward mapping from the external port 5500, to your workstation's internal 192.168.1.21:5500
Installing From the localhost
Installing from a Remote Location using VNC
- For a LOCAL install, add the following example grub entry to your /etc/grub.conf
- Double-check your grub.conf to make sure that it is set to load the correct PXE image files (no typos) upon reboot. Nearing the point of no return here, so make sure you have a backup of all your important data in case installation fails.
- Reboot to Begin the Network Installation.
IMPORTANT NOTE ABOUT NETWORK MIRROR PATHS: During the installation you will be prompted for the "site name" and the "Fedora directory" of the network mirror you want to install from - you need to know this before-hand, so write a few down. You can either setup and use your own local mirror, or use one of the many geographically close public mirrors that are listed here: http://mirrors.fedoraproject.org/publiclist
When using a public mirror, you need to make sure to use the full, correct directory path, or it won't be found - the directory should end with "/os/". Using the example mirror of "http://mirror.cc.vt.edu/pub/fedora/linux", the "Web site name" part would be "mirror.cc.vt.edu", but the directory would *not* only be "/pub/fedora/linux". You have to drill down the mirror directories to find the correct full path with "/os/" at the end, and in this example it happens to be "pub/fedora/linux/releases/10/Fedora/i386/os". Note also that the mirror arch path you install from needs to match the PXE image arch that you're booting from: i386 or x86_64.
- Once installation is complete, reboot into the newly installed OS and continue with post-installation configuration as usual.
Troubleshooting
How to test
For local installations: if you added the PXE images correctly, you should still be able to boot back to the old kernel by simply selecting it from the grub menu. Do this and try again. You must know if your boot loader expects /boot or not, which should be easy to infer from the pre-existing entries in grub.conf.
For remote installations: if the PXE images failed to boot and connect to your VNC client in a reasonable amount of time, something probably went wrong and you'll need a way to reboot the server. If you setup grub correctly to only boot the PXE entry --once, it will automatically fallback to the previously saved default after you reboot. If it doesn't, you may be in trouble, unless you have an emergency IP KVM, virtual console, or onsite tech support.
Common problems and fixes
N/A
More Information
Disclaimer
We test this stuff on our own machines, really we do. But you may run into problems, if you do, come to #fedora on irc.freenode.net
0 comments:
Post a Comment