Showing posts with label VMware. Show all posts
Showing posts with label VMware. Show all posts

Tuesday, August 3, 2010

Easy ESXi 4.1 with serial or USB UPS control

In the past, there has always been a problem with setting up USB uninterruptible power supply to VMware ESXi servers. 

Here is the method of enabling a VMware ESXi 4.1 bare-metal server to communicate with an inexpensive serial or USB-only UPS system.

APC uninterruptible power supply

Install a Guest Windows System

You will need to install a Windows virtual machine to run the power management software, and connect to the UPS system.


I have used APC Powerchute software on a Windows 2008 server with this installation method, and encountered no problems.

Most Windows OS guests with USB management software should work in the same way.


Enabling the USB Pass-through  

Now that ESXi 4.1 has been released, it is possible to use a USB data cable on any UPS and communicate with Windows control software.  

ESXi 4.1 has the ability to make a USB connection from the server hardware, directly through to a virtual machine hosted on the same server.

USB cable

This allows UPS monitoring software to run on a windows virtual machine on the server and talk to the UPS on the ESXi server USB hardware.

You will need to make sure the USB adapter is attached to only the power controller guest OS, to minimise other guest OS conflicts. 

The management and attachment of the USB hardware is done in the virtual machine hardware configuration screen.

When adding USB hardware to the hardware of the virtual machine, a new option is now available for direct USB hardware access.


Enabling the SSH Service for Root Access

The next step is to enable the SSH service on the ESXi server, so a root remote console is present via SSH.

You will need physical access to the ESXi server, so you can login to its console as the root user.

Edit the configuration file for SSH with the following command:

nano /etc/ssh/sshd_config

Find the line that starts with PermitRootLogin and change the "no" to "yes".
 

Restart the sshd service with the command:

service sshd restart


The SSH service will now accept root logins to the console for running scripts. 



Windows Guest Script File  

On the Windows virtual machine running the Powerchute software, a small .bat file needs to be created, pointing to a free SSH client called Putty.

You can download Putty from their website. http://www.chiark.greenend.org.uk/~sgtatham/putty/ 

After getting Putty and setting up the .bat script, log into the same directory on the Windows guest. 

You will be able to point your UPS control software directly to the shut-down script on the local host.

Windows .bat file:
-------------------------------------------------
putty "server-address" -l root -pw "password" -m Unix_Commands
-------------------------------------------------


Unix_Commands file:
-------------------------------------------------
poweroff
exit
-------------------------------------------------


Final Notes

This new feature for USB connections in ESXi 4.1 makes it very easy to implement UPS systems into the VMware environment.

I have only tried this with Windows 2008, running APC Powerchute software and uninterruptible power supply with USB control.

But I believe any configuration of Windows and power control software should work.

APC UPS Battery

Friday, July 30, 2010

VMware Server 2 - Part 4 - High Availability Services

High availability is a general requirement, rather than a extra feature, in today's server environments.

Especially as organisations and people have become more reliant on IT systems for everyday tasks.

A simple way to build redundancy into VMware Server 2 software is by using the Linux High Availability software on a Linux CentOS installation.
Clustered servers in racks

This example configuration works well for systems that are server-only devices, e.g. web servers, FTP servers or internet mail systems.

Desktop virtual machines are not recommended for this set-up, because information can be lost when the Linux HA starts new instances of all the virtual machines.


Two Things Required

For this project, there are two requirements for constructing a small cluster of VMware Servers.
  • Redundant Datastore
  • Redundant Server Hardware
In this example, the redundant datastore will be using FreeNAS, with Linux HA offering the redundant VMware Server services.


Linux High Availability

The Linux HA software maintains a set of building blocks for high availability cluster systems, including a cluster messaging layer, a huge number of resource agents for a variety of applications, and a plumbing library and error reporting toolkit.

For this example installation of Linux HA, the heartbeat will be using the IPfail service, which will be the main focus for the VMware Server redundancy.

The Pacemaker functionality will not be used for this example, but can be used in larger server farms for cluster management.


Setting up the Linux HA on CentOS

An IP network, using a crossover Ethernet cable on eth3, has been set up on both the CentOS VM servers, which is used to send heartbeat information to and from the Linux HA services.
Heart beat Ethernet cable
It is important that your host file contains the correct host names of the servers, as required by Linux HA.

I.e., for this example Server1 and Server2 need to be in the host file.

more /etc/hosts

127.0.0.1                  localhost
192.168.0.100          Server1.test.com.au server1

Below are the example configuration files for the Linux HA on each of the VM server.

(CentOS Server 1)
/etc/ha.d/ha.conf file
-------------------------------------------------------------------
logfile /var/log/ha-log
watchdog /dev/watchdog
bcast eth3
keepalive 2
warntime   10
deadtime  30
initdead  60
auto_failback on
node Server1
node Server2
udpport  694
respawn root /usr/lib/heartbeat/ipfail
ping 192.168.0.1
--------------------------------------------------------

/etc/ha.d/haresources file
--------------------------------------------------------
Server1 192.168.0.100/24/eth0 vmware::start
--------------------------------------------------------

/etc/ha.d/authkeys file

--------------------------------------------------------
auth 1
1 crc

--------------------------------------------------------

(CentOS Server 2)
/etc/ha.d/ha.conf
--------------------------------------------------------
logfile /var/log/ha-log
watchdog /dev/watchdog
bcast eth3
keepalive 2
warntime   10
deadtime  30
initdead  60
auto_failback on
node Server1
node Server2
udpport  694
respawn root /usr/lib/heartbeat/ipfail
ping 192.168.0.1
--------------------------------------------------------

/etc/ha.d/haresources file
--------------------------------------------------------
Server1 192.168.0.100/24/eth0 vmware::start
--------------------------------------------------------


/etc/ha.d/authkeys file
--------------------------------------------------------
auth 1
1 crc

--------------------------------------------------------



The Network Attached Storage Setup

The network attached storage being used for the VMware is the open source FreeNAS distribution.

FreeNAS is a free network-attached storage server, supporting: CIFS (Samba), FTP, NFS, rsync, AFP protocols, iSCSI, S.M.A.R.T., local user authentication, and software RAID (0,1,5), with a web-based configuration interface.

FreeNAS Logo
In this example, the two VMware Servers are connected on a separate IP network on eth1. The gig-E switching network is then connected to the FreeNAS server where the vmdk files and datastores will reside.

VMware Server cluster


CIFS or NFS mounts will have to be setup on the NAS before installing any virtual machines, so that the VMware Servers can mount the FreeNAS server, giving a redundant storage of the VM's vmdk files.

Example of mounting the NAS from CentOS:

mkdir /vmware
mount -t cifs  //FreeNAS_IP_Address/vmware /vmware -o user=admin,pass=abcde

Make sure that the /etc/fstab file is updated with the mounting information, so that the NAS mounts will reconnect in the VM Servers on reboot.

192.168.10.10:/vmware /vmware cifs defaults 0 0


Overall Setup of the System 

The overall setup uses two separate switched networks for reliability to the NAS and Internet - one network for the redundant NAS services to the VM Server for the VM's vmdk files, and the other network for data access to the Internet and other LAN services.



The two VM Servers are connected by a crossover Ethernet cable to run the heartbeat service.

The heartbeat service controls the VM Server redundancy.

This setup (or close variations) allows for a reliable setup for high availability VM Servers, without investing in an expensive SAN and only using the free VMware Server 2 software.


There is more to come in "VMware Server 2 - parts 5 and 6". 

I talk about monitoring the server, and changing system resources, among other things VM technical.

Stay tuned...

Saturday, July 24, 2010

VMware Server 2 - Part 3 - Mounting an ISO image on a Datastore

Mounting ISO images onto your virtual machine can be very handy for installation and management.

It removes the need for a physical CD/DVD drive to run the installation CD, upgrades and resource packages for the virtual machine.
VM Server Logo - Copyright VMware

Using ISOs for Installing Guest Operating Systems

A handy way to make it easier to install a guest operating system, is to use ISO images from the datastore as virtual CD/DVD drives.

In this example, the Slackware Linux 13.1 DVD ISO image will be downloaded to the ISO datastore and used for the guest installation.


cd /vmware/iso/   (Pre-mounted datastore directory)
wget http://www.slackwaremirror.com/slackware-13.1-install-dvd.iso


Then the rest is done from the VM Server 2 web console.

To install from an ISO image instead of a physcial CD/DVD drive, there is only a slight difference between the standard guest installation covered in part-1 and installing from an ISO image. (For larger views of the pictures, just click the image.)


VMware Server ISO Config

VMware Server ISO Config

In the virtual machine installation wizard, the part the concerns the ISO images is the "CD/DVD Drive" options.

In this screen, selecting the option "Use an ISO Image" will allow the user to have a virtual drive instead.

On the next wizard screen, the browse selector allows the adding of the ISO image on the server datastore.


VMware Server ISO Config

Click  browse and the datastore selection window appears.

Browse to the ISO datastore and select the slackware-13.1-install-dvd.iso image to use as the virtual drive.

After hitting OK, the original CD/DVD properties screen appears with the correct path to the ISO image. 

Follow the rest of the wizard as if you were installing a standard virtual machine on the server.

Once the wizard is finished, starting the guest OS from the console will start the installation of the OS from the bootable Slackware Linux ISO image.

Install as per normal. 


Changing the Virtual CD/DVD Drive ISO Image

After installing a guest operating system, you may want to mount another ISO image for upgrades of operating systems or installing other applications.

VMware Server ISO Config

To change the ISO image, go to the console and stop the virtual machine.

Under the summary section of the virtual machine's console tabs, in the hardware panel, select the "Edit" option under the CD/DVD Drive subsection to bring up the CD/DVD drive options window.


In this window, the user can select the connection as a ISO image in the radio buttons.

Click browse to select the ISO image from the server datastore.

Once the image is selected, click OK and re-power the virtual machine to have access to the new CD/DVD image.

Now the user is ready to run the application install CD/DVD or operating system upgrade disc.



VMware Server ISO

Mounting ISO images as virtual CD/DVD drives is very handy, and means you don't have to maintain a store of discs.

But wait, there is more to come in "VWware Server 2 - parts 4 and 5" of the blog.

I talk about monitoring the server, changing system resources and clustering the VMware server, among other things VM technical.

Stay tuned...

Wednesday, July 21, 2010

VMware Server 2 - Part 2 - Application Virtual Machines


Application Virtual Machines

For the people who want a virtual machine up and running without hassles, there are application virtual machines which can be installed within a few minutes.

A variety of pre-packaged applications are available. In fact, far too many to mention here.

A good resource for application VMs is the VMware appliance marketplace:
http://www.vmware.com/appliances

WMware Application Virtual Machines


Installing an Application VM

For this example, I am using the SugarCRM application from Bitnami. It is a free download from their website:
http://bitnami.org/stack/sugarcrm.

This test uses the OpenSUSE 11.1 version for the installation.

cd /vmware/test  (or your own datastore)
wget http://bitnami.org/files/stacks/sugarcrm/6.0.0-0/bitnami-sugarcrm-6.0.0-0-opensuse-11.1.zip
unzip bitnami-sugarcrm-6.0.0-0-opensuse-11.1.zip

All ready and done, with the vmdk files in the pre-set-up datastore.

Now to install the application VM into the VMware server.


Setting up the VM 

There is only a few things that are done differently when installing an application virtual machine. (Click the images for larger versions of the examples).

VMware configuration screen

VMware configuration screen

As with creating a VM in part-1, you select the datastore you want to use and the VM's name.

For this example, the test datastore will be used again for the VM files.

On the next screen of the wizard, the correct OS for the application VM needs to be selected for the application to work.

In this case, the selection is SUSE Linux. This will suit the SugarCRM application requirements.

VMware configuration screen

VMware configuration screen

Moving on to the most important part in the wizard.

This time, instead of creating a new disk, to run the application VM, the image can be selected by "Use an Existing Virtual Disk" option.

VMware configuration screen

VMware configuration screen

This will give the ability to browse the datastores for the downloaded vmdk files.

Browse to the correct datastore and select the SugarCRM vmdk file for SUSE Linux.

Then after pressing the OK button, the drive configuration screen will appear again with the application VM in the browse field.

For the rest of the installation of the application virtual machine, the configuration wizard follows the same path as installing VMs in part-1 of this blog.

VMware configuration screen


To start the application VM, go to the console tab and click on the play icon.

Once started, click the console screen again to launch the application VM display to gain access to the virtual machine.


VMware configuration screen

Now there is a nice copy of SugarCRM running on the VMware Server.

All ready for set-up and deployment by Internet to a client's office VPN or for a personal CRM software system for in-house work.

And all installed in under 5 minutes.

But wait, there is more to come in "VWware Server 2 - parts 3 and 4" of the blog.

I talk about mounting ISO images and clustering the VMware server, among other things VM technical.

Stay tuned...

Monday, July 19, 2010

VMware Server 2 - Part 1 - Installation and Guest OS Setup

Have been working with VMare Server 2 as my lab development system over the past month.

Chose the VMware Server 2 over the free VMware ESX bare metal installation, as it will allow me to customise the operating environment.

The main OS that the VMware Server 2 will be running is CentOS 5.5 64 bit version.


VMware Logo - Copyright VMware
The VMware Server 2 software can be downloaded for free (after registration with VMware) from http://www.vmware.com.
Registration to the site also gives access to other VMware products and trial software.


Installing the VMware Server 2 Software

I used a fresh install of CentOS (which ESX is based on anyway) to install the VMware Server software.

Downloaded the latest binary installer, but left the RPM package. I have tried the RPM package before and it seems to work fine with CentOS, but perferred the more generic approach.

After downloading the software package and uncompressing it, I just ran the installer to start the configuration. Most questions can be left at their defaults.

cp VMware-server-xxxx.tar.gz /temp/dir
cd /tmp
tar -zxf VMware-server-xxxx.tar.gz
cd vmware-server-distrib
./vmware-install.pl

Accept the default directories for the binary files, daemon files, library files, manual files, documentation files, init directories and init scripts.

Then running vmware-config.pl will start the software configuration part of the installation.

./vmware-config.pl

Again, most questions can be left at their defaults, except for the location of the store for your virtual machine files and the serial code that you get from VMware when you download the file.

Controlling the service is simple. Running the script "/etc/init.d/vmserver start|stop|status|restart" makes it easy to control the service.

Installing a Guest OS

Once the VMware Server is up and running, add some virtual machines.


Connect to the host server - https://IP.domain.address:8333.

A simple username and password prompt is displayed once the interface comes up.  


VMware configuration screen

When the username/password dialogue disappears, the main screen appears. 

Before making any virtualized system, there needs to be a datastore made for the machines. Clicking on "Add Datastore" on the right panel starts the wizard to add a new datastore. 


VMware configuration screen

The datastore wizard just requires two values for a local disk: the Datastore name and the location of the datastore files on the CentOS installation. 


VMware configuration screen

Having set-up the datastore, I can start the wizard to make a virtual machine. 

To start the wizard, the link is in the top right menu panel. (Click the images below for larger views)


VMware configuration screen

VMware configuration screen

First give the VM a name and to select a datastore. Press next to continue.


On the next screen, the wizard then asks for the guest operating system. For CenotOS, the Redhat 5 selection is used in this example.


VMware configuration screen

VMware configuration screen

The next wizard screen asks for some basic system information.


For new, the defaults are fine and can be changed later if needed.

After pressing 'next', the wizard asks about the VM's virtual disk.

Select "Create a New Virtual Disk" for the next screen.


VMware configuration screenVMware configuration screen

The default 8 Gigabytes for the CentOS installation will be fine for the test.


Next the wizard asks about network adapters.

To proceed, click the "Add a  Network Adapter", as this VM will be needing a network connection.


VMware configuration screen

VMware configuration screen

For the network, the Bridged interface will be used to make the test easier.

Power on as start should be ticked.

The next wizard screen asks about CD/DVD drives to connect.

for simplicity's sake, we will connect the physical CD/DVD drive to the VM. (Make sure the ISO install CD is in the drive on the physical machine for OS installation)


VMware configuration screen

VMware configuration screen


Select the CD/DVD drive location on the CentOS bare-metal OS.

Pressing next on the wizard shows the floppy disk configuration. A floppy drive is basically useless at the moment, so it will be left out by selecting "Don't add a floppy drive".


VMware configuration screen

VMware configuration screen

For the fun of it, the USB controller will be added. But otherwise it would be normally left out unless mapping USB drives or devices.

The last screen gives a summary of the installation before completing.

When all looks correct, pressing finish creates the virtual machine.


VMware configuration screen

Now there is a new virtual machine in the VMware Server web console.

By selecting the VM name in the left panel, access to the VM's information and tools becomes available to the user.


VMware configuration screen

To start the VM, go to the console tab and click on the play icon. (Again, check the install CD is in the CD/DVD drive).

Once started, click the console screen again to launch the VM display to start the installation of the OS into the virtual machine.

The OS installation screen should appear like a normal PC stating on a boot-able CD/DVD.

Guest Operating Systems that I have Tested:

Operating SystemGuest NotesWorking
CentOS (32bit) http://www.centos.org
  • Easy to install and set-up.
Working
Gentoo (32bit) http://www.gentoo.orgWorking
Slackware (32bit) http://www.slackware.com
  • Installed straight up with no problems.
Working
Untangle (32bit) http://www.untangle.com
  • Installed all fine.
  • Bit slow on the boot.
  • Network interfaces are a bit tricky to set-up.
  • Great firewall for other VMs.
Working
Windows XP (32bit) http://www.microsoft.com
  • Installed all fine.
  • Very snappy interface with VMware tools installed in the guest operating system.
Working





Over all, the VMware Server 2 software on CentOS 5.5 is easy to install, configure and create virtual machines.

A system administrator can get it all running in under an hour without much fuss



More to come in "VWware Server 2 - Part 2 & 3" of the blog , I talk about setting up virtual appliances, mounting ISO images and clustering the VMware Server, along with a few other interesting technical tweaks.

Stay tuned...

Tuesday, July 13, 2010

Latest Projects and Upcoming Articles

Here's some of the new projects that I have been working on. A bit of a mixed bag at the moment, from PSUs and robotics to VMware.
The projects include:
  • VMWare Infrastructure review and tricks.
  • Redundant 48 volts power supply for telecoms equipment.
  • Solar system reporting to computer intergration software.
  • A tracked robot running on Linux and wireless networking.
Burning the Midnight Tech Projects

Stay turned for these informative and useful project updates.

Further project information will be added to the new Burning the Midnight website.

Check it out at http://sites.google.com/site/burningthemidnightproject/