Installing Ubuntu From Knoppix 

https://help.ubuntu.com/community/Installation/FromKnoppix

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.

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 [WWW] 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

Run debootstrap 

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

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

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

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

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.

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

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

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.

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 install the kernel and bootloader. Then, reboot into the newly installed system and run base-config.
# /usr/sbin/base-config new

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

# dpkg-reconfigure locales

NB, Doing base-config is essential to use apt in the chroot environment.

documented on: 2006-02-22 00:04:03 by DennisKaarsemaker

Installing Ubuntu From Another Distro 

https://help.ubuntu.com/community/Installation/FromAnotherDistro

Introduction and Warning 

The intent of this howto is to describe how to install Ubuntu from within your current distribution, replacing your current distribution ON THE SAME PARTITION. In case you haven't guessed, this is a rather tricky situation, and can cause you to lose information, even though care is taken to try to prevent this.

This is mainly useful in the case where you have no boot Ubuntu install disk, and no cd burner. It can also be useful for saving your old homedirs when you have no way to back them up, and your filesystem is of a type that can't be resized to allow for a new partition. Its main purpose, though, is to satisfy the wreckless urge to risk your data over an operating-system change, rather than waiting until one can back it up. Keep in mind that, on the chance that something goes wrong and you turn your computer into a dead badger, you should have a known-to-work install disk for another OS or distribution available to you. You should also recognize that you are taking responsibility for your information (or the loss thereof) into your own hands by following this howto. You should be at least an intermediate linux user.

Before We Begin 

Things You Will Need

  1. Any linux boot/rescue cd with standard utilities for your filesystem (often the install disk for your current distribution will work fine, as long as you can get to a shell)

  2. A network connection. There's no need for the Ubuntu install disk.

  3. The package "alien", to convert the install package to your own distribution's format, from that of Ubuntu. You should install this now, if it isn't already on your system.

  4. To verify that Ubuntu supports your current filesystem.

  5. To convert your current distribution's bootloader to "grub", unless it already uses it.

We will be assuming RPM as the package management for the original OS in this howto, but alien converts between quite a few formats.

Summary of Actions to be taken 

The following list is for those who just want to race ahead and find out.

  1. [WWW] Get debootstrap(w/install scripts), convert with the "Alien" package converter, and install to original system.

  2. Run the install scripts, wait, configure the new system, and install a few things.

  3. Configure bootloader and reboot to rescue disk.

  4. Move some things around — out with the old, and in with the new. :-)

  5. Boot to Ubuntu, with fingers crossed.

  6. Install and configure the rest of the system

Shall we?

Installation 

Install debootstrap and Ubuntu debootstrap scripts 

Wait for the install to finish. If your network is unreliable, then you may need to run debootstrap multiple times to complete the installation. It should resume where it left off. If it has successfully installed, you should see the message "Base system installed successfully" near the end of its output. If you run into a problem unrelated to networking, you may need to delete all of the installed files and directories and restart.

Set up fstab 

Here is a decent fstab file:

#FileSystem MountPT     FSType  Options    Dump fsck-order
#System Mounts..
/proc       /proc       proc    defaults   0    0
/sys        /sys        sysfs   defaults   0    0

#Hard Drives..  ..edit these if necessary
/dev/hda2   none        swap    defaults   0    0
/dev/hda3   /           ext3    defaults   0    1
/dev/hda6   /home       ext3    defaults   0    2
#Uncomment and edit the following line if you have a boot partition
#/dev/hda1  /boot       ext2    defaults,noauto   0    0

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

Make sure your / entry has options set to 'defaults', otherwise sudo may not function: "Sorry, sudo must be setuid root."

Set up Hostname and Networking 

Hostname 

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

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

Enter the install environment 

Chroot puts you in the new Ubuntu environment. "mount /proc" mounts proc in the new environment. You may also need to mount /sys, if you are on a 2.6 kernel. If you run into errors accessing devices, mount /sys.

If you have a sepparate boot partition, mount /boot before you do the other three commands.

# mount /boot #If you have a sepparate boot partition.
# mount -o bind /boot /mnt/ubuntu/boot
# chroot /mnt/ubuntu
# mount /proc

Set up base system 

Setting up your locale and keyboard.

Note If you do not do this then dpkg, a system configurator, may have problems, due to a bug in certain versions of dpkg.

I use en-US ISO 8859-1, as I don't often type international characters, and can use a character selector in X when I do. en-US ISO 8859-15 contains mapping to type international characters. (eg. "u etc)

# dpkg-reconfigure locales console-data

Install the kernel and bootloader

When installing the linux kernel below, you may want to install one specifically for your particular processor.

Your options are: linux-image-386 Safest linux-image-686 Optimized for Intel PPro/Celeron/PII/PIII/PIV linux-image-686-smp Intel multiprocessor or hyperthreading machines. linux-image-k7 AMD K7, Athlon, AthlonXP etc. and higher. linux-image-k7-smp AMD K7, etc. Multiprocessor systems

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

Configuring Grub for Both Systems 

As was mentioned initially, your original distribution should be using Grub. Grub is much more flexible than Lilo, and works very well for our purposes. Since your present/original system should already boot from Grub, all we have to do here is edit the menu.lst file to add Ubuntu.

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

Edit /boot/grub/menu.lst (and/or /boot/grub/grub.conf). If you have both, check and see if they are identical. If so, do the following.

rm menu.lst
ln -s grub.conf menu.lst

If they are not identical, either edit them both or determine which one your system boots from normally, keep that one, and make a link by the name of the original file which points to the file you kept (as above).

Insert the following into the file, with the following caveats.

  1. "root (hd0,0)", replacing (hd0,0) with the device that contains your kernels. This is usually either your root or boot partition.

  2. "kernel /vmlinuz root=/dev/hda3" and "initrd /initrd.img"

    1. If you have no boot partition, using the /vmlinuz and /initrd links should be fine.

    2. If those do not work, use "kernel /boot/<YourCurrentKernel>" and "initrd /boot/<YourCurrentInitrd", I.e. vmlinuz-2.6.8.1-3 and initrd.img-2.6.8.1-3, respectively. You'll need to update these if and when you update your kernel in the future.

    3. BE SURE to update the "root=/dev/hda3" part to whatever partition is your root partition! If you don't, it will not boot past loading the kernel and initrd. It will panic and suggest using a proper device in the root= line.

  3. "initrd /initrd.img" Make sure you use the matching initrd for your kernel.

Example:

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

Example of modified /boot/grub/menu.lst

default 0
timeout 4

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

title=My Old Distribution
  root (hd0,0)
  kernel /bzImage.customYopper
  initrd /initrd.customYopper

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

The version of Grub which your current distribution installed is in the bootsector, and will read the changes on bootup.

Now unmount the drives, and exit the subshell.

# exit             <-- exits the chroot subshell
# umount /mnt/ubuntu/boot

If you want, you can do an optional reinstall of grub, but it should be unnecessary. Replace hda with your system's default boot disk.

# grub-install /dev/hda

Insert the recovery CDRom and reboot.

Swapping in your new Ubuntu 

Mounting 

Once your recovery CD is done booting, first make a directory to mount the disk to.

mkdir /mnt/disk

If that doesn't work, type "mount" by itsself, and look at the feedback. You're looking for a directory which has a read-write ramfs mounted.

# mount
none on /example1 type ramfs (rw)

There, the directory /example1 is mounted! What a surprise.

If there is no mounted ramfs, try:

# mount -t ramfs none /mnt

Feel free to change /mnt to some other non-essential directory of your choice.

Now, to mount your root partition — Do the following, but change /dev/hda3 to whatever your root partition is:

# mkdir /mnt/hd
# mount /dev/hda3 /mnt/hd
Moving 

Move your old Distribution into a backup dir. If you have a boot partition, do not mount it.

# cd /mnt/hd
# mkdir OldDistro
# mv * OldDistro/
# ls -a

If the ls -a shows any files other than OldDistro, ., and .., move them into OldDistro. Then, move Ubuntu into the present directory.

# mv .hiddenfiles OldDistro/
# mv OldDistro/mnt/ubuntu/* ./
# ls -a OldDistro/mnt/ubuntu/

If the ls -a shows any files, move them into the current directory (/mnt/hd):

# mv OldDistro/mnt/ubuntu/.dev ./

Restore original boot directory (containing files to boot both distributions):

# mv boot boot.bak      #This file should be empty anyways.
# mv OldDistro/boot ./

Now, what you should have in /mnt/hd (your hard drive):

boot/

(a directory containing boot files for both systems)

Ubuntu/

Standard linux directories: /mnt, /opt, /var/, /proc, /dev, etc..

OldDistro/
  • Standard linux directories, but not the ones you want. ;-)

  • Don't forget, your old home directories are in here!

Now, unmount and reboot, crossing fingers!

cd /
umount /mnt/hd
shutdown -r now

Don't forget to eject the rescue cd before next bootup. ;-)

Finish Setup 

Set up timezones, users, and apt. This is a lengthy process that will try to launch GDM at the end. Once that's done, if you're not in your new desktop, then reboot again, and all should be started.. :-)

# /usr/sbin/base-config new
troubleshooting 

This page was largely written while I was very tired. Please look for mistakes and fix them as appropriate.. :-) I know this is an atrocity of textual formatting. :-(

This page was taken mainly from the Installation/FromKnoppix. References from the Installation/FromKnoppix: