想用vagrant搭建hadoop集羣,要完成如下準備工做:shell
關於vagrant的安裝和基本操做,請參考《Mac下vagrant從安裝到體驗》;centos
PermitRootLogin yes PasswordAuthentication yes
以上的設置已經知足我我的的須要了,您能夠按照本身的要求來作;網絡
zhaoqin@CN0014005932:~/vm/template$ vagrant package ==> default: Attempting graceful shutdown of VM... ==> default: Clearing any previously set forwarded ports... ==> default: Exporting VM... ==> default: Compressing package to: /Users/zhaoqin/vm/template/package.box zhaoqin@CN0014005932:~/vm/template$ ls Vagrantfile package.box
vagrant box add --name my-c7-template ./package.box
上述命令執行成功後,能夠在本地box列表中見到名爲<font color="blue">my-c7-template</font>的box:ssh
zhaoqin@CN0014005932:~/vm/template$ vagrant box add --name my-c7-template ./package.box ==> box: Box file was not detected as metadata. Adding it directly... ==> box: Adding box 'my-c7-template' (v0) for provider: box: Unpacking necessary files from: file:///Users/zhaoqin/vm/template/package.box ==> box: Successfully added box 'my-c7-template' (v0) for 'virtualbox'! zhaoqin@CN0014005932:~/vm/template$ vagrant box list centos/7 (virtualbox, 1905.1) customize-c7 (virtualbox, 0) my-c7-template (virtualbox, 0)
<font color="red">注意:執行vagrant box add命令的時候,最後一個參數指明瞭box文件的位置,我這裏加了"./"指明是當前目錄,這個"./"必定不能省掉,不然頗有可能去找到了其餘目錄下的package.box文件</font> 模板製做已經完成,接下來驗證這個實例;ide
config.vm.network "private_network", ip: "192.168.33.10"
以上就是個性化虛擬機模板的製做過程,藉助此功能能夠高效的建立虛擬機實例,但願本文可以給您一些參考。工具