Hi All,

You've found the blog of Leighly G Penrod (better known as Lee Penrod). Over the years I've helped thousands of people with technology questions. I started this blog to share some of the problems I've personally solved, and to act as a place to put bits of new articles before they are ready for release.

In the past I wrote serveral things published by I worked for them for several years including doing various bits of technical writing. Although I no longer work for them, I do still put up some content on my blog now and then.

If you are not familiar with my prior work, feel free to see these popular guides I have written-

How to Install Front USB 3.0 Connections

How to Install Front USB
(connecting front ports to the motherboard)

Understanding System Memory and CPU speeds:
A layman's guide to the Front Side Bus (FSB)

Hooking up a Neon Light
[Old Article on making a card neon from Walmart work in a PC]

Sunday, September 1, 2013

A few notes on running LAMP on Ubuntu Deskop 13.10

Recently I decided I wanted a general purpose walk around style Linux install I could have on an external hard drive.  I do a lot of PHP development, so the idea was to have an easy to use test bed running a LAMP stack. Since my preferred distribution generally is Ubuntu Server I decided to go ahead and use a related product - Ubuntu Desktop.

Things went so-so.  I figured I'd make this post to talk about a couple of fixes I had to make and some configuration suggestions.

#1 - Getting Ubuntu on the drive. 

This is pretty basic, but not necessarily the first thing people think about.  The easiest way to do this is to go to Ubuntu's site and grab a current ISO of Ubuntu Desktop, but the ISO to a blank DVD-R and you've got a live CD. (I had a 13.04 disk I keep around for disaster recovery and Antivirus cleanup reasons). 

Once you have a live CD, use it to boot on the machine you will use the external with or one of similar architecture (i.e. don't try and make a 64bit external on an ancient 32bit only machine).   Select the appropriate options to try Linux, and you'll get the Linux live CD desktop environment in a little bit.

At that point, attach the external hard drive to the machine and give it a sec to be detected. Be aware that this should be a blank drive when you start, you're going to end up wiping out data otherwise. Once it's detected, choose the icon on the side bar of the desktop to install Ubuntu.   Carefully navigate the options and choose to install Ubuntu to the the external drive (probably /sdb or /sdc .  If you haven't done that before the main thing is you will need to create a few partitions -- at least one for / and one for swap on the external + any that you are prompted for.

For my actual install I chose to leave a small area at the end of the drive unpartitioned, as this left me a space I could partition under windows later to provide a easy to use swap space. You may want to do the same.

So once you walk through the install, shut down, take out the live CD, and move the external hard drive to the machine you will mostly use it on (if you used a different machine).  Let Ubuntu boot for the first time on that hardware, and go ahead and log in.

Note 1The easiest way to boot to that drive is going to be either by changing your boot order in bios or using the boot selection key at boot up on your machine. This is sometimes oddly called "BBS menu or BB menu or something similar".  For most machines the boot selection menu is key F11 right before trying to boot the first hard drive (you usually have to be pretty quick). Sometimes F10 or F8 are also used.  If you don't have that usually the keys to enter actual bios are either DEL, ESC, F1 or F2 depending on who made the motherboard in the machine. 

Note 2: After my first boot into Ubuntu Desktop on 13.04 I had a strange non-critical error that occurred on the the first boot related to configuring "Desktop Applications". Going through the various screens about the bug and looking at the official support thread about it seemed to indicate that it was a known problem. For me the error did not re-occur after rebooting.  

#2 Getting a LAMP stack going on Ubuntu Desktop 13.04 / 13.10

So the path I chose to take to get a LAMP stack going was basically to replicate what you get if you pick the LAMP options when configuring Ubuntu Server.  To do that, drop to a terminal  ( if you haven't done that before under Ubuntu Desktop -- to open terminal Click the Ubuntu Logo icon at the top and type terminal into the search blank, then open terminal).   At the terminal either do:

sudo bash
apt-get install lamp-server^


sudo apt-get install lamp-server^

and fill out any questions it asks you along the way like what mysql password you want.

Once you've completed that, you'll want to go do your minor modifications to Apache's config (specifically adding a ServerName line so it doesn't complain).  In my case since this was just a development install I just added a ServerName line to apache2.conf  under   /etc/apache2/    but for a more complicated install you'd want to set your virtual hosts under the appropriate folders or what have you as you would on a normal setup.    Of course after doing this you'll want to restart Apache with something like sudo service apache2 restart   

#3 Fixing some issues this makes

For my actual install

sudo apt-get install lamp-server^

Installed PHP version 5.5.1-1.   For whatever reason, that version is broken for php JSON out of the box -- or at least the one from apt is.  You need JSON working if you want to run want to run something useful like PhpMyAdmin or common frame works like CodeIgniter

There are conflicting explanations for this problem out there and conflicting instructions on fixes. Here is what worked for me (at terminal):  [ Some of these commands probably aren’t part of the actual fix but probably won't hurt anything. This was my history. ]

become root ( sudo bash )

apt-get update
apt-get upgrade    
( that moves you up to 13.10 desktop -- at least it did for me at the time of this writing)


apt-get remove php5
apt-get install php5
apt-get install php-pear
apt-get install php5-dev
apt-get install php5-json
apache2ctl restart    
( or service apache2 restart)

After doing that, for me I went from phpMyAdmin failing setup due to json being missing, to phpMyAdmin setup working.   A check of version via <?php phpinfo(); ?> or php --version showed the same version info as before the above process -- just JSON works.

#4 Minor Other notes

I suggest installing the following:

sudo apt-get install mc
Installs midnight commander which gives you a new command at terminal: mc 
It is a command line file manager not unlike the old dos file managers of old or Norton commander.  It has a pretty powerful and easy to use search function that lets you find files you may have trouble locating.

sudo apt-get install Geany
Installs Geany which is a small and fast IDE and is a good analogue to something like NotePad++.  It might not do everything but it will help you trace things like curly braces and such when working on PHP code.

1 comment: