Step by step: creating a virtual machine on a headless server

Step by step: creating a virtual machine on a headless server

The following instructions may give you an idea how to create a virtual machine on a headless server over a network connection. We will create a virtual machine, establish an RDP connection and install a guest operating system -- all without having to touch the headless server. All you need is the following:

  1. VirtualBox on a server machine with a supported host operating system. The VirtualBox extension pack for the VRDP server must be installed (see the previous section). For the following example, we will assume a Linux server.

  2. An ISO file accessible from the server, containing the installation data for the guest operating system to install (we will assume Windows XP in the following example).

  3. A terminal connection to that host through which you can access a command line (e.g. viassh).

  4. An RDP viewer on the remote client; see the section called “Common third-party RDP viewers” above for examples.

Note again that on the server machine, since we will only use the headless server, neither Qt nor SDL nor the X Window system will be needed.

  1. On the headless server, create a new virtual machine:

    VBoxManage createvm --name "Windows XP" --ostype WindowsXP --register

    Note that if you do not specify --register, you will have to manually use theregistervm command later.

    Note further that you do not need to specify --ostype, but doing so selects some sane default values for certain VM parameters, for example the RAM size and the type of the virtual network device. To get a complete list of supported operating systems you can use

    VBoxManage list ostypes
  2. Make sure the settings for this VM are appropriate for the guest operating system that we will install. For example:

    VBoxManage modifyvm "Windows XP" --memory 256 --acpi on --boot1 dvd --nic1 nat
  3. Create a virtual hard disk for the VM (in this case, 10GB in size):

    VBoxManage createhd --filename "WinXP.vdi" --size 10000
  4. Add an IDE Controller to the new VM:

    VBoxManage storagectl "Windows XP" --name "IDE Controller"
          --add ide --controller PIIX4
  5. Set the VDI file created above as the first virtual hard disk of the new VM:

    VBoxManage storageattach "Windows XP" --storagectl "IDE Controller"
          --port 0 --device 0 --type hdd --medium "WinXP.vdi"
  6. Attach the ISO file that contains the operating system installation that you want to install later to the virtual machine, so the machine can boot from it:

    VBoxManage storageattach "Windows XP" --storagectl "IDE Controller"
          --port 0 --device 1 --type dvddrive --medium /full/path/to/iso.iso
  7. Start the virtual machine using VBoxHeadless:

    VBoxHeadless --startvm "Windows XP"

    If everything worked, you should see a copyright notice. If, instead, you are returned to the command line, then something went wrong.

  8. On the client machine, fire up the RDP viewer and try to connect to the server (seethe section called “Common third-party RDP viewers” above for how to use various common RDP viewers).

    You should now be seeing the installation routine of your guest operating system remotely in the RDP viewer.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值