Virtualbox后台启动及获取虚拟机ip方法及windows远程登录方法

您所在的位置:网站首页 怎么查主机的ip地址 Virtualbox后台启动及获取虚拟机ip方法及windows远程登录方法

Virtualbox后台启动及获取虚拟机ip方法及windows远程登录方法

2024-07-05 06:12| 来源: 网络整理| 查看: 265

vmware提供后台启动(无界面模式),省去了界面占去的资源,但配置很麻烦,转用Virtualbox,但是一直不知道Virtualbox怎么后台启动,于是上网查了查:

一,通过VBoxManage.exe后台启动

其实Virtualbox是提供了后台启动的 不太习惯Linux的使用,但也很喜欢使用Linux命令操作方式和Linxu上的开发或者折腾。所以一直使用虚拟机,在Windows下用SSH连接Linux。但Virtualbox启动总会有界面出现,感觉老别扭。在网上搜了一下还真找到方法,其实Virtualbox是提供了后台启动的。只是不是默认的。

查看有哪些虚拟机

VBoxManage list vms

查看虚拟的详细信息

VBoxManage list vms --long

查看运行着的虚拟机

VBoxManage list runningvms

开启虚拟机在后台运行

VBoxManage startvm -type headless

开启虚拟机并开启远程桌面连接的支持

VBoxManage startvm -type vrdp

改变虚拟机的远程连接端口,用于多个vbox虚拟机同时运行

VBoxManage controlvm vrdpprot

关闭虚拟机

VBoxManage controlvm acpipowerbutton

强制关闭虚拟机

VBoxManage controlvm poweroff

命令行进入到你的Virtualbox安装目录试试这些命令就清楚了。比如我的是cd D:ApplicationVirtualBox 然后可以试试这些命令。

要后台启动只要在桌面新建一个批处理文件(.bat文件)。 写上一句代码就可以了:

我的 是 D:ApplicationVirtualBoxVBoxManage.exe startvm UbuntuServer -type headless 把路路径和虚拟机名改成自己的就可以了。以后每次要启动双击文件就可以了。 若要开机启动把这个文件放入菜单——启动文件里就可以。 。。。。 大功告成!!!!!

二,通过VBoxHeadless.exe后台启动 VBoxHeadless.exe -s 你的虚拟机主机名 三,获取ip

(1)首先查看正在运行的vm信息, 获取vm的name

C:\Program Files\Oracle\VirtualBox>VBoxManage list -l runningvms C:\Program Files\Oracle\VirtualBox>VBoxManage list -l runningvms Name: ubuntuxxxx Groups: / Guest OS: Ubuntu (64-bit)

(2) 获取ip

C:\Program Files\Oracle\VirtualBox>VBoxManage guestproperty enumerate ubuntuxxxx | findstr "Net.*V4.*IP" Name: /VirtualBox/GuestInfo/Net/0/V4/IP, value: 192.168.1.102, timestamp: 1586049646923776403, flags:

(3) win10自带shell终端可通过ssh登录到vm (虚拟机要提前安装ssh服务器端: apt-get install openssh-server)

C:\Program Files\Oracle\VirtualBox>ssh [email protected] [email protected]'s password: Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 5.3.0-28-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage * Canonical Livepatch is available for installation. - Reduce system reboots and improve kernel security. Activate at: https://ubuntu.com/livepatch 114 packages can be updated. 83 updates are security updates. Your Hardware Enablement Stack (HWE) is supported until April 2023. Last login: Sun Apr 5 16:07:25 2020 from 20.0.5.103 hostname@xx-VirtualBox:~$

更多请加 -h 查询



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3