Recreating my perfect web development environment using a Parallels VM and CentOS

As MacUpdate has just launched an excellent bundle deal that includes the virtualization software Parallels Desktop for Mac, I decided the time was ripe to replace my ageing copy of VMWare Fusion with its creaky installation of Ubuntu Server. Almost all of my web development work is done on my Macbook Pro, and my previous setup of running Ubuntu in a VM as my local web server has worked very well. As my external hosting is done on a VPS running CentOS, I thought it'd be a good idea to start running the popular OS locally as well. Parallels meanwhile has been garnering good reviews, and I was particularly drawn to the improved 3D performance over VMWare Fusion (who doesn't love a bit of gaming now and then), as well as the improved power management features, which should lead to longer battery life.

I had my VMWare Fusion/Ubuntu server setup configured to my particular tastes, and if the new setup was going to work out, Parallels would have to be able to replicate all of that functionality. In particular it would have to:

  1. Let me configure the guest OS (CentOS Linux) with a fixed IP address accessible from the host computer (Mac OS), and
  2. Let me keep my development files outside of the VM, i.e. on the host computer, so that I can edit the files in Mac OS, yet have them served by the VM.

Happy to report that everything went swimmingly, and I'm back up and running with my development work within a day. There was a fair bit of trial and error along the way, and I've recorded the steps here for your enjoyment. Hope it helps!

Prepare Parallels networking

The first thing we need to do is tweak Parallel's networking settings. What we need to do is leave a gap in the DHCP range that we can use to assign a static IP address to our VM.

  1. Open the Parallels preferences, and switch to the Advanced tab.
  2. Click Change settings next to Network.
  3. Under Shared, ensure IPv4 DHCP is enabled
  4. Configure the following values:
    • Start Address:
    • End Address:
    • Subnet mask:

Install CentOS

Next we download and install CentOS. I've chosen to download the CentOS 6 minimal distribution as I wanted to keep things compact, and install only the components I need. I've chosen to forego a GUI for example. The installation itself is pretty straightforward, but pay particular attention to the network configuration bit.

  1. Download a CentOS 6 64-bit minimal distribution. The filename should be something like CentOS-6.4-x86_64-minimal.iso, but that will depend on the exact version you're downloading.
  2. Open Parallels and select the downloaded ISO. The installation will run.
  3. Select Install or upgrade an existing system.
  4. Live dangerously and skip the media test. The CentOS installer will now launch.
  5. Click Next, the select your language keyboard preferences.
  6. Choose Basic Storage Devices.
  7. Choose Discard any data when configure the filesystem.
  8. Specify the domain name. I've named mine "firefly". You can use anything you like, but remember it as we'll be using this again later.
  9. Click Configure Network:
    1. Select System eth0 and click Edit.
    2. Tick Connect automatically and Available to all users.
    3. Under IPV4 settings select Manual from the Method drop down.
    4. Under Addresses, click Add and enter the following details:
      • Address:
      • Netmask:
      • Gateway: (the first IP in the DHCP range)
    5. Under DNS servers, enter again.
    6. Click Apply then close the Network dialogue.
  10. Click Next the select your timezone.
  11. Specify your root password. Click Next.
  12. Choose Use all space, then Next.
  13. Choose Write changes to disk, then wait for the file system to be configured.
  14. The installation will now start. When finished, choose Reboot.

Check and prepare CentOS installation

  1. Login as root with the password you chose during the installation.
  2. Check the network settings are correct by entering:

    You should see a listing for eth0 with a confirmation of the IP address you specified during the installation (

  3. You should also get a response when you try to ping an outside address:

  4. Upgrade all the installed packages:
    yum -y update
  5. Install the CentOS setuptool and packages for managing firewall, network, authentication and system service settings:
    yum -y install setuptool system-config-securitylevel-tui authconfig system-config-network-tui ntsysv
  6. Run setuptool:
    1. Now choose Firewall configuration and then Run tool.
    2. The firewall should be enabled.
    3. Choose Customize then tick the boxes for SSH and WWW to allow access from the host machine.
    4. Click Forward, Close, OK, then Yes.
  7. I experienced some problems configuring the Apache document root, as well as mounting shared folders in the virtual machine, and found that disabling selinux (Security Enforced linux) solved all of that. To disable it, open /etc/selinux/config for editing and change the Set SELINUX line to:
        Set SELINUX=disabled

    You'll now need to reboot the VM:

  8. It's bad practice to be logged in as root all of time, so let's create a normal user account (replace my name with your own):
    adduser rob

    Set a password for the new account:

    passwd rob

    Just remain logged in as root for the duration of this tutorial.

  9. In the future when you're logged in as the new user, you can perform administrative tasks that require root access by prefixing commands with sudo. We need to tell the system that the new user is allowed to use sudo:

    Edit the sudo configuration file:

    vi /etc/sudoers

    Add the following line to the bottom of the file (again substitute my name for the one you specified when you added the:

    rob    ALL=(ALL)   ALL

Install Parallels Tools

The installation of Parallels Tools is required for certain important features to work, notably sharing folders between the guest and host.

  1. With the virtual machine selected, choose Virtual Machine from the Parallels menu, and click Install Parallels Tools…
  2. This is supposed to mount the the Parallels Tools ISO, but as that didn't work for me, I had to manually mount it:
    mount -o exec /dev/cdrom /media
  3. Once mounted you can run the Parallels Tools installer:
  4. Follow the onscreen prompts to complete the installation, ensuring that you answer yes to the prompt to download missing components.
  5. Reboot the VM when finished:

Install and configure Apache

  1. Install Apache:
    yum -y install httpd
  2. Configure Apache to start up at boot time:
    chkconfig --level 23 httpd on
  3. Start Apache:
    service httpd start
  4. If you now enter the IP address of your guest (, as we configured earlier) in a browser on the host computer, you should see the default Apache page.
  5. Let's make the Apache server respond to a friendly name instead of an IP address. We'll use the domain name you specified during the CentOS installation.

    Set the domain name you specified as the server's host name (I used "firefly"):

    hostname firefly

    Now edit Apache's configuration file:

    vi /etc/httpd/conf/httpd.conf

    Do a search for the line containing ServerName, and change it to:

    ServerName firefly:80

    Now add the host name to the server's hosts file. Edit the hosts file:

    vi /etc/hosts

    Add the following line to the bottom: firefly

    Finally, to access the server by this friendly name from the host computer, we need to update the host computer's hosts file as well:

  6. firefly

Set Apache's document root to a folder on the host computer

I prefer keeping my actual development files outside the virtual machine. If the VM ever gets corrupted, I know my important files will still be safe and sound. This could also aid you in making backups, as your backup program wouldn't have to backup the entire virtual machine every time a file is changed. Nowadays, Parallels has good Time Machine integration, so it'll only back up incrementally (not so for VMWare Fusion at the time of writing), but I just feel much safer not having my files wrapped up in a container.

  1. With the virtual machine selected, choose Virtual Machine from the Parallels menu, and click Configure.
  2. Under the Options tab, select Sharing.
  3. Click Custom Folders.
  4. Add the folder that contains all your web files, with "Read & Write" permissions.
  5. You might have to reboot the VM at this point to pick up the new shared folder(s).
  6. Parallels mounts shared folders in /media/psf, so you should now be able see your shared folders there.
  7. By default, Apache's document root (the directory from which it serves files), is set to /var/www/html. We'll replace that folder with a symbolic link to the folder we just shared. First we delete the html folder:
        cd /var/www
        rm -rf html/

    Next we create the symlink. Replace Sites with the name of your own shared folder:

    ln -s /media/pst/Sites html

Install PHP

  1. Add the package:
    yum -y install php
  2. Now restart Apache:
    service httpd restart

Install and configure MySQL

  1. Add the packages:
    yum -y install mysql mysql-server
  2. Start the MySQL daemon:
    service mysqld start
  3. Configure the MySQL daemon to start up when the server boots:
    chkconfig --levels 235 mysqld on
  4. Set the root password (substitute <PASSWORD> with your own):
    mysqladmin -u root password 
  5. Optionally follow my guide for creating databases and additional users.

Optionally install and configure phpMyAdmin

  1. phpMyAdmin is not available in one of the default repositories, so we need to enable the EPEL (Extra Packages for Enterprise Linux) repository. Go here and download the listed RPM package to your VM.
  2. From the directory where the RPM is saved, enter:
        rpm -ivh 
  3. Now install phpMyAdmin:
        yum -y install phpmyadmin
  4. Edit the phpMyAdmin configuration file to allow access from the host computer:
        vi /etc/httpd/conf.d/phpMyAdmin.conf

    Locate all instances of Allow from and change them to:

        Allow from All
  5. Restart Apache:
    service httpd restart
  6. You should now be able to access phpMyAdmin from the host computer at http://firefly/phpmyadmin (substituting "firefly" for whatever you've named yours).