Build VM Cluster on CentOS Host

Host Machine

[root@bocoty49 ~]# lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 6.4 (Final) Release: 6.4 Codename: Final

VirtualBox

AMD64 version of "Oracle Linux 6("OL6")/Red Hat Enterprise Linux 6("RHEL6")/CentOS 6" on download page of VirtualBox website File name: VirtualBox-4.3-4.3.8_92456_el6-1.x86_64.rpm

Vagrant

CentOS/RedHat/Fedora 64-bit Vagrant Installer on Vagrant download page File name: vagrant_1.4.3_x86_64.rpm

Usage

  1. Install Virtualbox and vagrant;

  2. When 'vagrant up', a "vboxdrv kernel module is not loaded" error raise,

The "Release" of yum info kernel-headers is "431.5.1.el6", which mismatched the result of uname -r(2.6.32-358.23.2.el6.x86_64), so kernel-headers package is unavailable to the current kernel. The solution is update the kernel release to match the packages:

# yum update    (this will install kernel-2.6.32-431.5.1.el6.x86_64)
# reboot (after reboot `uname -r` returns "2.6.32-431.5.1.el6.x86_64", too)
# yum install gcc
# yum install kernel-devel
# /etc/init.d/vboxdrv setup  (Recompiling VirtualBox kernel modules)
  1. vagrant up again. The network for the VM is "bvtserver.vm.network :public_network", which is suspent when configuring the network. I change the type of network to "host-only":

    production.vm.network "private_network", ip: "192.168.50.5", virtualbox__intnet: "gcptest-network"

Now you can use ssh between each other via host-only NIC, and use apt-get to install packages via NAT NIC, so cool!

原文地址:https://www.cnblogs.com/darkmatter/p/3605582.html