The Task: Create your virtual machine on a linux server and install it without X.
Ohh, without GUI? iI must be difficult or not? Lets see it, to belive it.
First I had to update the server and then install virtualbox. It can be done easily with apt.
As my test server is behind a proxy I had to setup proxy for apt.
Ubuntu Server (11.10) behind proxy setting
.
There is an official Link for the setting I needed, but I had to change it just a bit:
https://help.ubuntu.com/community/AptGet/Howto#Setting_up_apt-get_to_use_a_http-proxy
Did not help:
testuser@myserver:~$ set | grep proxy http_proxy='http://testuser:Passwd123459@proxy.mycompany.com:3129' |
Did not help:
testuser@myserver:~$ sudo cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
# Defaults env_reset
Defaults env_keep="http_proxy https_proxy ftp_proxy"
|
Helped:
testuser@myserver:~$ cat /etc/apt/apt.conf Acquire::http::Proxy "http://testuser:Passwd123459@proxy.mycompany.com:3129"; |
After that I installed virtualbox
# apt-get install virtualbox |
And here comes the CLI wizzard for Virtualbox
———————————————-
-Create HD:
testuser@myserver:~/Data$ VBoxManage createhd --size 50000 --format vdi --filename /home/testuser/Data/VBox/Secureplatform.vdi 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Disk image created. UUID: 96cbed42-6c61-4f7b-8863-e837df8d6c42 testuser@myserver:~/Data$ |
-Create VM:
testuser@myserver:~/Data$ VBoxManage createvm --name Secureplatform --register --ostype Linux26 Virtual machine 'Secureplatform' is created and registered. UUID: 94db5fee-7425-410f-aeb1-15cf469165b9 Settings file: '/home/testuser/VirtualBox VMs/Secureplatform/Secureplatform.vbox' |
List of OS Types:
testuser@myserver:~/Data$ VBoxManage list ostypes
…
-Add HD to VM:
Problem:
testuser@myserver:~/Data$ VBoxManage modifyvm Secureplatform --hda /home/testuser/Data/VBox/Secureplatform.vdi VBoxManage: error: Could not find a storage controller named 'IDE Controller' VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component SessionMachine, interface IMachine, callee nsISupports Context: "AttachDevice(bstrController.raw(), u1, u2, DeviceType_HardDisk, hardDisk)" at line 723 of file VBoxManageModifyVM.cpp |
Solution:
testuser@myserver:~/Data$ VBoxManage storagectl Secureplatform --add ide --name "IDE Controller" testuser@myserver:~/Data$ VBoxManage modifyvm Secureplatform --hda /home/testuser/Data/VBox/Secureplatform.vdi |
-Add Networking and Memory:
testuser@myserver:~/Data$ VBoxManage modifyvm Secureplatform --memory 1024 testuser@myserver:~/Data$ VBoxManage modifyvm Secureplatform --nic1 bridged --bridgeadapter1 eth0 |
-Add DVD ISO to boot from DVD:
Problem:
testuser@myserver:~/Data$ VBoxManage modifyvm Secureplatform --dvd /home/testuser/Data/Check_Point_R75.40.Splat.iso VBoxManage: error: No drive attached to device slot 0 on port 1 of controller 'IDE Controller' VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component SessionMachine, interface IMachine, callee nsISupports Context: "MountMedium(Bstr("IDE Controller").raw(), 1, 0, dvdMedium, FALSE )" at line 952 of file VBoxManageModifyVM.cpp |
Solution:
testuser@myserver:~/Data$ VBoxManage storagectl Secureplatform --add sata --name "Sata Controller" testuser@myserver:~/Data$ VBoxManage storageattach Secureplatform --storagectl "Sata Controller" --port 1 --device 0 --type dvddrive --medium /home/testuser/Data/Check_Point_R75.40.Splat.iso |
-View settings of the VM:
testuser@myserver:~/Data$ VBoxManage showvminfo Secureplatform Name: Secureplatform Guest OS: Linux 2.6 UUID: 94db5fee-7425-410f-aeb1-15cf469165b9 Config file: /home/testuser/VirtualBox VMs/Secureplatform/Secureplatform.vbox Snapshot folder: /home/testuser/VirtualBox VMs/Secureplatform/Snapshots Log folder: /home/testuser/VirtualBox VMs/Secureplatform/Logs Hardware UUID: 94db5fee-7425-410f-aeb1-15cf469165b9 Memory size: 1024MB Page Fusion: off VRAM size: 8MB CPU exec cap: 100% HPET: off Chipset: piix3 Firmware: BIOS Number of CPUs: 1 Synthetic Cpu: off CPUID overrides: None Boot menu mode: message and menu Boot Device (1): Floppy Boot Device (2): DVD Boot Device (3): HardDisk Boot Device (4): Not Assigned ACPI: on IOAPIC: off PAE: off Time offset: 0 ms RTC: local time Hardw. virt.ext: on Hardw. virt.ext exclusive: on Nested Paging: on Large Pages: off VT-x VPID: on State: powered off (since 2012-04-24T08:02:46.000000000) Monitor count: 1 3D Acceleration: off 2D Video Acceleration: off Teleporter Enabled: off Teleporter Port: 0 Teleporter Address: Teleporter Password: Storage Controller Name (0): IDE Controller Storage Controller Type (0): PIIX4 Storage Controller Instance Number (0): 0 Storage Controller Max Port Count (0): 2 Storage Controller Port Count (0): 2 Storage Controller Bootable (0): on Storage Controller Name (1): Sata Controller Storage Controller Type (1): IntelAhci Storage Controller Instance Number (1): 0 Storage Controller Max Port Count (1): 30 Storage Controller Port Count (1): 30 Storage Controller Bootable (1): on IDE Controller (0, 0): /home/testuser/Data/VBox/Secureplatform.vdi (UUID: 96cbed42-6c61-4f7b-8863-e837df8d6c42) Sata Controller (1, 0): /home/testuser/Data/Check_Point_R75.40.Splat.iso (UUID: b7345393-d63a-40e3-9551-265df21d07fb) NIC 1: MAC: 080027DAC7B9, Attachment: Bridged Interface 'eth0', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny NIC 2: disabled NIC 3: disabled NIC 4: disabled NIC 5: disabled NIC 6: disabled NIC 7: disabled NIC 8: disabled Pointing Device: PS/2 Mouse Keyboard Device: PS/2 Keyboard UART 1: disabled UART 2: disabled Audio: disabled Clipboard Mode: Bidirectional VRDE: disabled USB: disabled USB Device Filters: Available remote USB devices: Currently Attached USB Devices: Shared folders: VRDE Connection: not active Clients so far: 0 Guest: Configured memory balloon size: 0 MB OS type: Linux26 Additions run level: 0 Guest Facilities: No active facilities. |
-Change Memory size of a VM:
testuser@myserver:~/Data$ VBoxManage modifyvm Secureplatform --memory 1600 |
-Setup VRD to make the installation of the VM from a remote host:
That step is the beauty of the whole post. You can reach a VM without any installed operating system!
You can install a remote system, that had no IP Adress. This is cool!
testuser@myserver:~/Data$ VBoxManage modifyvm Secureplatform --vrde on testuser@myserver:~/Data$ VBoxManage modifyvm Secureplatform --vrdeaddress 192.168.1.111 testuser@myserver:~/Data$ VBoxManage modifyvm Secureplatform --vrdeport 3001 testuser@myserver:~/Data$ VBoxManage modifyvm Secureplatform --vrdemulticon on |
Download extension pack from https://www.virtualbox.org/wiki/Downloads
testuser@myserver:~/Data$ ftp 1.1.1.1 ftp> get Oracle_VM_VirtualBox_Extension_Pack-4.1.12-77245.vbox-extpack ftp> exit testuser@myserver:~/Data$ sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.1.12-77245.vbox-extpack [sudo] password for testuser: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Successfully installed "Oracle VM VirtualBox Extension Pack". |
-Start VM Headless:
.
testuser@myserver:~/Data$ VBoxManage startvm Secureplatform -type headless Waiting for VM "Secureplatform" to power on... VM "Secureplatform" has been successfully started. |
After start you can check with netstat if the service for vrde is up and running on the server. In my case it is 3001 tcp port in the output of netstat.
-Stop VM:
testuser@myserver:~/Data$ VBoxManage controlvm Secureplatform poweroff 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% |
Posted on April 24, 2012
0