Adding LAMP to Ubuntu Desktop

OK, next step, adding the “AMP” (Apache, MySql, PHP) to the “L” (Linux) in the desktop version of Ubuntu 8.10. I’m actually writing this as I do this, so what I say now might turn out to need tweaking. But, I’ve got my 8.10 desktop installed, updated, and have made a few personalization one normally makes. Now I found this page at the Ubuntu site that looks as if it has all the info. So we’ll follow along and see if what that page say really works.
So, step one: from a terminal, enter: sudo tasksel install lamp-server

Took about 3 minutes, had to enter MySql password in the process.

So, now I open Firefox, enter the local address (http://localhost/) and there it is! The install worked. Total time, less than 10 minutes. But we’re not done. Need to talk to the outside world now, and set up virtual hosts so we can get in multiple ways on multiple test web sites.

So since I had my previous version set up to host a domain (using, more on how to do that later), I tired entering that name – nope, doesn’t work. Need to fix something. Tried my machines current real IP address. Nope. Think I might have to fix the router tables. As part of the install of Ubuntu by Fusion, each VM gets its own MAC address, which is what the router uses to assign a local IP to connected machines. So I use “ifconfig” to get my current VM’s IP.

So now I’m in the router admin panel, and there is the ubuntu machine listed in the LAN computer table. Now I have to change some settings for the router’s virtual server tables. This will likely be a bit different on each router, but on my D-Link it is under the Advanced tab. I need three entries – HTTP, HTTPS, and SMTP. These need the correct Port numbers (HTTP: 80, HTTPS: 443, and SMTP:25) and the IP address of the Ubuntu VM box. AND THAT DID IT! I can now talk to the Apache server from any outside computer using a real URL.

[UPDATE: 4/19/2010] This works with an Apple Airport, too, but the getting to the settings is a bit different. Use the Airport Utility. Go to the “Advanced” tab, pick port mapping. Now use the “+” button to add the three above services – Personal Web Sharing, SMTP Mail, and Remote Login – SSH for https (I guess – couldn’t find another way to do that one). Then use the local IP of you Ubuntu box instead of the default provided by AirPort Utility, and your all set.

By the way, the actual location of the web site in the filesystem: /var/www

Total time, including writing this, 20 minutes. This seems MUCH faster than the last time I tried this, but I know more what I’m doing. Like all that business about the settings on the router – easy now, but I think it was hard the first time.

So, what’s next? We’ll set up a couple of extra Virtual Servers so it is possible to create and test multiple web sites. Then we need to make sure MySql is working properly. Finally, we will be sure PHP 5 has all the libraries and features installed and customize some of its settings to match those on my real host.

So, how did I get a real URL to talk to my Ubuntu virtual machine? You need to use a dynamic IP server that maps a URL to a physical IP address. I use They have a totally free service which requires you to manually confirm things once a month. Or you can pay a little, and it doesn’t nag you.

Here’s how it works. You actually are using a real IP address to connect to the web from your house. This address is assigned by your ISP in some manner. The main thing is that the address is not normally permanent. It most probably will change from day to day. So if you want to talk to your server from the outside world, you have to be able to map a permanent URL to a real changing IP address. This is what does (and there are others, but I’ve had excellent look with

It provides a bunch of main domain names like “” and a bunch of others. You get to choose from those and create your own sub-domain on that – for example: You also need to keep updated with your real IP. Depending on your router, this isn’t that hard.

Most current routers already know about (and others, but seems to be the best supported by routers). You set them up to automatically report your current IP to I won’t give all the details because they differ, but that’s the main idea – set up a domain (or several), set up your router to auto-update the IP, and you’re ready to have the world talk to your Ubuntu server.

If your router doesn’t have this, they have DynDNS update clients that run on Windows, Mac, and Linux. says the software clients are better, but I’ve never had any difficulty with my router based version. (On the other hand, my comcast assigned IP doesn’t seem to ever change unless I have a power glitch or otherwise have to reset the router, and even then I sometimes get the same IP.)

So there we have it – while I’m addressing building a Mac Fusion Ubuntu Virtual Machine LAMP server, essentially everything I’ve covered would apply equally to a fresh install of Ubuntu on real hardware. But it is so nice to have everything right there on one physical machine. Part of why I really love my Mac.

Next time – tweaking Apache, adding Virtual Hosts.


About brucewampler

I've had a long and varied careen in the computer industry. I taught computer science at the University of New Mexico for nearly 15 years. I founded two successful computer software companies. I wrote the first spelling checker and first grammar checkers for personal computers. I've lived in Glenwood Springs for 10 years. My wife, Trina, grew up here, and I've been coming to Glenwood since 1977. My kids have attended the local public schools, and have had a great experience. My son, Van, will be attending the University of Colorado starting in the fall of 2007, and my daughter is a Sophomore at Glenwood Springs High School. I've been on the Roaring Fork School District Board of Education for almost 5 years. Working with our kids, teachers, schools, principals, administrators, and the Roaring Fork community has been one of the most rewarding experiences in my life.
This entry was posted in LAMP. Bookmark the permalink.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s