Blog

Monday, May 09, 2016

Manually Patching VMware ESXi 5.X with vCLI esxcli

If you have purchased vSphere you can use Update Manager to Scan, Stage and Remediate patches to the machines running ESXi in your cluster. If you don't have vSphere you can always update ESXi manually. The instructions below give you one method to patch manually.

1. Determine which version of ESXi 5.X you are running. To do this - connect to the ESXi machine with the vSphere client typically as root. Help / About will show you your vSphere Client and VMware ESXi version and build numbers.

VMware Client Help About

2. Then proceed to the Download Patches page on VMware's website. You will need to login to the site to download patches. Now complete a search for ESXi (Embedded and Installable) for the appropriate version of ESXi 5.X. This will give you a list of patches as per the screenshots below. You now need to work out which patches you need to download (which can range in size from a 100-700MB.

VMware ESXi Patch Downloads

3. Once the patches have been downloaded, ensure you have downloaded and installed the VMware vSphere 5.5 CLI (vCLI).

4. Now place your ESXi machine to be patched in maintenance mode.

5. Upload the patch zip files (depots) to the local datastore of the ESXi box.

VMware vSphere Client Datastore Browser

6. Determine the complete path to the datastore. In the vSphere client, this can be obtained by clicking on the Configuration tab, Storage option and selecting the Local Disk. In this case the datastore path is /vmfs/volumes/datastore1.

ESXi datastore1

7. Next, open a command prompt and change directory to the vCLI bin directory which should be C:\Program Files (x86)\VMware\VMware vSphere CLI\bin.

 8. Now ensure you can read uploaded depots using the following vCLI command (you will be prompted for the root password):

esxcli --server=<servername> --username=root software sources vib list --depot=/vmfs/volumes/datastore1/ESXi550-201510001.zip


You should see output similar to the following:

Contents listing of an ESXi patch depot

9. Now apply the depot using the following command. You may have to reboot the ESXi box after the depot has been applied before applying the next depot.

esxcli --server=<servername> --username=root software vib update --depot=/vmfs/volumes/datastore1/ESXi510-201510001.zip


You should see output similar to the following:

Installing a VMware ESXi depot

10. ... and that's it - after the ESXi box reboots it will be running the version you just patched up to. Remember to delete the patches from the local datastore as they are no longer required. Also take the ESXi box out of maintenance mode. More information can also be found here.

Monday, September 30, 2013

Installing Perl and the VMXNET3 driver retrospectively on a minimalist vSphere CentOS 6 virtual machine

When installing a minimal CentOS 6.4 VM on vSphere 5.1 or later, Perl is not automatically installed. This means you can't install VMware tools and thus the VMXNET3 driver to enable networking. You could change the initial setup of your VM (eg. add the Perl packages during the install of CentOS or install an E1000 adapter in addition to the VMXNet3 adapter) but you might be in the situation that requires a nice clean install. The steps below allow you to retrospectively install Perl and VMware tools.

Assumptions

  1. The VM was created with a single VMXNET3 adapter
  2. An x64 instance of CentOS 6.4 was installed using the "Minimal" default installation of CentOS
  3. The CentOS 6.4 ISO is still connected to the VM
  4. You can login as root via the Virtual Machine Console in the vSphere Client
  5. You have a DHCP server on your network

Step 1: Mount the CentOS 6.4 ISO

Ensure the ISO is connected to the VM. Then at the root prompt type:

mount /dev/cdrom /mnt
cd /mnt/Packages

Step 2: Install the necessary Perl packages

Now type using tab command completion (line is wrapped for readability):

yum --disablerepo=* localinstall 
    perl-5.10.1-129.el6.x86_64.rpm 
    perl-libs-5.10.1-129.el6.x86_64.rpm 
    perl-version-0.77-129.el6.x86_64.rpm 
    perl-Module-Pluggable-3.90-129.el6.x86_64.rpm 
    perl-Pod-Simple-3.13-129.el6.x86_64.rpm 
    perl-Pod-Escapes-1.04-129.el6.x86_64.rpm

6 packages should be installed.

Step 3: Unmount the ISO

Now type at the command prompt:

cd
umount /mnt

Step 4: Install VMware Tools

In the Virtual Machine Console go to the VM menu and choose Guest -> Install/Upgrade VMware Tools. Then at the command prompt:

mount /dev/cdrom /mnt
cd /tmp
tar xvzf /mnt/VMwareTools-9.0.5-1137270.tar.gz
cd vmware-tools-distrib
./vmware-install.pl
cd
umount /mnt

Follow the prompts to install VMware Tools. The defaults usually suffice. Remember this only installs VMware tools for the currently running kernel. If you do a yum update you will need to reinstall VMware Tools. Additionally note that the exact VMwareTools tgz will depend on the version of the ESXi hypervisor you are running so you might have to adjust the file name to suite.

Step 5: Check the VMXNET3 driver is loaded

At the command prompt:

lsmod | grep vmxnet

You should see the following similar output - this means the driver is loaded and is unused.

vmxnet3        42862   0

Step 6: Edit the network settings

Now edit the network settings:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Change your network settings as you see fit but minimally change the following line in ifcfg-eth0 in order to get a DHCP lease:

ONBOOT=yes

Step 7: Restart the network and get a lease

At the command prompt type:

service network restart

The network will restart and you should have an IP address assigned via DHCP. Type:

ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:56:87:51:A9
          inet addr:10.0.0.163  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fe87:51a9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:338 errors:0 dropped:0 overruns:0 frame:0
          TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:40438 (39.4 KiB)  TX bytes:7155 (6.9 KiB)

That's it! All done.

Addendum from Tristan at Aptira:

A simpler way as the VMXNET3 driver is included with CentOS minimal for all 6.x versions.

  1. Install OS
  2. vi ifcfg-eth0 and set ONBOOT=yes
  3. Reboot and the network should come up.
  4. yum -y wget
  5. Grab the latest VMware repo from here http://packages.vmware.com/tools/esx/latest/repos/index.html. For example wget http://packages.vmware.com/tools/esx/latest/repos/vmware-tools-repo-RHEL6-9.10.1-1.el6.x86_64.rpm
  6. rpm -ivh vmware-tools-repo-RHEL6-9.4.5-1.el6.x86_64.rpm
  7. yum install -y vmware-tools-esx-nox
  8. Profit!

 

 

Saturday, August 17, 2013

Configuring a Clustered NetApp Filer as an NFS Datastore for VMware ESXi Implementing Multiple VLANs, MTUs and IPs

On your NetApp filer you can easily configure multiple VLANs with differing MTU on the same LACP trunked 1GbE or 10GbE ports with stacked IPs on the storage VLAN network to assist with load balancing.  In this example, network 10.0.0/24 (VLAN 10, MTU 1500) is just the regular network. Network 10.0.1/24 (VLAN 20, MTU 9000) is the NFS storage network. On your switch create an LACP trunk to the filer's interfaces and then trunk VLANs 10 and 20. Your ESXi servers storage network would also be on VLAN 20 and use the load balancing policy of Route based on IP hash. On the switch you would create a static trunk (since ESXi 5 does not support LACP). The VMkernel port on the vSwitch would be untagged for the storage network. Here's /etc/rc:

hostname filer1
ifconfig e0a flowcontrol send
ifconfig e0b flowcontrol send
ifconfig e0c flowcontrol send
ifconfig e0d flowcontrol send
vif create lacp NETWORK -b ip e0a e0b e0c e0d
vlan create NETWORK 10 20
ifconfig NETWORK-10 `hostname`-NETWORK-10 netmask 255.255.255.0 mtusize 1500 -wins partner 10.0.0.51
ifconfig NETWORK-20 `hostname`-NETWORK-20 netmask 255.255.255.0 mtusize 9000 -wins partner 10.0.1.54
ifconfig NETWORK-20 alias `hostname`-NETWORK-20-ALIAS-1 netmask 255.255.255.0
ifconfig NETWORK-20 alias `hostname`-NETWORK-20-ALIAS-2 netmask 255.255.255.0
ifconfig NETWORK-20 alias `hostname`-NETWORK-20-ALIAS-3 netmask 255.255.255.0
route add default 10.0.0.1
routed on
options dns.enable on
options nis.enable off
savecore

Ensure /etc/hosts is populated correctly with the IP of both toasters in the event of failover/failback:

127.0.0.1 localhost
10.0.0.50 filer1 filer1-NETWORK-10   
10.0.1.50 filer1-NETWORK-20
10.0.1.51 filer1-NETWORK-20-ALIAS-1
10.0.1.52 filer1-NETWORK-20-ALIAS-2
10.0.1.53 filer1-NETWORK-20-ALIAS-3
10.0.0.51 filer2 filer2-NETWORK-10
10.0.1.54 filer2-NETWORK-20
10.0.1.55 filer2-NETWORK-20-ALIAS-1
10.0.1.56 filer2-NETWORK-20-ALIAS-2
10.0.1.57 filer2-NETWORK-20-ALIAS-3

Ensure your VM exports (/etc/exports) are secured ensuring only access from your ESXi VMKernel port on the storage switch of each ESXi host - in this case there are 3 ESXi hosts. Additionally, individual IPs don't necessarily need to be used if an entire subnet requires rw and root access to the VM volumes:

/vol/root      -sec=sys,rw,anon=0,nosuid
/vol/root/home -sec=sys,rw,nosuid
/vol/downloads -sec=sys,rw,nosuid
/vol/vm00      -sec=sys,rw=10.0.1.10:10.0.1.11:11.0.1.12,root=10.0.1.10:10.0.1.11:11.0.1.12
/vol/vm01      -sec=sys,rw=10.0.1.10:10.0.1.11:11.0.1.12,root=10.0.1.10:10.0.1.11:11.0.1.12
/vol/vm02      -sec=sys,rw=10.0.1.10:10.0.1.11:11.0.1.12,root=10.0.1.10:10.0.1.11:11.0.1.12
/vol/vm03      -sec=sys,rw=10.0.1.10:10.0.1.11:11.0.1.12,root=10.0.1.10:10.0.1.11:11.0.1.12
/vol/iso       -sec=sys,rw=10.0.1.10:10.0.1.11:11.0.1.12,root=10.0.1.10:10.0.1.11:11.0.1.12

This configuration would be need to be made identically on filer1 and filer2 with the exception that on filer2 the hostname changes in /etc/rc.


Recent Posts



Tags


Archive

    Sign up for Product Updates and Discounts
    Captcha Image
    ×