Wednesday, May 14, 2008

Seeting php environment on linux (LAMP)

11There is enough documentation available for installation/ development of LAMPP applications. But since I have joined company "wikiocean, many people forget to do small things for doing php based web application development.
So here is one of the way I follows ...


XAMPP installation

I am using kubuntu7.04(feisty) on my machine though it doesn't matters much as I am installing from tar file.

First download the xampp for linux. If you can't find resource, go here111, you will also get the instructions.

XAMPP contains a number of useful packages that make it easy to do things like generate traffic reports and accelerate PHP content.

XAMPP comes with following packages and some another utilities.
  • Apache, the famous Web server
  • MySQL, an excellent, free, open source database
  • PHP, the programming language (latest versions )
  • Perl, the programming language
  • ProFTPD, an FTP server
  • OpenSSL, for secure sockets layer support
Plus there are many graphics packages, utilities, xml packages etc.

To install XAMPP on ubuntu:

If you don't have enough permissions, you may require sudo rights. so prefix with "sudo".

Untar it to /opt using the following command
tar xvfz xampp-linux-1.4.7.tar.gz -C /opt


XAMPP is now installed in /opt/lampp.

Now to start xampp do following

/opt/lampp/lampp start

(If you have apache/mysql running previously on your machine. You have to stop that first. then execute above command).

One can check the xampp is started or not by typing localhost in the address bar of browser and watching xampp page there.

Click the Status link in the left navigator to see that the necessary services have started up correctly.

Backups:

For taking backup,

/opt/lampp/lampp backup

You will want to add on your MySQL root password if you have it set to the end of that command.



1

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 .