What scenarios does this would likely involved you in? Well, for instance:

  • Creating an Ubuntu system on your USB stick because your lack of faith to trust all of your system to GNU/Linux.
  • Creating new system from your Ubuntu stick because you have become the enlightened.
  • Creating a customized *buntu flavour because you have become one.
  • Killing time because you have insomnia. 😀

Most likely I’m in reason #4. This scenario is tested on GNU/Linux Debian and Ubuntu. I played with Unstable/Experimental and Lucid.

#0 Backup your data on USB stick.

Don’t tell me that I didn’t warn you! 😀

#1 Set the partition

Stick your USB and seek what is the node file it representated.

$ dmesg | tail

Now, it would come up something like

 /dev/sdb1

or

/dev/sdc1

depending how funky your system is.

#2 Format the USB stick

$ sudo mkfs.reiserfs /dev/sdb1 -l "KEREN DEH"

I’m used to label the filesystem. This label is important that you may prevent from accidentally formatting that particular partition. (Been there, done that) Oh, before the holy war begin, let me warn you that my flavour on ReiserFS is subjective, stick with whatever your fave filesystem. Here the change: EXT3: mkfs.ext3, XFS: mkfs.xfs, JFS: mkfs.jfs

#3 Mount the filesystem

$ sudo mount /dev/sdb1 /mnt

#4 Debootstraping begins

$ sudo debootstrap lucid /mnt http://kambing.ui.ac.id/ubuntu/

The “

--arch amd64

” before “lucid” parameter is optional. It would come in handy if you are trying to make 64bit Ubuntu from 32bit system, vice versa. See the manpage for more information.

#5 Setup before chrooted to there

Mount all the important directory.

$ sudo mount /proc /mnt/proc -t proc

$ sudo mount /dev /mnt/dev -o bind

Optionally copy these files:

$ sudo cp /etc/hosts /mnt/etc

$ sudo cp /etc/resolv.conf

resolv.conf

is deprecated on desktop because of the

modem-manager

being. But, it won’t hurt you if you still use it.

$ sudo cp /etc/fstab /mnt/etc

Don’t forget to edit the /mnt/etc/fstab and delete the root directory entry (find “/” and delete it) because we are using USB stick.

#6 Chrooted there

$ sudo chroot /mnt

#7 Add a user

This is important! Don’t let your system userless…

# adduser user

Make him/her an admin.

# addgroup user sudo

By default Lucid is making everybody in the sudo group to be an admin. If you are using another, you could add yourself a group:

# addgroup penguasa

echo “%penguasa ALL=(ALL):ALL” >> /etc/sudoers

(Or just type

visudo

to edit the file properly)

#8 Install kernel

There are few flavours of the kernel. Desktop user usually stick with generic.

# apt-get install linux-image-generic

This virtual package will install

linux-image-generic-2.6.32-13

in time this writing. If you want, you could search for another linux kernel with

# apt-cache search linux image

#9 Install grub

# apt-get install grub2

Usually, it would let you choose where it would like to install. Install it into USB stick’s Master Boot Record/MBR (/dev/sdb). If later you would like to install it, the sane way to install is:

# dpkg-reconfigure grub-pc

Or, if you’re the rock star:

# grub-install /dev/sdb

To have GRUB reconfigured, i.e. generates the GRUB menu, do:

# update-grub

#10 Install your flavour

# apt-get install kubuntu-desktop

#11 Get some sleep!

It’s already morning and you have a life? No? Well, you could go on and try your new system by restart to the system.

~hiddenCurcolCrouchingDeadline