Sunday, July 12, 2009

使用virtualbox创建Linux测试环境

为方便主机与guest机之间通信, 又不想到如下工作:
1. 安装虚拟网卡(bridged 之类的)
2. 安装guest additions之类的

主机与guest机可以ssh就行了(host 与 guest都是linux)

很方便的配置如下选项:

VBoxManage setextradata NameOfYourGuest
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
VBoxManage setextradata NameOfYourGuest
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage setextradata NameOfYourGuest
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP

重启一下virtualbox后, 有如下端口被使用了:
jessinio@niolaptop ~/.stardict $ netstat -an|grep 2222
tcp 0 0 0.0.0.0:2222 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:52626 127.0.0.1:2222 ESTABLISHED
tcp 0 0 127.0.0.1:2222 127.0.0.1:52626 ESTABLISHED

使Virtualbox默默地在后台运行:

VBoxManage startvm ubuntu -type vrdp

备份vdi文件, 再加上rsa公钥, 完美的linux测试环境创建完了

tag: virtualbox bridged network vrdp

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.