Home > World Of Family > How to make Virtual Box Image Auto Start on Ubuntu (Without GUI)

How to make Virtual Box Image Auto Start on Ubuntu (Without GUI)


Virtualisasi saat ini merupakan salah satu alternatif dalam rangka mewujudkan Teknologi Ramah Lingkungan / Green Technology, sumber daya perangkat yang digunakan  bisa diminimalisir namun dapat menghasilkan Cluster System baru yang bisa dikustomize dengan kualitas tangguh. Proses maintenance dapat dengan mudah dilakukan meskipun berhadapan dengan banyak aplikasi produksi. Beberapa aplikasi tersohor mengusung teknologi Virtualiasi ini misalnya VMWare, VirtualBOX, Citrix, Hyper-V, Dll, kesemuanya memiliki kelebihan dan kekurangan masing-masing.  Bagi anda penggemar Dunia Open Source patut bersenang hati  karena VirtualBox hadir dengan layanan Free/Gratis namun fasilitas yang Oke punya. Bagi yang penasaran dan ingin mencoba VirtualBox bisa ikuti panduan dibawah, saya paste dari alamat berikut  http://www.kernelhardware.org/virtualbox-headless-vm

First Install VirtualBox from this post:

Install VirtualBox without GUI or Headless

VBoxManage for controlling VirtualBox on the Command Line

The main tool for controlling VirtualBox is called VBoxManage. The VirtualBox manual has 27 pages describing all the available paramaters for using VirtualBox. TheVirtualBox manual is a great resource to accompany this tutorial.

For this tutorial we will use Centos 5 as our guest OS to be installed.

Step 1 – Upload OS ISO

Upload Centos OS DVD / CD ISO file to server

Step 2 – Create new VM

First log in to the system with the user you want to use for your VM’s or create a new user for managing the VM’s. VirtualBox allows each user on the system to have and control there own VM’s.  The VM information is stored in /home/<username>/.VirtualBox ( The directory is created after you create your fist VM )

Create a new user (optional)

# useradd vmadmin
# passwd vmadmin

Login in as the new user vmadmin

Create the new VirtualBox guest VM

First we need to get the ID value for the type of OS that we are installing. Pick the ID value that corresponds to the type of OS you are going to install for the guest VM:

vmadmin$ VBoxManage list ostypes

Since I am going to install Centos 5 I would choose “RedHat”

–name – Name you want for your new VM guest

– ostype – Type of OS you are installing

–register – Register the new VM with VirtualBox (important)

vmadmin$ VBoxManage createvm --name "<guestvmname>"  --ostype RedHat --register

Create a Harddrive for the new VirtualBox guest VM to use

Now we need to create a VirtualBox VM Harddrive to go along with our VirtualBox VM machine:

– filename – File name you want for you new VM Harddrive

– size – The size of your new VirtualBox VM Harddrive in MB (n)

–register – Register the new VM Harddrive with VirtualBox (important)

vmadmin$ VBoxManage createhd --filename "<harddrivename.vdi>" --size n -- register

Modify the guest VM to use the VM Harddrive

–hda – Harddrive device

<guestvmname> – The name of guest vm you want to modify

<harddrivename.vdi> – The vm harddrive you want to add to this guest vm

vmadmin$ VBoxManage modifyvm "<guestvmname>" --hda "<harddrivename.vdi>"

Register our OS ISO with VirtualBox

–dvd (used for CD iso and DVD iso)

<filelocation and file name> – Full path to ISO file. (/home/vmadmin/Download/Centos5.iso)

vmadmin$ VBoxManage openmedium dvd <filelocation and file name>

Attach the ISO file to the VM

–dvd (used for CD iso and DVD iso)

<filelocation and file name> – Full path to ISO file. (/home/vmadmin/Download/Centos5.iso)

vmadmin$ VBoxManage modifyvm "<guestvmname>" --dvd <filelocation and file name>

Step 3 – Configure VRDP for VM

We need a way to view our guest VM. VirtualBox provides an RDP server that allows you to interact with each VM and mimic the functionally of a monitor.keyboard, and mouse that would normally be plugged in to a real server.

Enable VRDP on the guest VM

–vrdp – Turn vrdp function off and on

–vrdpport – Specify a port to use for the RDP connection (n)

–vrdpauthtype – Specify the type of authentication for connecting RDP users.

null – no authentication (insecure)

external – Use PAM (login with linux users on the system)

vmadmin$ VBoxManage modifyvm "<guestvmname>" --vrdp on --vrdpport n --vrdpauthtype null --vrdpmulticon on

Open the –vrdpport n port on your firewall

Step 4 – Start the VirtualBox VM

When using the command VBoxHeadless the VM will start in the current console and if you logout or close that console your VM will terminate. Therefore we use the linux commands nohup and & to place the process in the background.

vmadmin$ nohup VBoxHeadless --startvm <guestvmname>

Step 5 – Connect to your VM

Use an RDP client to connect to your VM. Enter the servers IP and your port number that you set with –vrdpport

Step 6 – Remove DVD / CD from VM

After you have installed your OS on the VM from the DVD / CD you will want to remove it from the list of devices, so that your VM doesnt always boot into the DVD / CD on startup.

vmadmin$ VBoxManage modifyvm "<guestvmname>" --dvd none
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: