After a bit of a hiatus, I’m back with part two of Setting up a Debian VirtualBox for web development. Since that last post, Debian “Wheezy” (7.0) has been released – the previous tutorial and this tutorial will work whether you are using Squeezy (6.0) or Wheezy. I would recommend you roll with Debian Wheezy because it contains newer versions of the (L)AMP packages, and we all know that newer == better right!?
Comparison of LAMP software versions in Debian Squeezy (6.0) vs Debian Wheezy (7.0)
as of May 2013
|Package (package name)||Squeezy version||Wheezy version|
Nettuts give a nice run-down of some of the new features and improvements in PHP 5.4 (anecdotally the performance improvements I have seen with my applications are significant).
Lets get started
We’ll assume you have just completed part 1 of this series meaning we have a bare bones install of Debian, with host only & NFS networking and your “code” folder on the host is shared via NFS and mounted on the host. This guide will work roughly the same whether you’re running Wheezy or Squeezy.
Make sure your VirtualBox is up and running and then you can fire up a terminal window and ssh into your server:
$ ssh email@example.com
The basic LAMP stack
Just in-case you didn’t know or hadn’t realised yet, LAMP stands for Linux, Apache, MySQL & PHP. Now that is cleared up you will be relieved to hear it’s very easy, we can put
apt to work and grab some packages. The following commands are to be run on the guest (debian) machine. I will keep this brief as there are plenty of guides out there for getting a LAMP stack installed on a debian based system.
1. First make sure your sources are up to date
$ sudo apt-get update
2. Install Apache
$ sudo apt-get install apache2
If you visit your guest’s IP in your browser now – for me it’s 10.10.4.15 – you should see the default “It works!” apache message
3. Install MySQL
$ sudo apt-get install mysql-server mysql-client
You will be asked to configure the root password for the MySQL server during installation, make sure you remember it!
4. Install PHP
$ sudo apt-get install php5 php5-mysql
If you followed the advice from part one, you’ll have mounted your local
code/ directory in
/var/www on the guest. To test your basic LAMP installation you can create the file
code/info.php and put the following statement inside:
<?php phpinfo(); ?>
Achievement unlocked! Install a LAMP stack
You have just discovered your inner sysadmin, if you navigate to 10.10.4.15/info.php you should see a page listing all the information about your PHP installation (surprising right?). You can check this page from time to time to check if certain extensions have installed correctly. If this page doesn’t work you may need to restart apache using
sudo service apache2 restart, this should however happen automatically as part of the installation process.
What next I hear you ask? Well, now we need an application to run on your LAMP stack, and the PHP application framework of choice at UVd is Symfony.
And that’s a story for part 3…