个人工具

“UbuntuHelp:Installation/FromKnoppix”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第16行: 第16行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# mkdir /mnt/ubuntu
 +
# mount /dev/hda3 /mnt/ubuntu
 
</nowiki></pre>
 
</nowiki></pre>
  
第26行: 第28行:
 
2) Uncompress and extract the archive, then <code><nowiki>cd</nowiki></code> into the newly created directory and build the program:
 
2) Uncompress and extract the archive, then <code><nowiki>cd</nowiki></code> into the newly created directory and build the program:
 
<pre><nowiki>
 
<pre><nowiki>
 +
# cd /ramdisk/home/knoppix/tmp
 +
# tar zxvf debootstrap_*.tar.gz
 +
# cd debootstrap-*
 +
# make
 +
# chmod +x debootstrap
 
</nowiki></pre>
 
</nowiki></pre>
  
第33行: 第40行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# DEBOOTSTRAP_DIR=`pwd` ./debootstrap --arch i386 dapper /mnt/ubuntu http://archive.ubuntu.com/ubuntu dapper
 
</nowiki></pre>
 
</nowiki></pre>
  
第44行: 第52行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# rm -f /mnt/ubuntu/etc/hostname
 +
# echo HOSTNAME > /mnt/ubuntu/etc/hostname
 
</nowiki></pre>
 
</nowiki></pre>
  
第51行: 第61行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# cp /etc/fstab /mnt/ubuntu/etc/fstab
 +
# kate /mnt/ubuntu/etc/fstab
 
</nowiki></pre>
 
</nowiki></pre>
  
第76行: 第88行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# cp /etc/network/interfaces /mnt/ubuntu/etc/network/
 +
# cp /etc/resolv.conf /mnt/ubuntu/etc/
 +
# kate /mnt/ubuntu/etc/network/interfaces
 
</nowiki></pre>
 
</nowiki></pre>
  
第81行: 第96行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# The loopback network interface
 
auto lo
 
auto lo
 
iface lo inet loopback
 
iface lo inet loopback
  
 +
# A dynamic ethernet interface
 
auto eth0
 
auto eth0
 
iface eth0 inet dhcp
 
iface eth0 inet dhcp
第91行: 第108行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# cp /etc/hosts /mnt/ubuntu/etc/
 +
# kate /mnt/ubuntu/etc/hosts
 
</nowiki></pre>
 
</nowiki></pre>
  
第103行: 第122行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# chroot /mnt/ubuntu
 +
# mount /proc
 
</nowiki></pre>
 
</nowiki></pre>
  
第112行: 第133行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# dpkg-reconfigure console-data
 
</nowiki></pre>
 
</nowiki></pre>
  
第122行: 第144行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# /usr/sbin/base-config new
 
</nowiki></pre>
 
</nowiki></pre>
  
 
In dapper, base-config was removed.  The main steps you need to run instead of base-config are:
 
In dapper, base-config was removed.  The main steps you need to run instead of base-config are:
 
<pre><nowiki>
 
<pre><nowiki>
 +
# tzconfig
 +
# dpkg-reconfigure --default-priority passwd
 +
# <edit /etc/apt/sources.lst>
 
</nowiki></pre>
 
</nowiki></pre>
  
第131行: 第157行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# dpkg-reconfigure locales
 
</nowiki></pre>
 
</nowiki></pre>
  
第138行: 第165行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# apt-get install linux-image-386
 +
# apt-get install grub
 
</nowiki></pre>
 
</nowiki></pre>
  
第145行: 第174行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# mkdir /boot/grub
 +
# cp /lib/grub/i386-pc/* /boot/grub
 +
# nano /boot/grub/grub.conf
 
</nowiki></pre>
 
</nowiki></pre>
  
第154行: 第186行:
  
 
title=Ubuntu
 
title=Ubuntu
  root (hd0,2)
+
root (hd0,2)
  kernel /vmlinuz root=/dev/hda3
+
kernel /vmlinuz root=/dev/hda3
  initrd /initrd.img
+
initrd /initrd.img
  
 
title=Windows
 
title=Windows
  root (hd0,0)
+
root (hd0,0)
  makeactive
+
makeactive
  chainloader +1
+
chainloader +1
  
 
title=Memtest86
 
title=Memtest86
  root (hd0,2)
+
root (hd0,2)
  kernel /boot/memtest86+.bin
+
kernel /boot/memtest86+.bin
  
 
</nowiki></pre>
 
</nowiki></pre>
第179行: 第211行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# grub --no-floppy
 
grub> root (hd0,2)
 
grub> root (hd0,2)
 
grub> setup (hd0)
 
grub> setup (hd0)
第198行: 第231行:
 
<pre><nowiki>
 
<pre><nowiki>
 
title=FunkyUbuntu
 
title=FunkyUbuntu
  root (hd1,2)                          <--- refers to /dev/hdb3
+
root (hd1,2)                          <--- refers to /dev/hdb3
  kernel /vmlinuz root=/dev/hdb1        <--- refers to what you would think of as /boot/vmlinuz
+
kernel /vmlinuz root=/dev/hdb1        <--- refers to what you would think of as /boot/vmlinuz
  initrd /initrd.img                    <--- refers to what you would think of as /boot/initrd.img
+
initrd /initrd.img                    <--- refers to what you would think of as /boot/initrd.img
 
</nowiki></pre>
 
</nowiki></pre>
  
第216行: 第249行:
  
 
<pre><nowiki>
 
<pre><nowiki>
 +
# exit            <-- exits the chroot subshell
 +
# umount /mnt/ubuntu
 +
# shutdown -r now
 
</nowiki></pre>
 
</nowiki></pre>
  

2007年5月24日 (四) 10:38的版本

Introduction & warning

This page describes how to install Ubuntu Linux on a machine using a Knoppix LiveCD and a network connection. There's no need for the Ubuntu install disk.

To start, boot off the Knoppix CD and open a terminal window. Use su to give yourself root privileges. Knoppix won't ask for a password.

Set up the install partition

Create the partition where you want to install Ubuntu. Use qtparted to make your life easier. In this document, I'm installing Ubuntu onto /dev/hda3. Don't forget you also need to create a swap partition if you don't already have one. After partitioning, it's a good idea to reboot the system to force the partition tables to be reloaded.

Format your filesystems. Use either mke2fs -j /dev/hda3 or mkreiserfs /dev/hda3 depending on whether you want ext3 or ReiserFS.

Now, mount your install environment. In this example, we're going to install the new ubuntu system onto /dev/hda3 mounted on /mnt/ubuntu.

# mkdir /mnt/ubuntu
# mount /dev/hda3 /mnt/ubuntu

Get debootstrap scripts

Knoppix includes debootstrap, but doesn't have the ubuntu scripts. The only way I know of to get these scripts is to get them from the debootstrap source archive.

1) Grab the latest debootstrap_*.tar.gz from http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/ Save the archive into the /home/knoppix/tmp directory because /tmp is probably too small.

2) Uncompress and extract the archive, then cd into the newly created directory and build the program:

# cd /ramdisk/home/knoppix/tmp
# tar zxvf debootstrap_*.tar.gz
# cd debootstrap-*
# make
# chmod +x debootstrap

Run debootstrap

You should run the debootstrap you just built, which requires a slightly odd invocation:

# DEBOOTSTRAP_DIR=`pwd` ./debootstrap --arch i386 dapper /mnt/ubuntu http://archive.ubuntu.com/ubuntu dapper

The Ubuntu debootstrap will now run the Ubuntu scripts. If your network is unreliable, you may need to run debootstrap multiple times to get all the files. It resumes where it left off.

Near the end of debootstrap's copious output, you should see "Base system installed successfully". If not, remove everything in /mnt/ubuntu apart from the lost+found directory and try again.

Set up the host name

Of course, you should replace HOSTNAME in the command below with the desired name for your machine. You need to remove /mnt/ubuntu/etc/hostname first, because it will be a symbolic link to Knoppix's /etc/hostname by default due to a bug in debootstrap.

# rm -f /mnt/ubuntu/etc/hostname
# echo HOSTNAME > /mnt/ubuntu/etc/hostname

Set up fstab

1) Create your fstab. Knoppix has already created one that is appropriate for your system, but you do need to make some changes.

# cp /etc/fstab /mnt/ubuntu/etc/fstab
# kate /mnt/ubuntu/etc/fstab
  • Change the mount points on the partition(s) you set up in step 1
  • Change their options to defaults
  • Change /mnt/auto/floppy to /mnt/floppy. Do the same for /mnt/cdrom.
  • Add sync to the options for /mnt/floppy
  • Remove the /dev/pts line -- not needed?

Here is a decent /etc/fstab:

proc     /proc    proc    defaults   0 0

/dev/hda3 /       ext3    defaults   0 1
/dev/hda5 none    swap    defaults   0 0

/dev/fd0  /mnt/floppy auto user,noauto,sync,exec,umask=000 0 0
/dev/cdrom /mnt/cdrom auto user,noauto,exec,ro   0 0

Set up Networking

Start with Knoppix's network/interfaces and resolv.conf files, then modify them to suit your needs.

# cp /etc/network/interfaces /mnt/ubuntu/etc/network/
# cp /etc/resolv.conf /mnt/ubuntu/etc/
# kate /mnt/ubuntu/etc/network/interfaces

Here is a typical interfaces file

# The loopback network interface
auto lo
iface lo inet loopback

# A dynamic ethernet interface
auto eth0
iface eth0 inet dhcp

You also need to set up the hosts file to include your machine name. Change "Knoppix" to your machine name. Feel free to delete all the IPV6 stuff.

# cp /etc/hosts /mnt/ubuntu/etc/
# kate /mnt/ubuntu/etc/hosts

Here is my /etc/hosts for lea.rinspin.com.

127.0.0.1   localhost
127.0.0.1   lea.rinspin.com     lea

Enter the install environment

# chroot /mnt/ubuntu
# mount /proc

You don't need to worry about the root partition because you mounted that in the first step. You'll need to mount /proc and any other partitions that you set earlier.

Set up base system

Set up the keyboard.

# dpkg-reconfigure console-data

Set up timezones, users, and apt. This is a lengthy process that will try to launch GDM at the end. Of course, GDM can't run because Knoppix already has the screen, but the screen may flash as they fight.

NOTE: it's probably more correct to skip to the next step and install the kernel and bootloader now. Then, reboot into the newly installed system and run base-config. I haven't tried this yet.

FOLLOW UP: Installing the kernel and bootloader then following up with the base-config works. /etc/network/interfaces and /etc/apt/sources.list must be setup correctly. Also consider using ubuntu apt repository mirrors http://wiki.ubuntulinux.org/Archive

# /usr/sbin/base-config new

In dapper, base-config was removed. The main steps you need to run instead of base-config are:

# tzconfig
# dpkg-reconfigure --default-priority passwd
# <edit /etc/apt/sources.lst>

Set up locales. You might want to skip this step if you only want to use English on this machine.

# dpkg-reconfigure locales

Install the kernel and bootloader

The default bootloader for Ubuntu is grub.

# apt-get install linux-image-386
# apt-get install grub

Now configure grub to boot off hda3. Because Linux starts numbering at hda1, but grub starts at hda0, you must subtract 1 from the partition number. (hd0,2) is equivalent to hda3, and (hd1,0) is equivalent to hdb1.

I'm not sure why grub can't find stage1 in /lib/grub, where the grub package installs it. Until I know more, the easy way to fix this is to simply copy everything to /boot/grub, where grub is looking for it.

# mkdir /boot/grub
# cp /lib/grub/i386-pc/* /boot/grub
# nano /boot/grub/grub.conf

Here's a sample /boot/grub/menu.lst that you can use.

default 0
timeout 4

title=Ubuntu
root (hd0,2)
kernel /vmlinuz root=/dev/hda3
initrd /initrd.img

title=Windows
root (hd0,0)
makeactive
chainloader +1

title=Memtest86
root (hd0,2)
kernel /boot/memtest86+.bin

Remember to make a symbolic link from /boot/grub/grub.conf to /boot/grub/menu.lst (that is what grub looks for at boot time...)

ln -s /boot/grub/grub.conf /boot/grub/menu.lst


Run grub to install the bootsector in the MBR.

# grub --no-floppy
grub> root (hd0,2)
grub> setup (hd0)
grub> quit
Grub usage notes and example

The 'root' option in Grub establishes the reference point for subsequent paths and filenames in Grub only. It has nothing in particular to do with the 'root' option that is passed to the kernel. To illustrate this point, here is a somewhat arcane example:

Consider the case that

  • the kernel and initrd images are located on /dev/hdb3 (third partition of the second drive), which will ultimately be mounted as /boot
  • the Grub configuration files and stages are in the 'grub' subdirectory of /dev/hdb3
  • the BIOS is set to load a MBR from /dev/hdc
  • the kernel is to mount /dev/hdb1 as /

You would then use the following grub.conf

title=FunkyUbuntu
root (hd1,2)                          <--- refers to /dev/hdb3
kernel /vmlinuz root=/dev/hdb1        <--- refers to what you would think of as /boot/vmlinuz
initrd /initrd.img                    <--- refers to what you would think of as /boot/initrd.img

and these Grub commands

grub> root (hd1,2)                      <--- means that grub/menu.lst is relative to /dev/hdb3
grub> setup (hd2)                       <--- will install MBR on /dev/hdc
grub> quit
Restart into Ubuntu

Now unmount the drives, exit the subshell, and reboot! Your Ubuntu system should be ready to go.

# exit             <-- exits the chroot subshell
# umount /mnt/ubuntu
# shutdown -r now

Troubleshooting

This page was created with the excellent help found at http://archive.ubuntulinux.org/ubuntu/dists/warty/main/installer-i386/current/doc/manual/en/apcs03.html . Another page that might prove helpful is http://www.inittab.de/manuals/debootstrap.html .