Pages

Friday, May 4, 2007

Installing really the Debian Linux in the USB pen drive

Create USB partitions
# cfdisk /dev/sda
# mkfs.ext3 /dev/sda1


Mount the sda1 partition where will be installed the basic dist.
# mount -t ext3 /dev/sda1 /media/usb

Install the basic debian with debootstrap:
# debootstrap etch /media/usb http://ftp.br.debian.org/debian

Copy your source.list :
# cp /etc/apt/sources.list /media/usb/etc/apt/

Install the grub in the /dev/sda:
# grub-install --recheck /dev/sda
...
(fd0) /dev/fd0
(hd0) /dev/hda
(hd1) /dev/sda

Copy your grub configurations:
# mkdir -p /media/usb/boot/grub
# cp /boot/grub/* /media/usb/boot/grub

Set up the grub boot:
# grub
grub> root (hd1,0) # define the first partition of the pen driver as root
grub> setup (hd1) # install the GRUB in the MBR
grub> quit

Change the roor dir to the USB:
# chroot /media/usb

All commands below are in the USB pen driver as root dir.
Update the list of the packages:
# aptitude update

Install the grub:
# aptitude install grub

Install the kernel image:
# aptitude install kernel-image
Create a symbolic link to the current kernel image?

You are attempting to install an initrd kernel image ...
This will not work unless you have configured your boot x loader to use initrd. ...
Do you want to abort now?

Update the grub and configure the menu.lst with the new kernel:
# update-grub

# vim /boot/grub/menu.lst
---
## ## End Default Options ##

title Debian GNU/Linux, kernel 2.6.18-4-686
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-4-686 root=/dev/sda1 ro
initrd /boot/initrd.img-2.6.18-4-686
savedefault

title Debian GNU/Linux, kernel 2.6.18-4-686 (single-user mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-4-686 root=/dev/sda1 ro single
initrd /boot/initrd.img-2.6.18-4-686
savedefault

### END DEBIAN AUTOMAGIC KERNELS LIST
---

Set the fstab:
# vim /etc/fstab
---
# /etc/fstab: static file system information.
#
#
proc /proc proc defaults 0 0
/dev/sda1 / ext3 defaults,errors=remount-ro 0 1
/dev/sda2 none swap sw 0 0
---

Set the hostname:
# vim /etc/hostname
---
usb
---

Configure the network:
# vim /etc/network/interfaces
---
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.

auto eth0
iface eth0 inet dhcp
---

Configura all basic configurations:
# dpkg-reconfigure -a
1 - Do you want system wide readable home directories?
2 - Packages that use debconf for configuration share a common look and feel. You can select the type of user interface they use.
Interface to use: Dialog
3 - Debconf prioritizes the questions it asks you. Pick the lowest priority of question you want to see:
Ignore questions with a priority less than: high
4 - Should man and mandb be installed 'setuid man'? No
5 - Enable shadow passwords?

6 - Create users and password.

7 - Running 'tzconfig' to set this system's timezone.
Your current time zone is set to Unknown
Do you want to change that? [n]: y

choose your locale at the menu.
2
Manaus

Exit from USB:
ragner-desktop:/# exit

Umount the USB pen driver with the new dist:
ragner-desktop:/media/usb# cd

ragner-desktop:~# umount /media/usb
umount: /media/usb: device is busy

If occur the error above:
ragner-desktop:~# ps -ef | grep root
...
root 20007 1 0 08:48 ? 00:00:00 /usr/sbin/cron
...
ragner-desktop:~# kill -9 20007

ragner-desktop:~# umount /media/usb


Reboot our system:
# init 6

Set the BIOS to do the boot by the USB pen driver.




4 comments:

Unknown said...

I guess this video can help you out, check out USB Protection

Unknown said...

Thank Reeva, I liked that video!

USB Protection

Unknown said...

I am very impress on your information , Its a really very impressive blog. I really got some another very nice information , so thanks for sharing these tips, .

rax said...

hi,You have a very good blog that the main thing a lot of interesting and useful! thanx. usb protection