Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2453840
  • 博文数量: 328
  • 博客积分: 4302
  • 博客等级: 上校
  • 技术积分: 5486
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-01 11:14
个人简介

悲剧,绝对的悲剧,悲剧中的悲剧。

文章分类

全部博文(328)

文章存档

2017年(6)

2016年(18)

2015年(28)

2014年(73)

2013年(62)

2012年(58)

2011年(55)

2010年(28)

分类: 虚拟化

2017-02-24 00:15:54

As something of a follow-up post to the previous entry, here’s a quick recipe for creating a Virtual Machine using the VirtualBox command line tools:

We’re using Windows Server 2008 64bit as an example, modify to taste.

$ VM='Windows-2008-64bit'

Create a 32GB “dynamic” disk.

$ VBoxManage createhd --filename $VM.vdi --size 32768

You can get a list of the OS types VirtualBox recognises using:

$ VBoxManage list ostypes

Then copy the most appropriate one into here.

$ VBoxManage createvm --name $VM --ostype "Windows2008_64" --register

Add a SATA controller with the dynamic disk attached.

$ VBoxManage storagectl $VM --name "SATA Controller" --add sata \ > --controller IntelAHCI $ VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 \ > --device 0 --type hdd --medium $VM.vdi

Add an IDE controller with a DVD drive attached, and the install ISO inserted into the drive:

$ VBoxManage storagectl $VM --name "IDE Controller" --add ide $ VBoxManage storageattach $VM --storagectl "IDE Controller" --port 0 \ > --device 0 --type dvddrive --medium /path/to/windows_server_2008.iso

Misc system settings.

$ VBoxManage modifyvm $VM --ioapic on $ VBoxManage modifyvm $VM --boot1 dvd --boot2 disk --boot3 none --boot4 none $ VBoxManage modifyvm $VM --memory 1024 --vram 128 $ VBoxManage modifyvm $VM --nic1 bridged --bridgeadapter1 e1000g0

Configuration is all done, boot it up! If you’ve done this one a remote machine, you can RDP to the console via vboxhost:3389.

$ VBoxHeadless -s $VM

Once you have configured the operating system, you can shutdown and eject the DVD.

$ VBoxManage storageattach $VM --storagectl "IDE Controller" --port 0 \ > --device 0 --type dvddrive --medium none

Finally, it’s a good idea to take regular snapshots so that you can always revert back to a known-good state rather than having to completely re-install.

$ VBoxManage snapshot $VM take 

And, if you need to revert back to a particular snapshot:

$ VBoxManage snapshot $VM restore 

Enjoy!


Repost from 
阅读(1417) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~