Tuesday, May 13, 2008

cd remastering of ubuntu

1Hi all. For doing anything,we have to first think of the need / reason behind it, unless you are doing that as a hobby. In wikiocean1, when I was first asked to do remastering for openbravo and crm, I was a little bit doubtful since I am going to do it first time. But then I kept faith on open source community documentation (which is always there) and agreed.
Our company, wikiocean wants to make hundreds of installations of openbravo and crm at various location. There may not be internet connection. So company want all in one cd / dvd. So that even our hardware people can install it. In company we were using ubuntu / kubutu7.04. So the obvious choice is kubuntu7.04 for user friendly look and feel for end user.
There is plenty of help available on forums and other sources. Also my friend Amit Karpe also helped me whenever required.
For that I followed following common steps for sugarcrm and openbravo both . There are some changes also. For openbravo there should be tomcat and postgres which is crucial. For crm, there should be php and mysql. The final openbravo dvd is in ready to install state without requiring other resources. The final CRM disc is in all installed state.
Install or Server Install CD.

System Requirements

1. At least 3-5 GB of free space

2.At least 512 MB RAM and 1 GB swap (recommended)

3.squashfs-tools

4.mkisofs

5.An Ubuntu kernel with squashfs support (present in Ubuntu 6.06 and later)

6.QEMU, VirtualBox or VMware for testing (l tried with qemu and vbox. But for my 512mb RAM which I later updated to 1 gb; they are too slow.)

Steps :

To Load the squashfs module:

sudo modprobe squashfs


To copy image of 7.04 ubuntu:

mkdir ~/image

cp kubuntu-7.04-i386.iso ~/image/

cd ~/image


Mount the iso image:

sudo mount -o loop kubuntu-7.04-i386.iso /mnt

Extract .iso contents into dir 'extracted' (create it first):

rsync --exclude=/casper/filesystem.squashfs -a /mnt/ extracted


Mount the squashfs filesystem:

mkdir squash

sudo mount -t squashfs -o loop /mnt/casper/filesystem.squashfs squash


Extract squashfs contents into dir "remaster":

sudo cp -a squash/* remaster/


To have network connection within chroot

sudo cp /etc/resolv.conf remaster/etc/

sudo cp /etc/hosts edit/etc/


Change the root to extracted root:

sudo chroot remaster

mount -t proc none /proc

mount -t sysfs none /sys

mount -t devpts none /dev/pts


For locale issues and import GPG keys:

export HOME=/root

export LC_ALL=C


Customizations

To view installed packages by size

dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | less


to remove packages:

apt-get remove --purge package-name


Then added some new packages:

apt-get install package-name


Can also execute other commands fr customization. But avoid playing with users and rights or ownerships.

To remove any temporary files :

apt-get clean

rm -rf /tmp/*

rm /etc/resolv.conf


To unmount special filesystems and exit

umount /proc

umount /sys

umount /dev/pts

exit


To create iso image:

chmod +w extracted/casper/filesystem.manifest

sudo chroot remaster dpkg-query -W --showformat='${Package} ${Version}\n' > extracted/casper/filesystem.manifest

sudo cp extracted/casper/filesystem.manifest
extracted/casper/filesystem.manifest-desktop

sudo sed -ie '/ubiquity/d' extracted/casper/filesystem.manifest-desktop


To Compress filesystem:

sudo rm extracted/casper/filesystem.squashfs (*missing)

sudo mksquashfs remaster extracted/casper/filesystem.squashfs

Then image name is changed to ERP in file extracted/README.diskdefines

To calculate and replace md5sum:

sudo -s

rm extracted/md5sum.txt

(cd extracted && find . -type f -print0 | xargs -0 md5sum > md5sum.txt)

exit


To Create Iso:

cd extracted

sudo mkisofs -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubunTRO0.2-i386-customERP.iso .

No comments: