个人工具

UbuntuHelp:LiveCDInstallHowTo

来自Ubuntu中文

跳转至: 导航, 搜索

Installing Ubuntu Linux to your hard drive from LiveCD.

These instructions are obsolete because as of Ubuntu 6.06 LTS, the LiveCD now comes with a simple "install" button right on the desktop which handles all of this for you. However, these instructions are probably still useful for reference and/or historical purposes and/or troubleshooting and/or people who need to create a custom install.

Introduction

The Ubuntu Live CD's may be installed to hard drive. The process to be followed is similar to the one followed by the Knoppix and DSL installer scripts Credits: This howto is based upon the Installing Ubuntu Hoary from LiveCD , but has been updated. This method works for the Ubuntu and the Kubuntu live cds. This is also the ONLY method to install Ebuntu to your Hard Drive. Warning: This method worked for me. If you do something wrong, you may screw up your system. This has not been tested on SCSI systems. SCSI systems require kernel recompilation and that is beyond the scope of this Howto. Proceed at your own risk. Also I expect that you are comfortable with the command line interface in particular and Linux in general.

Let's Begin

Be careful! There are no seat belts attached here!. People who have experience with Gentoo Linux will feel at home though.. Ideally , you should try this out on a spare hard disk. Although a spare partition would do too. Just be careful when you are installing grub in that case.

Before you start

Assume that all the data that you have on your hard disk is going to get lost. Thus you have two alternatives here 1) Backup all your data on CD's/DVD's/Network etc. 2) Install on a spare hard disk (Highly recommended for novices) What we will do here is to do by hand what the installer does automatically. Advantages of this approach: This method allows you to have finer grained control of the installation than the default Ubuntu installer Disadvantages: If you screw up, you'll have to start all over again, from the first step! Now that you know what you're getting into, let's proceed. NOTE: 1) Warnings are bold. 2) The commands that you have to type are in italics.

Boot the system from your desired Live CD

Boot from your Ubuntu , Kubuntu or Ebuntu live cd. Perform all the customizations that you would normally perform. These include 1) Setting up your internet connection. (REQUIRED) 2) Setting up your repostories (REQUIRED) (If you dont know how to do it, please read How to install software 3) Any other customizations (OPTIONAL)

Create New Partition

Let us assume that you are going to install on /dev/hda1 and that the swap partion will be /dev/hda2

sudo fdisk /dev/hda

fdisk is pretty easy to use. if you are not comfortable, please read Using fdisk to partition your disk Make 2 partitions, one for / and another for swap. Let swap be the first partion and the / be the other partition. The above configuration is a generic configuration. It is almost guranteed to work on all situations NOTE TO EXPERTS : You can also setup /home /usr etc. .. partitions as per your own needs.

Make File Systems on hard disk partitions

Make the swap partition

mkswap /dev/hda1

Make the / (root) partition

mkfs.ext3 /dev/hda2

NOTE: There are lots of options while making file systems. For more info Creating Filesystems

Create and mount partitions

mkdir /mnt
mount /dev/hda1 /mnt

NOTE: Replace /dev/hda1 with your / partion. This is also the time to mount /usr /home etc if you have made them seperately.

Setup Networking

Install cloop-utils

sudo  apt-get install cloop-utils

Populate file system

Note: This step will take a lot of time.

extract_compressed_fs /cdrom/casper/filesystem.cloop > /mnt/extracted_fs

Mount uncompressed file system

mkdir /mnt/cloop
mount /mnt/extracted_fs /mnt/cloop -o loop

Copy filesystem to new partition

Note: This step will take a lot of time.

rsync -av /mnt/cloop/* /mnt/

Configure internet connection and network interfaces

cp /etc/resolv.conf /mnt/etc/resolv.conf
mount -t proc proc /mnt/proc
cp /etc/network/interfaces /mnt/etc/network/interfaces

Change over to your new filesystem

Chroot into your new filesystem, so that all changes get made in the new partition.

chroot /mnt /bin/bash

Edit /etc/fstab (file system information)

sudo vi /etc/fstab

and enter the following lines

# /etc/fstab: static file system information.

<file system> <mount point>   <type>  <options>       <dump>  <pass>

proc            /proc           proc    defaults        0       0

/dev/hda2      /          ext3   defaults,errors=remount-ro 0   1      

/dev/hda1       none            swap    sw              0       0

/dev/hdb        /media/cdrom0   udf,iso9660 user,noauto     0       0

NOTE: man fstab for more. I have assumed here that the cdrom drive is the primary slave and HD is the primary master.

Add yourself to the visudoers list

sudo visudo

Install GRUB

GRUB is the bootloader. It is required for booting your system.

sudo apt-get update
sudo apt-get install grub

Update the Kernel Image Configuration File

sudo vi /etc/kernel-img.conf

and type the following :

# Do not create symbolic links in /

do_symlinks = no

relative_links = yes

do_bootloader = no

do_bootfloppy = no

do_initrd = yes

link_in_boot = no

postinst_hook = /sbin/update-grub

postrm_hook = /sbin/update-grub

Generate Grub config file

update-grub

This will make a new menu.lst file and then , to insall grub:

cp /lib/grub/i386-pc/* /boot/grub

and then

grub
grub> root (hd0,4)
grub> setup (hd0)
grub> quit

Remake initrd

initrd is the intial ramdisk, it is the most vital part during the booting process. You should remove the current initrd file and run mkinitrd as the last step before rebooting. So any needed drivers at boot time will be available. This fixes a VFS root mount error you might get if you use ext3, sata, scsi, etc.

rm /boot/initrd.img-2.6.10-3-386 (—change this if needed—)
mkinitrd -o initrd.img-2.6.10-3-386 2.6.10-3-386

Post Install

Reboot, taking out the LiveCD. If you’ve got everything right, you’ll now have a running Ubuntu/Kubuntu/Ebuntu installation. If not, boot up the LiveCD and fix the problems. You'll probably have to start over again :-)