Installing Ubuntu Server with Zend Server CE in VirtualBox Part 1/2
As I mentioned in one of previous articles we are developing under Windows with virtualized Linux server. In this article I will install step by step VirtualBox with Ubuntu Server 9.10 and Zend Server Community Edition with Zend debugger.
Download VirtualBox
VirtualBox is a virtualization tool. You can use VMware Workstation or VMware Player instead, there are just some minor changes in virtual machine configuration. There shouldn't be any memory or speed differences between these products in our case.
Download Ubuntu Server
Linux distribution is just matter of your personal preferences. Because I spent some time with Ubuntu Desktop and find this distro user friendly I picked Ubuntu Server. Download Ubuntu Server, bellow green download button you will find alternative download options were you can select 32-bit or 64-bit version. I have selected 32-bit version, but if you have enabled 64-bit virtualization in your computer's bios (see VirtualBox end-user documentation), you can download 64-bit version.
Configure virtual machine
You should start with VirtualBox general configuration. Go to File -> Preferences and select default virtual hard disc folder and virtual machine folder. Now you can create new virtual machine, I called it Zend Server and set Linux/Ubuntu operating system.
In next step you choose memory size, 512MB should be enough. Create new virtual hard drive and select dinamyally expanding storage and set drive size (10GB should cover your needs - don't forget MySQL database is running in the virtual machine, so bigger size is better).
Install Ubuntu Server
Start the Zend Server virtual machine. You will be asked to select CD media to boot from, select downloaded Ubuntu server ISO.
You should see ubuntu welcome screen with Install Ubuntu Server menu item. Installation process is pretty straight forward, select your preferred language, country and keyboard. If you need to step out of guest operating system back to windows, just press right ctrl key. You will be asked to format disc, select guided mode to use entire disk. Follow installation wizard and set username and password of your user. In the next step you will be asked to select security updates policy, you can choose installing security updates automatically. When asked to select services to install check the services as you can see on the screenshot bellow.
You will be asked to select postfix mail server configuration, select internet site and leave it for now, we will cover mail server setup later. Once selected services are installed you will be asked to remove CD (unmount the CD in VirtualBox devices menu) and restart virtual machine. Now you can login to your brand new Ubuntu Server. To download latest updates type in:
sudo apt-get update
to download package updates
sudo apt-get upgrade
to install latest packages. Now mount VirtualBox guest additions (Devices -> Install guest additions) and run:
sudo apt-get install build-essential linux-headers-`uname -r`
to download linux kernel sources and mount CD drive:
sudo mount /media/cdrom
cd /media/cdrom
sudo ./VBoxLinuxAdditions-x86.run
sudo poweroff
to shutdown Ubuntu Server down (virtual machine must be** turned off** for the configuration bellow to take effect). Now setup shared folders, right click on the virtual machine and go to Settings -> Shared folders. Select your project folder and call it public_html.
Configure routing
Now we have to setup port forwarding from local machine to virtual machine. That way you will be able to connect to SSH by connecting to localhost port 22, connect to apache or to Zend Console. Go to VirtualBox installation directory, in my case it is C:\Program Files\Sun\VirtualBox. Open windows command line and type these commands:
VBoxManage setextradata "Zend Server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP
VBoxManage setextradata "Zend Server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage setextradata "Zend Server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 22
VBoxManage setextradata "Zend Server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/Protocol" TCP
VBoxManage setextradata "Zend Server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/GuestPort" 80
VBoxManage setextradata "Zend Server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/HostPort" 80
VBoxManage setextradata "Zend Server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/zend/Protocol" TCP
VBoxManage setextradata "Zend Server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/zend/GuestPort" 10081
VBoxManage setextradata "Zend Server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/zend/HostPort" 10081
As you can see there are three configurations. First line sets protocol, second is guest port and third is local computer port. Now you can boot again your virtual machine. You should be able to connect to the virtual machine through putty which is much more comfortable.
What's comming next?
I will publish next part tomorrow where we will go through installing Zend Server Community Edition and we will also setup testing project and run a debugger in Eclipse PDT. Go to second part of this article.
Author: Frantisek Troster


