Lamp Not Wamp
As regular readers would know, I have recently changed my primary operating system over to Ubuntu. This computer is mostly used for web development so running a Linux based system makes sense as the end platorm I write for is Linux based.
On Windows I usually use WampServer to host and test PHP code on my local machine, this is basically an AMP stack (Apache2 + PHP5 + MySQL) bundled with phpMyAdmin and a nice task bar 'applet' where you can change settings, start / stop the server etc.. All of this is installed from a sinle installer file - things don't get much more convenient than that.
To make my Ubuntu (Desktop version) installation more useable I needed to install the LAMP stack but this involved installing the components seperately. This isn't really that hard but it does require using the terminal and typing some commands in. Incidently, you can use Ubuntu server version which already has this set up, but being aimed at use as a server it is void of other programs.
Installation of the AMP stack is best carried out in order - this is basically Apache > PHP > SQL.
To install Apache2 you will need to use the following command -
sudo apt-get install apache2
You may get an error as follows - "apache2: Could not determine the server’s fully qualified domain name, using 127.0.0.1" this is easily remedied by adding the following line to your httpd.conf file
ServerName localhost
You can call the file up in the text editor by using the following command
gksudo gedit /etc/apache2/httpd.conf
Now you can install php5 and MySQL by using the following command
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
That's it - You now have a working test server, you should be able to view the Apache test page by typing http://localhost or http://127.0.0.1 in to your browser. The server root is located at ./var/www - just add your php files and you are done.
If, like me you use phpMyAdmin to manage your SQL databases you can easily install it by using the following command
sudo apt-get install phpmyadmin
It will ask you which Apache installation you want to install it for - make sure that you select Apache2 by pressing the space bar before continuing and pressing enter - if you forget to do this it will not install the symbolic link allowing you to type http://localhost/phpmyadmin into your browser to access it. It will also ask you to set a password for the root account (a good idea).
Once installed you can access phpMyAdmin by typing http://localhost/phpmyadmin into your browser.
Finally - if, like me you use Ubuntu you might want to change the permissions of the 'www' folder so that you have read / write access from within your normal user account - to do this type 'gksudo nautilus' into a terminal window - this will open up Nautilus as root allowing you to change folder permissions to suit.
Alternatively, if you want to change the location of the webservers root to within your home folder you can edit the virtual hosts file. you can do this by typing the following comment into a terminal
sudo gedit /etc/apache2/sites-available/default
This opens up the Virtual hosts file for editing. Simply replace the current information pointing to the /var/www/ folder with the path to a folder in your home directory - ie /home/username/web/. By doing this typing http://locahost will take you to the 'web' folder in your home directory. Dont forget to restart the Apache service after making any changes by issuing the following command
sudo /etc/init.d/apache2 restart
With an up and running webserver I can now move my development files across and also add whatever databases I need. The only thing I can't do is access any files from within XP in VMWare. This is easily rectified.
VMWare Workstation comes with the ability to share folders between the host and client, VMWare Server unfortunately does not. This is not a problem as files can be shared by using the Samba filesharing server. There are a number of different ways of doing this but the following way suited me best.
Install Samba by issuing the following command
sudo apt-get install samba smbfs
Now edit the smb.conf file
sudo gedit /etc/samba/smb.conf
Uncomment the following line
security = user
and make sure that the workgroup name is set to the same as the workgroup in your XP virtual machine.
now add a password for your user account by using the following command
sudo smbpasswd -a username
(Obviously replacing username for your username)
Restart the Samba service by using the following command
sudo /etc/init.d/samba restart
Ok. Now all you need to do is share the folders that you want to access from within your XP virtual machine.
Open Nautilus as root
gksudo nautilus
Now navigate to the folders you want to share and simply right click on them. From the menu select 'Share Folder' and select 'share through windows network snb'
(Note, if you want to share files / folders from within your own home folder you do not need to open Nautilus as root)
Now you can acces the files / folders by browsing to them via network neighborhood or by using the address in the following format
\\Computername\Foldername
Next I need to install a CVS Client but more about that later...