个人工具

UbuntuHelp:UbuntuServerFlashDriveInstaller

来自Ubuntu中文

跳转至: 导航, 搜索

This pages describes how to create a flash drive that can be used for installing Ubuntu Server. This is for any machine that doesn't have a CD drive but can boot from USB media (i.e. the flash drive). Note: This method may work with other iso files besides the Ubuntu Server iso file. The steps are:

  • Log onto a Ubuntu machine where you have sudo priveleges
  • Download the hd-media installer's initrd.gz file
  • Download the hd-media installer's vmlinuz file
  • Note: These links are version dependant, if you are not installing hardy, you'll need to get the vmlinuz and initrd.gz for your own version (i.e. intrepid, jaunty, etc).
  • When we say version dependent, we mean it. If you use the latest hd-media installer for Hardy with the original Hardy iso, it won't work. You need the latest Hardy (currently 8.04.2) and the latest installer, or your iso's older matching installer. (I think 38 is for 8.04, 39 if for 8.04.1, and 40.4 is for 8.04.2)
  • vmlinuz: http://archive.ubuntu.com/ubuntu/dists/<YOUR_VERSION>/main/installer-i386/current/images/hd-media/vmlinuz
  • initrd.gz: http://archive.ubuntu.com/ubuntu/dists/<YOUR_VERSION>/main/installer-i386/current/images/hd-media/initrd.gz
  • Download Ubuntu Server installation iso file
  • Determine which device your flash drive is on (/dev/sdb, etc)
  • Run the script below after:
  • Unmounting the flash drive, if necessary
  • Making sure you are in the same directory that contains the three files that were just downloaded
  • Replacing /dev/sdx with /dev/[your device here]
  • Changing the ISOIMAGE variable to match the Ubuntu Server iso filename
  • Boot the computer you would like to install Ubuntu Server on from the flash drive
  • Install Ubuntu Server as you would from a normal install CD
  • Note: The first screen after the language prompt has several options. Only the first option works (Install to disk)

Comment: Could not get it to work with hardy server iso - it fails to mount /dev/sda and /var/log/syslog says Debian image ubuntu-8.10-server-amd64.iso is not usable :( Comment2: Get it to work with hardy-server-amd64 iso too. My first try doesn't work too, but because of the false vmlinuz/initrd.gz files. With both from the "installer-amd64"-tree the installation goes around :-) Notes:

  • The links above are for the 32-bit version of Ubuntu 8.04 (Hardy). To install with a 64-bit image, replace the "i386" in the URLs with a "amd64". To install Ubuntu 8.10 (Intrepid), replace "hardy" in the URLs with "intrepid".
  • If on booting the USB drive you get a blank screen with the cryptic message MBR FA:, press the "a" key. The message will change to MBR 1234F. Now press "1" and the boot will proceed as normal.
  • Depending on the speed of your drive, the "Loading Linux Kernel" window may show 100% for a minute or more. It hasn't locked up. Just be patient!
  • If you actually use the drive to install Ubuntu on a server, it may turn out that the installer puts grub on the USB disk (because it's detected as the first drive) instead of your hard drive. To fix this, reboot using the USB disk and run install-grub on the actual hard drive. You'll also need to recreate the flash drive. I experienced this on Jaunty. -- kiko

Flash Drive Creation Script

# Replace "sdx" with "sdb" or whatever your flash drive is
#   - If unsure which device is your flash drive then
#     run "sudo fdisk -l | less" in order to identify it

ISOIMAGE=ubuntu-8.04-server-i386.iso

sudo apt-get install syslinux mtools mbr
echo "Use fdisk to manually create a 1GB bootable FAT16 partition."
read -p "Press [Enter] to start the fdisk program..."
sudo fdisk /dev/sdx
sudo mkfs -t vfat /dev/sdx1
sudo mkdir -p /mnt/flash
sudo mount -t vfat /dev/sdx1 /mnt/flash
sudo syslinux -s /dev/sdx1
sudo mkdir -p /mnt/iso
sudo mount -o loop $ISOIMAGE /mnt/iso
sudo cp -R /mnt/iso/isolinux/* /mnt/flash
sudo mv /mnt/flash/isolinux.cfg /mnt/flash/syslinux.cfg
sudo mkdir -p /mnt/flash/install
sudo cp vmlinuz /mnt/flash/install
sudo cp initrd.gz /mnt/flash/install
sudo cp $ISOIMAGE /mnt/flash
sudo install-mbr /dev/sdx
sudo umount /mnt/flash
sudo umount /mnt/iso