Installing Ubuntu LAMP server within Microsoft Virtual PC

This article attempts to provide a concise description of the steps required to install Ubuntu LAMP server on the Virtual PC with the goal of providing an environment with minimal, but appropriate, services for hosting and developing web content using Linux. By the end of the article, the reader will have a virtual machine configured that has apache, mysql, php, phpmysqladmin, samba, ssh and webmin installed and operational. In short, a fully functional linux installation that can be accessed from the LAN via Windows explorer, serve pages to a web browser, and maintained via SSH to "get stuff done" under linux with the convenience of running it within a virtual machine. This can be a daunting task for someone not familiar with the process, and if you think you would benefit from having this kind of virtual machine just follow the instructions and I expect you'll be done in about 30 minutes or so.

The target audience is people who are not an expert in Linux configuration and would usually find it faster to reinstall from scratch with the correct settings than dig around looking for a way to correct bad settings.

I am using the Virtual PC 2007, which is available for free from Microsoft after jumping through a few hoops. It just happens to be what I use. I am sure the other flavors of virtual machines out there would work just as well though.

Because nobody wants to read a lot of needless stuff when trying to get something done, I’ve cut out anything I felt was “obvious” and left only the steps where I thought there might be a chance someone might make a settings selection that could require starting over from the beginning just to correct it. I suggest skimming this document once before starting the task.

Part 1: OS Installation

To start, just create a new Virtual PC using "Other" as the OS and 128mb of RAM.

Here are the Virtual PC settings, all of these are the default except the sound has been disabled. 128mb might seem like too little memory but you can change it later if you need to. I reduced the hard drive settings from 16 gigs to 8 gigs, which doesn’t seem like much but it’s about twice what I wound up actually needing.

Boot the Virtual PC and mount the Ubuntu server ISO via “Capture ISO image” command on the CD menu when it needs something to start. Note: If you ever find your mouse cursor is “locked” into the Virtual PC, press the right-alt key once to release it.

Press F4 and manually select 640x480x32, otherwise the Virtual PC won’t display correctly and you’ll have to start over.

Just follow the subsequent dialogs, they are pretty straightforward and not worth reviewing except for possibly the keyboard layout where its faster to just specify which keyboard you use if you know what it is (ie US for me). Naming the host is always the hardest one for me, I decided to just go with “lamp” for the server name. Short and sweet makes a lot of sense for this kind of box.

At the drive configuration screen, just go for the first option and use the entire disk.

It does a double check on the disk settings because if this were a real PC and not a virtual PC we might actually care about the hard drive’s contents.

After this are time zone and clock settings, followed by user configuration screens. When it asks for your username and password, use the same username and password you use on your Windows domain. If you don’t, file sharing with become needlessly “complicated”.

Once you complete these setup screens, it will then churn for a while as it installs the base system.

Eventually, you will see this screen:

Note that you hit down arrow once, then spacebar to select it, then press enter. If you just press enter when LAMP server is highlighted, it won’t actually select or install LAMP and you’ll find yourself starting from the beginning again.

After a while, it will show the screen indicating the installation is complete and it requests a reboot. Allow it to reboot. Ignore the text spam, it will eventually get to the login screen. Login. For a while now, we will be using the linux shell to configure a number of items.

Part 2: Application Installation

We now need to tell the software package manager where it can find modules out on the internet for retrieval.

Perform the following command:

sudo pico /etc/apt/sources.list

Scroll down with the arrow keys to the lines circled below and remove the ## marks (now absent) so that it looks as shown below, resulting in a sources.list that has additional repositories enabled. Press control-X followed by Y (to save) and enter to complete this edit process.

Now we need to update our database of available software.

Enter the command:

sudo apt-get update

Now, install samba, phpmyadmin and ssh. After you type the following instructions, you may be asked to insert the CD which you can do via “Capture ISO Image” on the CD menu.

sudo apt-get install samba phpmyadmin ssh

Now we have one unfortunate step of manually installing webmin because its not part of the apt-get system for this version of Ubuntu. Grab the latest debian package from http://www.webmin.com/download.html using a command something like this: wget http://prdownloads.sourceforge.net/webadmin/webmin_1.310_all.deb

Install the package using the following command:

sudo dpkg --install webmin_1.310_all.deb

It will produce some dependency error messages but this is to be expected. Use the following command, which will correct these errors and allow webmin to complete its installation.

sudo apt-get -f install

You can now test the webmin configuration by visiting the https port 10000 on the machine, which is using a DHCP address that you need to run this command to find out what it is:

ip addr

Look for the “inet” value for the eth0 interface. Mine was 192.168.0.179, which means webmin was available for me at https://192.168.0.179:10000. On your “main” pc, open a web browser and point to this address. Note that this is a one time thing, once you are done you will refer to it only by the system name and not by IP. Since this website has not been fully configured, your browser will warn you about a problem with the certificate which you need to ignore. Log in using your username and password. The following sequence of instructions apply to the Webmin interface.

Go to the Servers/Samba Windows File Sharing. Select “Edit Configuration File” and paste the following, editing the workgroup, computer name and username/usergroup as appropriate. I used “Lamp”, “Cosky”, “eric” and “eric”, respectively and the VM is now visible to my standard PCs on the LAN.

[global]

; General server settings

netbios name = YOUR_HOSTNAME

server string =

workgroup = YOUR_WORKGROUP

announce version = 5.0

socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192

 

passdb backend = tdbsam

security = user

null passwords = true

username map = /etc/samba/smbusers

name resolve order = hosts wins bcast

 

wins support = no

syslog = 1

syslog only = yes

 

[htdocs]

path = /var/www/

browseable = yes

read only = no

guest ok = no

create mask = 0644

directory mask = 0755

force user = YOUR_USERNAME

force group = YOUR_USERGROUP

(reference: http://ubuntuforums.org/showthread.php?t=202605 )

If you want other shares to other parts of the machine, now is a good time to add them.

Visit the “Edit Samba Users and Passwords” page. Select the username you entered in “force user” above. Uncheck disabled, and provide the login password for that account.

Restart Samba via the button at the bottom of the Samba page. You can from this point forward refer to this machine by the Samba name from within web browsers and file system. Switch to this mode by visiting https://Lamp:10000/ (or whatever you named it) and bookmark the page for later because you will be visiting it a lot. Note that at this time, you may want to visit & bookmark http://Lamp/phpmyadmin also; you can log in with username “root” with an empty password at this time.

Now make a backup of the Virtual PC so that if you ever want to restore the virtual machine to this point again you can just blow away the drive with your backup and avoid duplicating all the preceding steps. To do this cleanly and to ensure everything is wrapped up properly, type:

sudo shutdown –P 0

Once the VM has shut down, copy the VM’s hard disk file in Windows Explorer to a backup, and restart the server to continue. You now have a virtual disk image for a baseline installation that you can use at any time to “reset” your linux install to a fresh, clean, known state that has apache, mysql, php, phpmysqladmin, samba, ssh and webmin installed and operational.

From here, it's up to you what you do. For me, this is where I download Drupal CMS so I can mess around with themes and modules without putting my live website at risk. But you can do pretty much anything with this, so have fun :)

Comments

Hi The above post is very

Hi
The above post is very helpfull.when i saw that i can change the resolution with F4 i was really thankfull.so i continued my installation but when everything was finished and the system rebooted,the problems started.the resolution changed and now i can't do anything.the arrows don't work in order to page down and enter my username and login and i can't do anything.any ideas?
thanks in advance

I haven't experienced that

I haven't experienced that problem. Was this with the text based server ISO, or did you install one of the distros with a GUI?

thanks for the reply but i

thanks for the reply but i didn't have internet all this days.the situation above happened with ubuntu-6.06.1-server-i386.iso to be exact.i also changed vga=771 at the start(F6).i don't know what to do.if there are any advices thanks in advance

to give you a better idea(i

to give you a better idea(i will try at least..),i have this problem.when it starts,after the successfull installation,you can see all the text spam but after a while it stops.at first i let it but when i saw that when you press enter you go down,i did it and i saw that down there it was the loggin screen.but after all this enter i pushed,the loggin of course was invalid and it stops there.i don't know if you can understand me.if you have time and you can help i can explain better.i'm waiting for your reply
thanks

Try pressing alt-enter to

Try pressing alt-enter to activate fullscreen. If that doesn't help, you might want to just reinstall and try some other display modes when you do; that's pretty much what I had to do when I discovered the default resolution wouldn't work for me. Good luck :)

i did it but it just gives a

i did it but it just gives a bigger screen of the text that i can see.so i will try other resolutions and i'll try to find the way
thanks

Thanks

Thanks for this article. very helpfull.

My computer can't find the

My computer can't find the virtual computers ip address that i type in the url bar

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.