As part of my iOS app development and testing lab, I have a need to be able to test client applications against multi-platform database services. Last year I determined a collection of OS X, CentOS, and openSUSE virtual machines running MySQL and PostgreSQL provides an adequately diverse test environment for my needs.
A wide variety of application prototyping and testing needs can be served by these combinations without requiring a rack of high end hardware and a couple full time DBAs to maintain everything. Many of my clients have performance testing and production requirements far beyond my little “proof of concept” setup. However, my “proof of concept” environment often helps me better understand how to communicate with the DBAs in the large organizations. And sometimes it allows testing ideas that they don’t have the luxury of trying out on a $25 Million production database cluster.
My virtual lab environment had grown a bit stale over the past year. Over the past week or so, I’ve been updating to OS X 10.8 Mountain Lion and both the Xcode 4.4 general release and the Xcode 4.5 iOS 6 betas. Now I’m beginning to update the Linux and SQL components of the environment. I’ve had a long affinity for Suse Linux so I like to keep a familiar distro on hand. Many clients are using Redhat in their production environments, so CentOS has become a necessity. In the past, Solaris was always a key component of my setups but not so much any more; adding some new Solaris VMs will be deferred for another time.
For this portion of the lab update I’ll be building a couple new CentOS VMs and keeping some notes. I’ll begin with the CentOS 6.3 x86-64 bit “netinstall.iso“. Assuming you’re install to location with internet connectivity (and not organizationally firewalled into using sneakernet for your lab), the netinstall.iso option saves the time otherwise spent updating all of the packages in the LiveCD or full ISO images.
In VMware Fusion 4.1.3,
- select the menu options “File” and “New” to get the “Create New Virtual Machine” dialog window.
- select “Continue without Disk“
- select “Choose a disk or disk image…“
- use the presented Finder popup to navigate to your target ISO image (which you’ve previously downloaded) and select “Continue“.
- select Operating System: “Linux“
- select Version: “CentOS 64-bit“
- select “Continue” note: the OS and Version selections are important as they inform VMware Fusion which drivers, VMtools, and VM configuration settings to utilize. VMs can successfully be created using less specific settings, by you’d lose out on some features of Fusion and likely have to perform additional manually configuration work within your Linux VM.
- you should be presented with a summary configuration of your new VM with the options to “Customize Settings” or “Finish“. This default will likely be one processor core and 1GB memory; I recommended increasing this to two cores and 2GB memory. After completing the installation and configuration, you might try lowering the settings but these will be helpful for getting thru the various package installations and configurations.
- select “Finish” and use the Finder popup to name and save your new VM. I like to configure a “base image” to my preferences and then make copies of as needed for testing new configurations or loading additional packages. So it’s helpful to think of a naming convention if you are likely to have multiple copies over time.
- Fusion will start the new VM and the netinstall.iso will boot to a setup process. Netinstall will be a text based interface (use your keyboard arrows keys to move between options). The first dialog will be for testing the installation media. I’ll “Skip” the media test. If you uncertain about where you image came from or the quality of your internet connection, you may want to let the me test proceed.
- choose a language
- choose a keyboard type
- choose an installation method. select “URL“. (you’ll be prompted for details later).
- configure TCP/IP. unless you need to change, accept the defaults by selecting “OK“.
- a dialog will display “waiting for network manager to configure eth0“
- URL setup. enter “http://mirror.centos.org/centos/6.3/os/x86_64″. The text interface does not allow copy/paste from the host, so you will need to type this in exactly. cents.org redirectors the download to one of many mirror sites. If the URL doesn’t work for you, check your typing and try again. It’s possible the redirection could get sent to a server that is temporarily busy or offline. Trying again usually works. If not, you’ll need to do some searching to locate a direct URL to mirror server that is reachable from your network location.
- After the netinstall process begins, in a few moments you’ll see a graphical screen displaying a CentOS 6 logo. Select “Next“.
- Basic storage device should be ok. Select “Next“.
- Storage Device Warning. This is a fresh install, so select “Yes, discard any data“.
- local hostname: Enter a hostname for your VM.
- select a timezone.
- enter a root password (twice to confirm, must be at least six characters).
- which type of installation would you like? select “use all space“.
- “write changes to disk“
- select optional software to install. Note: Selecting software packages is a lot easier if you wait until the system is up and running with VMtools providing proper mouse and video drivers plus the ability to select the various package repositories you’ll want to use. So, for this step, select “Minimal Desktop” and “Next“. If you choose the “Minimal” option, you’ll be limited to the command line.
- The necessary packages will be downloaded and installed (about 30 minutes of this older Core 2 Duo MacMini). When it’s complete, you’ll be prompted to “Reboot“.
- After the reboot, a Welcome screen will continue the process of setting up the new system. Select “Forward“.
- Agree to the license and select “Forward“.
- Create User: input your desired user information. Select “Forward“.
- Set Date and Time. Select “Forward“.
- At this point I get a warning message “Insufficient memory to auto-enable dump. …” That’s ok, I don’t need it for this usage, so I’ll select “Ok” and “Finish“. The VM will reboot to complete the setup.
- After the reboot, a GUI login screen will prompt to login with the account just created in the previous steps and delivery you to the new desktop.
At this point the new VM is is ready to use with a base configuration of the “Minimal Desktop” distribution of CentOS v6.3. However, there are some additional steps to make it bit more user friendly prior to archiving a copy and proceeding with the desired dev / test work this VM is intended for.
- Use the VMware Fusion menu to select “Virtual Machine | Install VMware Tools“. If you’ve not used previously used this feature in your current version / installation of VMware Fusion, you’ll be prompted that “VMware Fusion needs to download the following component: VMware Tools for Linux“. Select “Download“.
- VMware Fusion will be adding an additional component to the Fusion application on your Mac OS X host, so you will be prompted to authenticate and permit this action.
- Next you’ll be prompted by Fusion to “Click Install to connect the VMware Tools installer CD to this virtual machine“.
- This should result in the CentOS VM’s desktop displaying a DVD (or CD) icon titled “VMware Tools”. Unfortunately, mine displayed a blank folder with an empty disk as a result.
- Checking /Applications/VMware Fusion.app/Contents/Library/isoimages” confirmed that a “linux.iso” file was present (dated 2012-05-27).
- Rebooting the VM and re-trying the VMtools installation still resulted in an empty disc image / folder. This is a common problem between Fusion and many Linux distributions. VMware’s support forums offer several work arounds, most of them at the command line.
- My solution is to use the OS X Finder to browse the “VMware Fusion.app” package contents, copy the “linux.iso” to another folder, and mount it to the VM’s CD drive.
- Return to the CentOS desktop, use “Computer” to browse the CD. You should now see a “VMware-Tools……tar.gz” file.
- Drag the “….tar.gz” file to your home folder. Don’t bother trying right click and select “Open with archive mounter”. Extracting the files through the GUI will probably result in a process that estimates a couple hours to complete.
- Use the CentOS “Applications” menu to launch “Terminal“.
- “CD” to your home folder.
- Use the “ls” command to verify the “…tar.gz” file is there.
- Expand the archive using “tar zxpf VMwareTools-….tar.gz” HINT: type “tar zxpf VMw” and hit “Tab” to autocomplete the command.
- This should result in a new folder named “vmware-tools-distrib” containing 3,275 items for 178.6MB.
- In terminal, type “CD vm” and hit “Tab” (to autocomplete).
- Another “ls” command should verify the presence of “vmware-install.pl”.
- You’ll need super user (root) privileges to run this script. Type “su” and then enter the root password established during installation.
- Enter “./vmware-install.pl” (or just type “./v” followed with a tab key to autocomplete).
- The script will prompt with about nine questions. Use “Enter” to accept the defaults for each.
- When the script completes you can delete the “…tar.gz” from the VM to save diskspace. In all likelihood, if you ever need them again for this specific VM, they’ll be out of date by then. Reboot the VM to activate the VMware Tools features.
Now that VMware Tools is active the mouse should work much better, and you’ll be able to resize the VM window to whatever fits on your available host machines OS X desktop the best for your preferences. Copy/paste from the host machine should be enable.
VMware Fusion shared folders should also be working now. However, you should verify as this is another feature where Fusion yields different results across various Linux distributions. On this particular CentOS VM, sharing some folders from the host machine resulted in them be available within CentOS at the path “/mnt/hgfs/”. Fortunately it wasn’t necessary to perform any additional commands to use them. A quick test confirmed the shared path was readable and writeable from the VM. note: this feature mounts the shared folders with the guest VM as virtual file system, there isn’t any shared/virtual networking going on with this feature.
The next step I recommend is selecting the Applications menu “System | Software Update“. Despite having just completed a network installation, this new instance of CentOS Minimal Desktop config had 43 available updates (124.6MB). The update process will prompt for the root password. You will also likely be prompted to authenticate to accept certificates, signatures, and various packages during the update process (so it’s not a walk away and leave it process).
Now that the base config is installed and updated, I’ll shut down the VM and make a Zip Archive (using OS X Finder) of it’s VM image.
It was about 2.5 hours to get this far. A quad core host machine with SSD, and a faster internet connection, would reduce that considerably. Some of the time was also spent writing these notes.
With this new configuration built and a backup tucked away, I probably won’t need to perform a base install of CentOS in this environment for another year. I didn’t keep as much detail last time, so I’ll have to wait another year to compare whether things get faster.
My next steps for CentOS will be to configure the various application packages and settings that I need (and make another Zip Archive backup). From there it is much faster to deploy additional instances for dev/test work whenever needed.