How to create your custom live-cd/dvd/usb under debian or ubuntu

It exists a famous script named remastersys, you can get it using aptitude.
First, add the following repository to your sources.list

$ sudo echo “deb debian/” >> /etc/apt/sources.list
Next update your repos:
$ sudo aptitude update
$ sudo aptitude install remastersys
$ sudo remastersys
and select (to make a distributable livecd/dvd of your system
at the end of process the remastersys will generate a iso file named customdist.iso in the directory :

Other way :
You can also get the source file as:
$ wget
$ tar xzvf remastersys_2.0.15-1.tar.gz
$ cd remastersys-2.0.15/
$ sudo ./remastersys dist

this will generate a custom iso file, of the actuel environement named customdist.iso.

Now, if it’s ok you can burn your live-cd/dvd using wodim
/usr/bin/wodim -v gracetime=2 dev=1,0,0 speed=48 -dao driveropts=burnfree -eject -data customdist.iso

Create a live system on USB flash drive.

In order to boot from your usb flash drive, your bios must support booting from an usb device,
and you have to install on it a boot loader like grub or a syslinux on it.

this tutorial focus on the use of syslinux:

First of all, get syslinux using aptitude or apt-get like:
$ sudo aptitude install syslinux

Plug in the USB memory stick. The USB device should also be visible by the command
$ sudo fdisk -l

Then create a FAT16 partition on the USB flash drive, using fdisk.
here we support that the usb reside on /dev/sda.

$ sudo fdisk /dev/sda
Create a new partition (enter n):
Choose Primary partition (enter p), Partition number (enter 1).
The size of the partition should be at least as larger as the LiveCD/DVD you want to install on the USB device.
Afterwards, change the type (enter t) of first partition (enter 1) to W95 FAT16 LBA (enter e),
and make first partition active (enter a and select 1).
Before writing the partition table to the USB flash drive (enter w), you can print the changed settings (enter p).

Now format the first partition (/dev/sda1) as FAT16:
$ sudo mkfs.msdos /dev/sda1

Make the USB memory stick bootable using syslinux
# sudo syslinux /dev/sda1

We can mount our partition, on /media/usb if the directory not existe create it.
$ [ -d /media/usb ] || /usr/bin/sudo mkdir /media/usb
$ mount /dev/sda1 /media/usb

create /mnt/iso directory, here we will make the contenent of our customdist.iso file.
$ [ -d /mnt/iso ] || /usr/bin/sudo mkdir /mnt/iso
$ sudo mount -o loop customdist.iso /mnt/iso

and copy the hole of files and directory to the usb drive.
$ sudo cp -fr /mnt/iso/* /media/usb/

Finally, rename the file /media/usb/isolinux.cfg to syslinux.cfg
$ sudo mv /media/usb/{isolinux.cfg,syslinux.cfg}

Also, the usb flash memory is ready for use.


Author: Ali MEZGANI

My name is MEZGANI Ali. I was born back in 1978 in Rabat Morocco. My interests are Debian Linux , programming , science and music.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s