Friday, July 11, 2008

LAMP on Ubuntu


I built a new server for home use (dual cpu's, u160 scsi controller with scsi drive plus an ide hd and 2 gig of ram) but it locks up when grub starts. My theory is the mix of scsi and ide drives is the problem so i hope to pull the ide drive this weekend and start again).

The idea is to install the server distribution but then to add the desktop gui on top. So we added an Nvidia 64mb video card, the 4xxx series. One neat thing about this machine is it using my 1984 Model M full-size IBM keyboard, yes the one with the clack clack keys. I used it daily until i bought a new wooden computer desk with a smaller keyboard tray so i switched about 7 years ago to the Model M small size version which i've been using daily since. I have a backup small one and a backup large one. There is a web site devoted to the model M somewhere - the best keyboard ever made.

However, since that project is temporarily on hold that gives me an change to try the reverse - to install a LAMP environment on the ubuntu desktop. This is trivial on windows or a mac thanks to the MAMP and WAMP binary packages but it is more difficult on linux. Ironic that the most popular development environment is hard to put on a linux desktop. You basically have to download and install/configure the separate components - Apache, PHP, mySQL.

We have been experimenting with the LAMP stack running on a USB stick (server2go) to get around the IT department. So i looked around and found a similar package for linux called xampp.

Downloaded the xampp-linux-1.6.6.tar.gz package to the laptop and extracted the lampp folder to my home directory and read the releasenotes. You get Apache 2.2.8, mySQL 5.051a, PHP 4 and PHP5 along with phpmysadmin, sqlite and a bunch of stuff. As usual with some OSS there are no directions - you have to figure out what to do.

There is a shell script named lampp so we open it in a text editor to check for documentation. It looks like this script stops and starts xampp. We assume you need to be root to do this! So we have to open the terminal and do:

sudo ./lampp

Let's give it a whirl. We run Applications, Accessories, Terminal and then do cd lampp and sudo ./lampp

The results is a list of options that need to be included such as:

start - starts xampp stop - stops xampp startmysql - starts only mysql php4 - activates php4 instead of php5 panel - starts graphical xampp control panel

Ok let's try the GUI. We do sudo ./lampp panel and get an error message about no such file or directory. Perhaps the gui is not installed?

So let's try starting lamp. Similar result - lots of error messages no such file or directory. Looks like it is searching for /opt/lampp so maybe it has to be installed there? Would be nice to have some documentation with the package. Looks like we have to goto the project home page.

Off to the web we goto http://www.apachefriends.org and find the documentation for Xampp and there is a FAQ for Linux. Lots of information on upgrading but this is a new install. Ah, we see an article by Nils-Erik Frantzell on installing. A few years old but might be useful. He suggests:

tar xvfz xampp-linux-1.4.7.tar.gz -C /opt

Obviously we change the file name to 1.6.6 but the /opt information is useful as we suspect the XAMPP needs to be there. He also confirms that ./lampp start is the way to go. We also see an article by Dalibor Dvorski on installing. Let's check it out. It's a pdf so we have to temp enable scripting for his site to download the file. This is more recent (2007). Unfortunately it uses Windows. However, it contains useful info on using Xampp which might be handy for the class.

So back to the terminal to do:

sudo tar xvfz xampp-linux-1.6.6.tar.gz -C /opt

And success - the files are now all extracted to the correct locations. Nothing helps like documentation! Many IT people forget that the specific knowledge they have acquired is not shared by all (particularly as they don't document) and they are constantly amazed by this fact.

Anyway - lets try out the GUI again. We do cd /opt/lampp to change to the xampp folder and there we try sudo ./lampp panel and get an error trying to execute the python program xampp-control-panel.py on line 21. Looks like an undefined symbol. So we do:

sudo ./lampp start

and get the message that apache has started with php5 and mysql and proFTPD. We fire up Firefox and goto http://127.0.0.1 (we could also use localhost) which is the address of our laptop and the Xampp home page is presented.

There is a nice menu on the side with a STATUS page and the phpmyadmin tool as well as a phpslqlite tool. I like the inclusion of the webalizer web log tool and the demo applications that ship with the package. Very nice - will have to consider moving to this for the winter course instead of server2go. Which means we have to test out the windows version as the IT dept is microsofties.

Time for some lunch so we do sudo ./lampp stop and everything comes to a nice halt. Impressive package - poor instructions.

The xampp homepage is http://www.apachefriends.org/en/xampp.html

PS - it turned out the problem with the lamp machine was not the ide vs scsi boot issue but that i forgot there were 2 scsi controllers and i was setting the scsi id of the boot drive on the wrong controller. What threw me off was the ubuntu found the scsi drive and installed ok but the system could not find the drive at boot time. Once i fixed that problem by removing the 2nd scsi controlled the system booted fine to ubuntu server. We have a number of tasks to do here - fix samba to use our network instead of the default workgroup, plus adding the users and install the desktop gui plus some GUI server management utilities for apache and mysql.

Ok - finally back to this. At the $ prompt we did:

sudo apt-get install ubuntu-desktop

and after entering the root password the install was underway. oops it stopped with an error, "unable to fetch some archives". So we do:

sudo apt-get update

Ok it's done. Been a long time since i've done this - i think startx used to start x windows and we may have to change the runlevel to get it to load at start. That takes me back to redhat 5 which is still around here somewhere. Hmnn it say xinit has not been installed. So we sudo apt-get it and it installs.

xinit aborts saying there is no X11 directory. Obviously the desktop depends on having x plus a window manager etc - you might think these dependencies get installed with the desktop but it looks like not. We may have to spend some time researching how to install the gui onto the server version.

No comments: