通过vmware tools使虚拟机与主机时间同步

在安装Oracle RAC时,需要cluster各个节点上的时间保持同步,否则可能会遇到类似如下错误:"/bin/tar: ./inventory/Components21/oracle.ordim.server/10.2.0.1.0: time
stamp 2006-11-04 06:24:04 is 25 s in the future"。

    在vmware虚拟机上安装RAC时,两台虚拟机的时间很难协调一致,因此经常会碰到上述类似错误。可以通过vmware tools使虚拟机上的时间与宿主机保持一致,从而解决该问题。步骤如下:

1、启动虚拟机后,选择vmware上的"Install VMware Tools..."菜单项,如下图:

通过vmware tools使虚拟机与主机时间同步
弹出如下对话框:

通过vmware tools使虚拟机与主机时间同步
点"Install"按钮,然后会在虚拟机的桌面上出现如下图标:

通过vmware tools使虚拟机与主机时间同步
双击上图中的VMware tools图标,出现如下窗口:

通过vmware tools使虚拟机与主机时间同步
双击VMwareTools-1.0.6-91891.i386.rpm,安装该程序包。

2、打开一个终端并执行 vmware-config-tools.pl,如下:

通过vmware tools使虚拟机与主机时间同步
选择一种显示模式,按回车。然后执行vmware-toolbox命令,出现如下窗口:

通过vmware tools使虚拟机与主机时间同步
选中上图中的"Time synchronization between the virtual machine and the host operating system"前面的复选框,关掉该对话框。

这时,在虚拟机的配置文件*.vmx就会出现一行tools.syncTime = "TRUE"。

3、进入到/boot/grub/目录中,编辑grub.conf文件,添加"clock=pit nosmp noapic nolapic
"。如下粗体字部分:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Enterprise (2.6.9-55.0.0.0.2.ELsmp)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-55.0.0.0.2.ELsmp ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        clock=pit nosmp noapic nolapic
        initrd /initrd-2.6.9-55.0.0.0.2.ELsmp.img
title Enterprise-up (2.6.9-55.0.0.0.2.EL)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-55.0.0.0.2.EL ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.9-55.0.0.0.2.EL.img

最后,重新启动虚拟机,就会发现虚拟机和宿主机的时间一致了。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25906825/viewspace-733060/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25906825/viewspace-733060/