Monday, May 25, 2015

Install Linux on Virtualbox with command line

Table of Contents

1. Install virtual box

On an Arch machine

Update arch before installing
$ pacman -Syu $ pacman -S virtualbox Install other optional dependencies for virtualbox
  • qt4: GUI support
  • vde2: Virtual Distributed Ethernet support
  • virtualbox-guest-iso: Guest Additions CD image
  • virtualbox-ext-vnc: VNC server support
  • virtualbox-sdk: Developer kit
  • virtualbox-host-dkms: Build kernel modules with DKMS
  • net-tools: Host-only or bridged networking support [installed]
Install VirtualBox extention pack
$ wget ""
$ sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.26.vbox-extpack

2. Download Arch Installer

Go to and download from one of the links
$ wget -p ~/Downloads ""

3. Arch instalation on virtualbox

3.1 List all installed vms on our virtualbox

This currently returns nothing as there are no installed vms
$ VBoxManage list vms

3.2 List ostypes recognised by virtualbox

$ VBoxManage list ostypes | grep -i -A4 arch
ID:          ArchLinux
Description: Arch Linux (32 bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      false

ID:          ArchLinux_64
Description: Arch Linux (64 bit)
Family ID:   Linux
Family Desc: Linux
64 bit:      true 

3.3 Create and register a virtual machine with name 'vm-arch-home' with ostype ArchLinux_64

$ VBoxManage createvm –name 'vm-arch-home' –ostype ArchLinux64 –register
Virtual machine 'vm-arch-home' is created and registered.
UUID: 17bf6520-2c03-4542-830f-2d335669ccd4
Settings file: '/home/younus/VirtualBox VMs/vm-arch-home/vm-arch-home.vbox'

3.4 Modify vm to setup memory, cpus, bridgeadaptor, clipboard, etc..

Bridge adaptor can be optained by ifconfig command as shown bellow
$ VBoxManage modifyvm 'vm-arch-home' –memory 3048 –cpus 2 –pae on –acpi on –hpet on –ioapic on –hwvirtex on –vtxvpid on –accelerate3d off –audio none –chipset ich9 –nic1 bridged –bridgeadapter1 wlp2s0 –nictype1 82543GC –vrde on –vrdeport 5555 –clipboard bidirectional

3.5 Create a sata controller named storage for the virtual disk

$ VBoxManage storagectl 'vm-arch-home' –name storage –add sata –controller IntelAHCI –portcount 4 –hostiocache off

3.6 Create and add storage as virtual disk of size 10Gb and setup permisions

$ sudo VBoxManage createhd –filename /storage/soft/vbox/vm-arch-home/root-sda.vdi –size 10240
Disk image created. UUID: 7ee167ba-0157-46a4-b3a2-12cd3702f81c
$sudo chmod 777 /storage/soft/vbox/vm-arch-home/root-sda.vdi Attach the hardisk to sata controller on port 1
$ VBoxManage storageattach 'vm-arch-home' –storagectl storage –port 1 –medium /storage/soft/vbox/vm-arch-home/root-sda.vdi –type hdd

3.7 Attach the arch dual boot instaler iso file to port 2 of the sata controller

$ VBoxManage storageattach 'vm-arch-home' –storagectl storage –port 2 –medium archlinux-dual.iso –type dvddrive

3.8 Set vm to boot from dvd

$ VBoxManage modifyvm 'vm-arch-home' –boot1 dvd

3.9 Boot the newly created vm

$ VBoxHeadless -s 'vm-arch-home' &

3.10 Remotely access the desktop of the vm

$ rdesktop-vrdp localhost:5555

4 Other usefull commands

4.1 Listing extention packs installed on virtualbox

$ sudo VBoxManage list extpacks