Popular content
- KVM install on Ubuntu 9.10 (8,009)
- Drupal development environment on VMware (4,581)
- Drupal LAMP in Virtual Server (3,107)
- Drupal 6 and Ubuntu 9.04 Jaunty (2,556)
- Drupal install (2,500)
- script to start and stop VM guests on VMware server (2,376)
- VMware maintenance tasks (2,304)
Drupal development environment on VMware
I have set up a Drupal development environment, running as a virtual machine on Ubuntu 7.10 (Gutsy) host and VMware Server 1.0.4. It results in an virtual Ubuntu LAMP server, configured for Drupal development. Each configuration tip, PHP or database version, try-and-error game or development project can have its own "guest" environment, but your "host" environment remain clear and simple.

The use case
We will set up an virtual Ubuntu LAMP server, as a development environment for Drupal in a virtual machine of VMWare. There will be ssh and Webmin access to the LAMP server. The source files remain at our host, and will be accessible by our guest LAMP environment over NFS. The host PC needs a fix IP address. In LAMP, we will have Apache 2.2.3, Mysql 5.0.38, PHP 5.2.1 and some utils like OpenSSH, Webmin and PhPMyAdmin 2.9.1.
Steps to build up
- Install and config the Ubuntu host
- VMware server install and configuration
- Set up a virtual machine
- LAMP configuration
- Drupal configuration
So, let's go ...
1. Install and config the Ubuntu host
We need a PC as the host for the development environment. For a clean install of Ubuntu 7.10 as desktop, there are lot of good staff out there. Look up at How to Forge and Ubuntu Guide
Some additional points here:
- Use separate partitions.
- Install behind a firewall or plug off the network cable
- Do not forget to update your install
- Add OpenSSH
- Add NFS
- Webmin install
For home, root and swap in any case. Even better to split up your disk to these partitions:
/tmp
/home
/usr/local
/var
/swap
/ (root)
It's worth to reserve enough disk space for virtual machines, either in /var or /usr/local. You should remember this place when you configure your virtual server and virtual machines. 2-4 GB pro virtual machines has been a fine value for me. Some more readings on partitioning: http://ubuntuforums.org/showthread.php?&t=282018
Most systems are cracked during the unstable install hours. You can install Ubuntu without networks, and set up network later on by editing the interface file in a terminal:
sudo nano /etc/network/interfaces
Add the following lines, if they are missing. Your desktop will have the static IP address of 192.168.2.31. Of course, you have to change this IP address to your own.
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.2.31
netmask 255.255.255.0
gateway 192.168.2.1
Restart the networking:
sudo /etc/init.d/networking restart
First, edit and update the resource list and uncomment the lines beginning with "dep http ...", except the lines containing "backports".
sudo nano /etc/apt/sources.list
Then type:
sudo apt-get update && sudo apt-get upgrade
It will download the updates to your Live CD, can be 2-300 MB. If you are ready, then clean up:
sudo apt-get autoclean && sudo apt-get autoremove
You might have to restart your desktop right now.
We add here the SSH client and server for safe remote terminal access:
sudo apt-get install openssh-client
sudo apt-get install openssh-server
For more info and configuration tips read:
https://help.ubuntu.com/7.10/server/C/openssh-server.html and
http://sial.org/howto/openssh/publickey-auth/
We need NFS to be able to work on a common codebase in all the virtual development environments.
sudo apt-get install nfs-common
Webmin is a free and easy-to-use administration interface over browsers. With webmin, you can avoid the editing the config files over a terminal. To download the the minimal webmin package, type:
wget http://prdownloads.sourceforge.net/webadmin/webmin-1.390-minimal.tar.gz
sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl
The actual version number may differ to 1.390 later in time. To install webmin type:
mv webmin-1.390-minimal.tar.gz /tmp
cd /tmp
tar xf webmin-1.390-minimal.tar.gz
cd webmin-1.390
sudo ./setup.sh /usr/local/webmin
rm -rf webmin-1.390 és rm -rf webmin-1.390-minimal.tar.gz
To start Webmin, open your browser and type: https://hostname:10000/ where hostname is the name of your desktop you gave during the Ubuntu install. In order to manage your Ubuntu, you will need some more webmin modules. I recommend this set: software, mount, net, time, sshd, nfs-export, webmin. Go to the configuration page in webmin, download and install the modules from http://www.webmin.com. There are some nice themes for webmin for downloads, I like the blue theme.
Now we have an Ubuntu Gutsy Gibbon up and running. Let's go for virtual machines!
2. VMware server install and configuration
To install VMware Server 1.0.4, first you need to install the following packages:
sudo apt-get install build-essential linux-headers-`uname -r`
sudo apt-get install xinetd
Then create a directory
mkdir vmware
cd vmware
Download the VMware server source code using the following command into that directory
wget http://download3.vmware.com/software/vmserver/VMware-server-1.0.4-56528.tar.gz
To extract and install, type this as follows. This will start the installation. By questions, you can accept all the defaults.
tar -vxzf VMware-server-1.0.4-56528.tar.gz
cd vmware-server-distrib
sudo ./vmware-install.pl
You need to register to get a registration number from VMware. Go to
http://register.vmware.com/content/registration.html and answer the usual questions, as usual.
More reading and backgrounds are available at:
- http://searchservervirtualization.techtarget.com/tip/0,289483,sid94_gci1...
- http://www.ubuntugeek.com/how-to-install-vmware-server-in-ubuntu-710-gut...
3. Set up a virtual machine
In this section, we install a guest operating system, as a virtual machine. First, download the Ubuntu 7.04 Server ISO image to your desktop. Yes, not yet the 7.10, because - as of the time of writing this - the 7.10 was not supported by VMware, as guest operating system. So, the 7.04 and then you save 3 days of searching internet forums. Not like me :) So fetch up one of the Ubuntu mirrors, choose something like ubuntu-7.04-server-i386.iso and download it to your desktop.
Then start your VMWare Server Console in your host, and connect to your localhost. Go through the wizard of creating typical virtual machines.

As guest operating system, take Linux and search for Ubuntu in the drop-down list.

Name your system as appropriate (drupal or lamp would be a good choice), and set the partition you reserved for virtual machines at the very beginning. For me, it is the /opt.

In the networking page, take the bridged networking, if you want to have internet access for the virtual machine with own IP address. Other options are also working fine, but some reading at VMware user manuals might be required.
For the disk size, I used to change the default 8 GB to 2-4 GBs. It is the only change to the defaults during the install.
The disk creation takes some time, and then here we have a fresh virtual machine. Before firing it up, we have to change the CD-ROM setting. We want to point it to the Ubuntu 7.04 Server ISO image. Double click in the devices list on the CD-ROM, and browse for the ISO image. You can also delete the floppy drive here, we won't need it.

And finally, power on the virtual machine. It will start the well known installation procedure of Ubuntu. Click on the Server Console with your mouse, with CTR-ALT you can the cursor back from virtual machine. Take the default, here also by partitioning the simple way is OK.

Don't forget to notice the name and password of your first user, you will need it later!

At the software selection, select the LAMP server option, and just than continue. Some minutes later, your VM reboots. You can left your "CD" in the CR-ROM.

And at the end, log on with your user and password you noticed before.

LAMP configuration
Now we are going to set up the SSH login, static IP address and some DNS, the webmin util, and upgrade the standard Ubuntu packages at the virtual machine. We install also some small but important packages, like the PphMyAdmin, NFS and PHP graphical tools.

- The OpenSSH Server
- Fixed IP address and the hosts files
- Upgrade standard packages
- Webmin install and config
- Some important packages
- Public key propagation
First of all, we install an SSH server in the guest virtual machine, in order to be able to log in over SSH. Go to you guest VM, log in, and type:
sudo apt-get install openssh-server
After then get the actual IP address by ifconfig (let say it is 192.168.2.2), and up to now, you are able to log in from your host to the virtual machine. So open a terminal at your desktop (the host) and log in the drupal VM.
ssh user@192.168.2.2
The rest of the commands on the VM should be executed in this terminal.

We need to edit the network settings of the guest VM, in order to set a fixed IP address. This part can be the work for a DNS and DHCP server, but editing these few config files is more simple, until we have only a few number of VMs. So, let's have a terminal to your guest VM and type:
sudo nano /etc/network/interfaces
Change this line in the file:
iface eth0 inet dhcp
... to these lines, but use your own IP and gateway addresses:
iface eth0 inet static
address 192.168.2.31
netmask 255.255.255.0
gateway 192.168.2.1

I will use in the following 192.168.2.31 as the fixed IP address of the guest virtual machine. Save, exit and restart the networking:
sudo /etc/init.d/networking restart
Close your terminal window, and login once again to the guest VM, but now with the new IP address:
ssh user@192.168.2.31
Now open a new terminal to the desktop PC (the host), and adjust its hosts file:
sudo nano /etc/hosts
Add the following line at the end:
192.168.2.31 drupal.local drupal
Don't forget to use your own IP address! Save and exit.
Next, we copy this file from the desktop host to the guest virtual machine. Type in the terminal to the host:
scp /etc/hosts user@192.168.2.31:
Now turn to the terminal of your virtual machine, type "ls", and the hosts file is in your home. Let's move it to the right place at the guest VM and check the result with ping on your VM:
sudo mv hosts /etc/hosts
ping drupal.local
You should see the IP logs in the terminal. It works from the other direction, too. So try to ping your guest VM from your host, too.
Some upgrade is necessary at guest, to get the latest packages from Ubuntu. Do not upgrade to 2.6.24 Linux kernel, it does not supported by VMware Server 1.0.4! Type to your terminal at guest VM:
sudo apt-get update && sudo apt-get upgrade
sudo apt-get autoclean && sudo apt-get autoremove
The first line downloads and installs 2-300 MB, so be patient!
We also repeat the webmin install, now at the guest VM. To download the the minimal webmin package, type:
wget http://prdownloads.sourceforge.net/webadmin/webmin-1.390-minimal.tar.gz
sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl
To install webmin type:
mv webmin-1.390-minimal.tar.gz /tmp
cd /tmp
tar xf webmin-1.390-minimal.tar.gz
cd webmin-1.390
sudo ./setup.sh /usr/local/webmin
rm -rf webmin-1.390
rm -rf webmin-1.390-minimal.tar.gz
During install, accept default, set the webmin user and its password, and say yes to ssl.
To start Webmin, open your browser and type: https://hostname:10000/ where hostname is the name of your guest VM, you gave during the Ubuntu install. In order to manage your Ubuntu, you will need some more webmin modules. I recommend this set: software, mount, net, sshd, webmin. Go to the webmin configuration page in the browser, than to webmin modules. Download and install these standard modules from http://www.webmin.com. For the LAMP functionality, we need these modules, too: apache, mysql, phpini
My favourite theme is: http://www.webmin.com/webmin/download/modules/blue-theme.wbt.gz
Go to a terminal to the guest VM and type:
- For NFS mount install
sudo apt-get install nfs-common
- For PphMyAdmin install
sudo apt-get install phpmyadmin
After that, open your browser, and type: http://drupal/phpmyadmin/ to have the PhPMyAdmin.
- For the GD libraries of PHP
Because of the standard LAMP package does not contain a very important PHP graphical package used by Drupal, we install it now. Do not forget to restart your webserver, too:
sudo apt-get install php5-gd
sudo /etc/init.d/apache2 restart
This optional part is to upload your public key to the VM. If you don't have any public key, you can skip this section, but have to supply always your password during SSH terminal login. See more details at http://sial.org/howto/openssh/publickey-auth/.
First, upload public key from host to guest. At the host's terminal:
scp ~/.ssh/id_rsa.pub user@192.168.2.31:
ssh user@192.168.2.31
Next, setup the public key on server and in a terminal of the guest VM type:
mkdir ~/.ssh
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
rm ~/id_rsa.pub
Logout and close the terminal. By the next ssh login, there is no more password needed.
5. Drupal configuration
Download and upzip Drupal at your host, somewhere in an appropriate place. Then mount this directory into your virtual machine, into /var/www/
Also set up an database for your Drupal install in the virtual machine, and grant the privileges, as described in Drupal manuals. MySQL ships with blank root password. To change it use on your virtual machine:
sudo /etc/init.d/mysql reset-password
You can set these using the Webmin interface to MySQL.
Open the /etc/hosts file on your host and virtual machines, and add the same line to both, resolving the IP address of virtual machine to the local domain name:
192.168.2.31 wepoca.local
We have to set up a new virtual host for this domain name in Apache configuration files. You can set these using the Webmin interface to Apache.
Many useful tips, readings, details and other solutions are here:
LAMP install on Ubuntu
- Ubuntu Server Guide
- Lullabot: Install a Local Web Server on Ubuntu
http://www.ubuntugeek.com/ubuntu-710-gutsy-gibbon-lamp-server-setup.html
http://www.ubuntugeek.com/ubuntu-704-feisty-fawn-lamp-server-setup.html
http://sial.org/howto/openssh/publickey-auth/
http://www.debian-administration.org/articles/357
VMware install process, background and how-to
- Add new comment
- 4581 reads