Using your Ubuntu Apache test server with Windows
So we’ve set up our Ubuntu LAMP server, but now we want to use it to develop our wonderful websites. Years ago I only had one computer so I ran Linux on it and worked directly on the server itself as well as using it as my desktop. However, I personally prefer to use Windows as my desktop and use an entirely separate machine as my test LAMP server. I will be writing this ‘how to’ from that point of view, although there will be some things you can take away from this if you intend on running just Linux on one machine and nothing else.
NOTE: wherever you see username you need to change it for your actual Linux username.
Setting up a static IP address
Using the top menu navigate as follows:-
System > Administration > Network | Network Settings > Connections Tab > Choose Unlock > (enter password) > Choose Wired connection (or whatever connection method you use) > Properties > untick Enable roaming mode > choose:-
Configuration: Static IP Address
IPaddress: 192.168.1.xx , where xx is a number you choose between 0-255 (perhaps your network is 192.168.0.xx - so choose accordingly)
Subnet mask: 255.255.255.0
Gateway address: 192.168.1.1 (this is my router address, perhaps yours is 192.168.0.1 or something else!)
sudo /etc/init.d/networking restart
This basically ensures we have a static IP for our server. It means that when we want to see our website from our local network (on our Windows machine) we simply type in http://192.168.1.xx/ (whatever you chose as the IP address). Do it now and you should see the message “It works!”. If not, something went wrong.
Setting up samba
sudo apt-get install samba
sudo ambpasswd -a username
Where username is your Linux username. Here you want to have your Windows username and password identical to that of your Linux username and password. Capitals matter. If you log into Windows with Fred but your Linux username is fred then you need to change your Windows username to fred also. First change it to fred1 and then fred, because Windows thinks Fred and fred are the same and won’t change it directly.
gksudo /etc/samba/smb.conf
Find and set:-
workgroup = MSHOME
remove the semicolon (;) from the beginning of
security = user
And then at the very bottom of the conf file add:-
[username]
path = /home/username/webpages
available = yes
browsable = yes
public = no
writable = yes
Now save and exit and restart Samba
sudo /etc/init.d/samba restart
So now we can use our Windows machine to navigate the network, find our Ubuntu server and browse all our /home/username/ files. Personally I right click on here and choose to map as network drive so it’s easily available whenever I want it. We’re nearly there!
Configuring a new DocumentRoot for apache
Create a directory in your /home/username/ called webpages. This will be where we put the websites we work on. Now we need to make apache look there instead of /var/www/.
mkdir /home/username/webpages/testsite01
gksudo /etc/apache2/sites-available/default
Alter DocumentRoot /var/www/ to DocumentRoot /home/username/webpages/testsite01/
Also change Directory /var/www/ to Directory /home/username/webpages/ and then directly under this alter AllowOverride None to AllowOverride All.
Now restart apache and you’re done.
sudo /etc/init.d/apache restart
Whenever you want to work on a new website (say testsite02) then create the new folder under webpages and put all the working files in there. Then edit /etc/apache2/sites-available/default and put a # in front of the old DocumentRoot and put a new one underneath pointing to your new testsite02. Putting # in front acts as commenting it out. This makes it easy to switch between the sites you are working on, commenting and uncommenting DocumentRoot as appropriate. Don’t forget whenever you change DocumentRoot a restart of apache is required.
There are bound to be easier, better, more elegant ways to do this, but this is an example of how I do it and it works well for me, and maybe it could work well for you too.

James wrote,
Hello Neil,
I just found your article and it was amaziningly acurate. I have been using Linux Red Hat for 8 years. I have been hearing the buzz about Ubuntu. I dived right in. The part that is really strange in the Ubuntu community is the unwilingness to put a GUI on the server. i realize that it eats up resources. However i run server arrays that have 1200 processors or more. So when I hire a Windows junkie to update the Linux they scream when they see the command prompt.
Have you had any luck making a Server disk that installs a GUI from login and boots to a GUI desktop? I played around with a GRUB boot loader that I designed a GUI for it and I also “borrowed” some packages from Ubutu Desktop to compile a hybrid CD.
I did get the hybrid to work as I wanted. What I did was clone the OS after it was stable. By using a LAPLINK cable I have been transfering the OS to identcal hard drives. I buy computers in bulk, usually 100 at a time. I get the same board, processor and hard drives. So cloning the system is very easy.
The problem i am having is when i place the systems online within a cluster. I can not seem to get the machines to change MAC Addresses, users names and other info. I have tried alot of options. What happens is there is an IP conflict saying there are 2 or more machines using the same identity. Any idea how to clone the system then change the specifics so that the machines can work together?
Kudos on the very well written articles.. Thumbs Up !!!
Thanks…
Link | July 17th, 2008 at 10:32 pm
Neil wrote,
Hi James
Sorry but I have no experience with making my own distro CDs, nor with clusters, nor with rolling out identical images across multiple computers. I can see why you would be getting the conflicts you mention if each computer on your network is attempting to identify itself with the same IP address as the others, but I do not know of a way to resolve this without manually changing it on each machine.
I’m afraid the answers to your questions are outside my knowledge. Perhaps try asking at http://ubuntuforums.org/
Link | July 18th, 2008 at 8:16 am
teejay wrote,
I have read your amazing lectures but still struggling with setting up a lamp on my ubuntus drapper drake 6. 06 labtop. heres my error.
adm123@adm123-laptop:~$ sudo apt-get installphp5
Password:
E: Invalid operation installphp5
adm123@adm123-laptop:~$ sudo apt-get install apache2
Reading package lists… Done
Building dependency tree… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
Since you only requested a single operation it is extremely likely that
the package is simply not installable and a bug report against
that package should be filed.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
apache2: Depends: apache2-mpm-worker (= 2.0.55-4ubuntu2.3) but it is not going to be installed or
apache2-mpm-prefork (= 2.0.55-4ubuntu2.3) but it is not going to be installed or
apache2-mpm-perchild (= 2.0.55-4ubuntu2.3) but it is not going to be installed
E: Broken packages
adm123@adm123-laptop:~$
a little background about my old labtop. its a dell latitude with 20gb harddisk, 256 mb ram and ati radeon mobility ML 6 9000 graphic card. after a wasted week trying to install ubuntu 7.10 and difficulty of getting a normal startup screen…it wobbles, hardly can see anything and a slow internet-cantsolve this immedaitely…. i tried a lower version 6.06 and now i have something that looks like linux. by the way, am using the live cds, i got from ubuntu -canonical, abig thumbs up for the marvelous work they are doing.
Ihave two partion-a7gb formswindows and the rest for ubuntu.
fromthe errors, i will require to upgrade the base application, does seperate downloads help me, without downloading all the required updates? i willrequire over 27hrs to get by that
Link | October 8th, 2008 at 9:16 am
Neil wrote,
Hi teejay
Firstly:-
Is not correct. You need to have a space between
installandphp5. This is why you receive the error:-As for your other problem, it looks like
apache2-mpm-workeris required before being able to install apache2. Perhaps try to installapache2-mpm-workerfirst using apt-get and then try installing apache2 again. This is most likely because you are using an old and no longer supported distribution of Ubuntu.I am running the latest Ubuntu on my old Acer Aspire 1400 (must be about 7 years old now) with no problems. I can’t speak specifically for your old laptop though.
Link | October 8th, 2008 at 9:35 am
teejay wrote,
That was encouraging, but many thanks for the reply.
Link | October 8th, 2008 at 3:14 pm