bluedrag (bluedrag) wrote,

Хозяке на заметку

How to create a VirtualBox VM on an Ubuntu server from scratch.

apt-get upgrade virtualbox
VBoxManage createvm --name foo --ostype Ubuntu_64 --basefolder /vm/ --register

# configure it to use bridge networking
VBoxManage modifyvm foo --memory 2048 --cpus 2 --pae on --acpi on --hpet on --ioapic on --hwvirtex on --vtxvpid on --accelerate3d off --audio none --chipset ich9 --nic1 bridged --bridgeadapter1 eth0 --vrde on --vrdeport 5555 --clipboard bidirectional --vrdeaddress <server ip addr>

# create and attach a 10G virtual disk
VBoxManage createhd --filename /vm/storage/bar.vdi --size 10240
VBoxManage storagectl foo --name storage --add sata --controller IntelAHCI --portcount 4 --hostiocache off

# configure to boot from the install image
VBoxManage storageattach foo --storagectl storage --port 2 --medium /vm/ubuntu-14.04.1-server-amd64.iso --type dvddrive
VBoxManage modifyvm foo --boot1 dvd

# start
VBoxHeadless -s foo

# now go to any computer, vnc into the new virtual machine and finish the installation:
# vnc <server ip addr>:5555

# stop the VM and diconnect the DVD image
VBoxManage controlvm foo poweroff
VBoxManage storageattach foo --storagectl storage --port 2 --medium none
VBoxManage modifyvm foo --boot1 disk

# start it again, vnc in, configure the ssh access and power off
# from now on, alway start with vnc disabled, and use ssh to log in:
nohup VBoxHeadless -s foo --vrde off&
Tags: linux
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.