个人工具

“UbuntuHelp:LiveCDInstallHowTo”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{From|https://help.ubuntu.com/community/LiveCDInstallHowTo}} {{Languages|UbuntuHelp:LiveCDInstallHowTo}} == Installing Ubuntu Linux to your hard drive from LiveCD. == '''These instruc...)
 
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/LiveCDInstallHowTo}}
 
{{From|https://help.ubuntu.com/community/LiveCDInstallHowTo}}
 
{{Languages|UbuntuHelp:LiveCDInstallHowTo}}
 
{{Languages|UbuntuHelp:LiveCDInstallHowTo}}
 
 
 
== Installing Ubuntu Linux to your hard drive from LiveCD. ==
 
== 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.
 
'''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 ===
 
=== 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
 
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 [http://www.willmer.com/kb/2005/02/installing-ubuntu-hoary-from-livecd/ Installing Ubuntu Hoary from LiveCD]
 
Credits: This howto is based upon the [http://www.willmer.com/kb/2005/02/installing-ubuntu-hoary-from-livecd/ Installing Ubuntu Hoary from LiveCD]
 
, but has been updated.  
 
, but has been updated.  
 
 
This method works for the [http://www.ubuntu.org/ Ubuntu] and the [http://www.kubuntu.org/ Kubuntu] live cds.
 
This method works for the [http://www.ubuntu.org/ Ubuntu] and the [http://www.kubuntu.org/ Kubuntu] live cds.
 
 
 
This is also the ONLY method to install  [https://wiki.ubuntu.com/Ebuntu Ebuntu] to your Hard Drive.
 
This is also the ONLY method to install  [https://wiki.ubuntu.com/Ebuntu 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.
 
''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. '''
 
''' Proceed at your own risk. '''
 
 
Also I expect that you are comfortable with the command line interface in particular and Linux in general.
 
Also I expect that you are comfortable with the command line interface in particular and Linux in general.
 
 
=== Let's Begin ===
 
=== Let's Begin ===
 
 
Be careful! There are no seat belts attached here!. People who have experience with Gentoo Linux will feel at home though..
 
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.
 
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 ====
 
==== Before you start ====
 
 
Assume that all the data that you have on your hard disk is going to get lost.
 
Assume that all the data that you have on your hard disk is going to get lost.
 
 
Thus you have two alternatives here  
 
Thus you have two alternatives here  
 
 
1) Backup all your data on CD's/DVD's/Network etc.
 
1) Backup all your data on CD's/DVD's/Network etc.
 
 
2) Install on a spare hard disk (Highly recommended for novices)
 
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.  
 
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
 
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!
 
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.
 
Now that you know what you're getting into, let's proceed.
 
 
NOTE:
 
NOTE:
 
 
1) Warnings are '''bold'''.  
 
1) Warnings are '''bold'''.  
 
 
2) The commands that you have to type ''are in italics''.
 
2) The commands that you have to type ''are in italics''.
 
 
 
==== Boot the system from your desired Live CD ====
 
==== 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
 
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)
 
1) Setting up your internet connection. (REQUIRED)
 
 
2) Setting up your repostories (REQUIRED)
 
2) Setting up your repostories (REQUIRED)
 
 
 
(If you dont know how to do it, please read [[UbuntuHelp:InstallingSoftware| How to install software]]
 
(If you dont know how to do it, please read [[UbuntuHelp:InstallingSoftware| How to install software]]
 
 
3) Any other customizations (OPTIONAL)
 
3) Any other customizations (OPTIONAL)
 
 
==== Create New Partition ====
 
==== Create New Partition ====
 
 
 
Let us assume that you are going to install on /dev/hda1 and that the swap partion will be /dev/hda2
 
Let us assume that you are going to install on /dev/hda1 and that the swap partion will be /dev/hda2
 
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo fdisk /dev/hda
 
sudo fdisk /dev/hda
 
</nowiki></pre>
 
</nowiki></pre>
 
 
fdisk is pretty easy to use. if you are not comfortable, please read [http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=4#doc_chap3 Using fdisk to partition your disk]
 
fdisk is pretty easy to use. if you are not comfortable, please read [http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=4#doc_chap3 Using fdisk to partition your disk]
 
 
Make 2 partitions, one for / and another for swap.
 
Make 2 partitions, one for / and another for swap.
 
 
Let swap be the first partion and the / be the other partition.
 
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
 
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.  
 
NOTE TO EXPERTS : You can also setup /home /usr etc. .. partitions as per your own needs.  
 
 
 
==== Make File Systems on hard disk partitions ====
 
==== Make File Systems on hard disk partitions ====
 
 
Make the swap partition
 
Make the swap partition
 
<pre><nowiki>
 
<pre><nowiki>
 
mkswap /dev/hda1
 
mkswap /dev/hda1
 
</nowiki></pre>  
 
</nowiki></pre>  
 
 
Make the / (root) partition
 
Make the / (root) partition
 
<pre><nowiki>
 
<pre><nowiki>
 
mkfs.ext3 /dev/hda2
 
mkfs.ext3 /dev/hda2
 
</nowiki></pre>  
 
</nowiki></pre>  
 
 
NOTE: There are lots of options while making file systems. For more info [http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=4#doc_chap4 Creating Filesystems]
 
NOTE: There are lots of options while making file systems. For more info [http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=4#doc_chap4 Creating Filesystems]
 
 
==== Create and mount partitions ====
 
==== Create and mount partitions ====
 
 
<pre><nowiki>
 
<pre><nowiki>
 
mkdir /mnt
 
mkdir /mnt
 
</nowiki></pre>
 
</nowiki></pre>
 
 
<pre><nowiki>
 
<pre><nowiki>
 
mount /dev/hda1 /mnt
 
mount /dev/hda1 /mnt
 
</nowiki></pre>
 
</nowiki></pre>
 
 
NOTE: Replace /dev/hda1 with your / partion. This is also the time to mount /usr /home etc if you have made them seperately.
 
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 ====
 
==== Setup Networking ====
 
 
 
 
==== Install cloop-utils ====
 
==== Install cloop-utils ====
 
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo  apt-get install cloop-utils
 
sudo  apt-get install cloop-utils
 
</nowiki></pre>
 
</nowiki></pre>
 
 
 
==== Populate file system ====
 
==== Populate file system ====
 
Note: This step will take a lot of time.
 
Note: This step will take a lot of time.
 
 
<pre><nowiki>
 
<pre><nowiki>
 
extract_compressed_fs /cdrom/casper/filesystem.cloop > /mnt/extracted_fs
 
extract_compressed_fs /cdrom/casper/filesystem.cloop > /mnt/extracted_fs
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== Mount uncompressed file system ====
 
==== Mount uncompressed file system ====
 
 
<pre><nowiki>
 
<pre><nowiki>
 
mkdir /mnt/cloop
 
mkdir /mnt/cloop
 
</nowiki></pre>
 
</nowiki></pre>
 
 
<pre><nowiki>
 
<pre><nowiki>
 
mount /mnt/extracted_fs /mnt/cloop -o loop
 
mount /mnt/extracted_fs /mnt/cloop -o loop
 
</nowiki></pre>
 
</nowiki></pre>
 
 
 
==== Copy filesystem to new partition ====
 
==== Copy filesystem to new partition ====
 
Note: This step will take a lot of time.
 
Note: This step will take a lot of time.
 
 
<pre><nowiki>
 
<pre><nowiki>
 
rsync -av /mnt/cloop/* /mnt/
 
rsync -av /mnt/cloop/* /mnt/
 
</nowiki></pre>
 
</nowiki></pre>
 
 
 
==== Configure internet connection and network interfaces ====
 
==== Configure internet connection and network interfaces ====
 
 
<pre><nowiki>
 
<pre><nowiki>
 
cp /etc/resolv.conf /mnt/etc/resolv.conf
 
cp /etc/resolv.conf /mnt/etc/resolv.conf
 
</nowiki></pre>
 
</nowiki></pre>
 
 
<pre><nowiki>
 
<pre><nowiki>
 
mount -t proc proc /mnt/proc
 
mount -t proc proc /mnt/proc
 
</nowiki></pre>
 
</nowiki></pre>
 
 
<pre><nowiki>
 
<pre><nowiki>
 
cp /etc/network/interfaces /mnt/etc/network/interfaces
 
cp /etc/network/interfaces /mnt/etc/network/interfaces
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== Change over to your new filesystem ====
 
==== Change over to your new filesystem ====
 
 
Chroot into your new filesystem, so that all changes get made in the new partition.
 
Chroot into your new filesystem, so that all changes get made in the new partition.
 
 
<pre><nowiki>
 
<pre><nowiki>
 
chroot /mnt /bin/bash
 
chroot /mnt /bin/bash
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== Edit /etc/fstab (file system information) ====
 
==== Edit /etc/fstab (file system information) ====
 
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo vi /etc/fstab
 
sudo vi /etc/fstab
 
</nowiki></pre>
 
</nowiki></pre>
 
 
and enter the following lines
 
and enter the following lines
 
 
 
<pre><nowiki>
 
<pre><nowiki>
 
# /etc/fstab: static file system information.
 
# /etc/fstab: static file system information.
 
 
<file system> <mount point>  <type>  <options>      <dump>  <pass>
 
<file system> <mount point>  <type>  <options>      <dump>  <pass>
 
 
proc            /proc          proc    defaults        0      0
 
proc            /proc          proc    defaults        0      0
 
 
/dev/hda2      /          ext3  defaults,errors=remount-ro 0  1       
 
/dev/hda2      /          ext3  defaults,errors=remount-ro 0  1       
 
 
/dev/hda1      none            swap    sw              0      0
 
/dev/hda1      none            swap    sw              0      0
 
 
/dev/hdb        /media/cdrom0  udf,iso9660 user,noauto    0      0
 
/dev/hdb        /media/cdrom0  udf,iso9660 user,noauto    0      0
 
 
</nowiki></pre>
 
</nowiki></pre>
 
 
 
NOTE: ''man fstab'' for more. I have assumed here that the cdrom drive is the primary slave and HD is the primary master.  
 
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 ====
 
==== Add yourself to the visudoers list ====
 
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo visudo
 
sudo visudo
 
</nowiki></pre>
 
</nowiki></pre>
 
 
 
 
==== Install GRUB ====
 
==== Install GRUB ====
 
 
GRUB is the bootloader. It is required for booting your system.
 
GRUB is the bootloader. It is required for booting your system.
 
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get update
 
sudo apt-get update
 
sudo apt-get install grub
 
sudo apt-get install grub
 
</nowiki></pre>
 
</nowiki></pre>
 
 
 
 
==== Update the Kernel Image Configuration File ====
 
==== Update the Kernel Image Configuration File ====
 
 
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo vi /etc/kernel-img.conf
 
sudo vi /etc/kernel-img.conf
 
</nowiki></pre>
 
</nowiki></pre>
 
 
and type the following :
 
and type the following :
 
 
<pre><nowiki>
 
<pre><nowiki>
 
# Do not create symbolic links in /
 
# Do not create symbolic links in /
 
 
do_symlinks = no
 
do_symlinks = no
 
 
relative_links = yes
 
relative_links = yes
 
 
do_bootloader = no
 
do_bootloader = no
 
 
do_bootfloppy = no
 
do_bootfloppy = no
 
 
do_initrd = yes
 
do_initrd = yes
 
 
link_in_boot = no
 
link_in_boot = no
 
 
postinst_hook = /sbin/update-grub
 
postinst_hook = /sbin/update-grub
 
 
postrm_hook = /sbin/update-grub
 
postrm_hook = /sbin/update-grub
 
</nowiki></pre>
 
</nowiki></pre>
 
 
 
==== Generate Grub config file ====
 
==== Generate Grub config file ====
 
 
<pre><nowiki>
 
<pre><nowiki>
 
update-grub
 
update-grub
 
</nowiki></pre>
 
</nowiki></pre>
 
 
This will make a new menu.lst file
 
This will make a new menu.lst file
 
 
and then , to insall grub:
 
and then , to insall grub:
 
 
<pre><nowiki>
 
<pre><nowiki>
 
cp /lib/grub/i386-pc/* /boot/grub
 
cp /lib/grub/i386-pc/* /boot/grub
 
</nowiki></pre>
 
</nowiki></pre>
 
 
and then  
 
and then  
 
 
<pre><nowiki>
 
<pre><nowiki>
 
grub
 
grub
第273行: 第154行:
 
grub> quit
 
grub> quit
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== Remake initrd ====
 
==== Remake initrd ====
 
 
initrd is the intial ramdisk, it is the most vital part during the booting process.
 
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.
 
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.
 
 
<pre><nowiki>
 
<pre><nowiki>
 
rm /boot/initrd.img-2.6.10-3-386 (—change this if needed—)
 
rm /boot/initrd.img-2.6.10-3-386 (—change this if needed—)
 
</nowiki></pre>
 
</nowiki></pre>
 
 
<pre><nowiki>
 
<pre><nowiki>
 
mkinitrd -o initrd.img-2.6.10-3-386 2.6.10-3-386
 
mkinitrd -o initrd.img-2.6.10-3-386 2.6.10-3-386
 
</nowiki></pre>
 
</nowiki></pre>
 
 
=== Post Install ===
 
=== 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 :-)
 
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 :-)
 
 
 
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]
 
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年11月30日 (五) 20:06的版本

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 :-)