zoukankan      html  css  js  c++  java
  • VBoxManage

    虚拟机名称 centos6.9-1 centos6.9-2 centos6.9-3
    使用命令开机 虚拟机
    VBoxManage startvm 'centos6.9-1' 正常启动
    VBoxManage startvm centos6.9-2 -type vrdp 无界面启动
    VBoxManage startvm centos6.9-2 --type headless 无界面启动 推荐使用
    VBoxManage startvm 'centos6.9-3'
     
     
    查看正在运行的虚拟机
    VBoxManage list runningvms
     
    关闭虚拟机
    VBoxManage controlvm 'centos6.9-2' poweroff 断电关闭虚拟机
    VBoxManage controlvm centos6.9-2 savestate 休眠虚拟机
    VBoxManage discardstate centos6.9-2 放弃休眠,直接关闭
    VBoxManage controlvm centos6.9-2 acpipowerbutton 正常关闭 centos6.9 推荐使用
     
    查看快照列表
    VBoxManage snapshot centos6.9-2 list
     
    创建快照
    VBoxManage snapshot centos6.9-2 take snap20180603 snap20180603为快照名称
    删除快照
    VBoxManage snapshot centos6.9-2 delete snap20180603
    快照回复
    uuid 使用 查看快照列表获取
    VBoxManage snapshot centos6.9-2 restore 0307c6d5-1258-4cd4-984a-4341f17c1bf9 [uuid]
     
    设置开机自启动
     
    virtualbox(vboxmanage)自动启动虚拟机
    系统centos 7,virtualbox 5,宿主机重启后,其上的虚拟机不能自动启动,怎样才能使虚拟机能随主机启动而自动启动呢?步骤如下:
    步骤一:
    # vi /etc/default/virtualbox
    # virtualbox defaults file
    VBOXAUTOSTART_DB=/etc/vbox
    VBOXAUTOSTART_CONFIG=/etc/vbox/autostartvm.cfg
    步骤二:
    #vi /etc/vbox/autostartvm.cfg
    # Default policy is to deny starting a VM, the other option is "allow".
    default_policy = deny
    # Create an entry for each user allowed to run autostart
    root = {
    allow = true
    startup_delay = 10
    }
    步骤三:
    #VBoxManage setproperty autostartdbpath /etc/vbox
    步骤四:centos6.9-2为需要开机自启动的虚拟机
    #VBoxManage modifyvm centos6.9-2 --autostart-enabled on
    步骤五:
    #service vboxautostart-service restart --测试发现stop/start不能启动vm,而restart则可以
    --详细操作参考参考文献【1】。
     
    参考文献:
    【1】 How To Set Your VirtualBox 4.2 VM to Automatically Startup ,http://lifeofageekadmin.com/how-to-set-your-virtualbox-vm-to-automatically-startup/
    【2】 9.24. Starting virtual machines during system boot,http://www.virtualbox.org/manual/ch09.html#autostart
    【3】 8.8.9. Auto starting VMs during host system boot,http://www.virtualbox.org/manual/ch08.html
     
    如果以上不起作用的情况下
    编辑shell脚本
    #!/bin/bash
    VBoxManage startvm centos6.9-1 --type headless
    VBoxManage startvm centos6.9-2 --type headless
    VBoxManage startvm centos6.9-3 --type headless
     
    添加执行权限
    chmod +x /etc/vbox/vm_centos.sh
    加入到开机自启动脚本中
     
    安装增强工具,实现文件共享
    点击安装增强
     
    yum -y upgrade kernel kernel-devel
    yum install kernel sources kernel-devel
     
    sshfs
     
    挂载虚拟光驱
    mount /dev/cdrom /mnt/
     
    cd /mnt/ 查看列表
    执行文件
    ./VBoxLinuxAdditions.run
     
    cat /proc/version
    查看版本信息,添加版本
    /sbin/rcvboxadd quicksetup
    /sbin/rcvboxadd quicksetup 3.10.0-957.1.3.el7.x86_64
     
    /sbin/rcvboxadd quicksetup 3.10.0-957.10.1.el7.x86_64
     
    执行挂载命令
     
    # 挂载命令 共享目录 要挂载到的目录
    mount -t vboxsf www /data/www/
     
     
  • 相关阅读:
    闲谈:价值、服务、时间、用户体验、美、过度开发
    笔记:Sublime Text 3
    快速切换目录命令go
    miniPy for CentOS 5/6
    用Fabric实现小批量的自动化上线
    异步多线程C/S框架gko_pool
    Reboot分享第三期(已结束)
    Reboot分享第二期(已结束)
    Reboot分享第一期(已结束)
    iptables从入门到精通
  • 原文地址:https://www.cnblogs.com/starfish29/p/10722945.html
Copyright © 2011-2022 走看看