Showing posts with label VirtualBox. Show all posts
Showing posts with label VirtualBox. Show all posts

Sunday, January 18, 2015

Ubuntu - VirtualBox - Setup - Add a new hard drive to Ubuntu VM

Environment:

OS: Ubuntu 14.04 guest VM
VirtualBox: 4.3.6 on Windows 7 host




Add a hard drive in VirtualBox:

  1. Go to VirtualBox Manager
  2. Select the VM where drive needs to be added and click 'Settings' (ctrl+S)
  3. On settings dialog, click on 'Storage' from left navigation panel. 'Storage Tree' and 'Attributes' will be shown at right side (see Pic-01)
  4. Under 'Storage Tree', select 'Controller: SATA', 'Add CD/DVD Device' and 'Add Hard Disk' icons will be displayed (see Pic-01)
  5. Click on 'Add Hard Disk' (see Pic-01)
  6. Pic-01: Settings dialog box
  7. Click on 'Create New Disk' on popup (see Pic-02)
    Pic-02
  8. Select 'VDI - VirtualBox Disk Image' and Click Next
    Pic-03: HDD file type
  9. Select hard drive file type and click Next
    Pic-04: Storage on Hard drive
  10. Specify file lcoation and size and click Create. It will take few minutes to finish. 

Make the hard drive available in Ubuntu:
  1. Check drives
    Command: "sudo fdisk -l"
    Output:
    Disk /dev/sdb: 107.4 GB, 107374182400 bytes255 heads, 63 sectors/track, 13054 cylinders, total 209715200 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/sdb doesn't contain a valid partition table
  2. Create partition
    Command: "sudo fdisk /dev/sdb"
  3. type 'n' to create partition
  4. Next select partition type p=Primary, e=Extended
  5. Specify number of partitions
  6. I had to create two partitions. For me next two options were to specify first sector and last sector where I selected default.
  7. 'w' to write the changes
  8. 'q' to quite fdisk
  9. Update kernel with changes
    Command: "sudo partprobe /dev/sdb"
  10. Format hard drive
    Command: "sudo mkfs /dev/sdb2 -t ext4"
  11. Create a directory for mount point. Following convention to create under /mnt
    Command: "sudo mkdir /mnt/sdb2"
  12. Make the folder writable
    Command: "sudo chmod 777 /mnt/sdb2"
  13. Mount drive to folder
    Command: "sudo mount /dev/sdb2 /mnt/sdb2 -t ext4"

Monday, January 12, 2015

VirtualBox - Ubuntu - create and share a SharedFolder in Ubuntu VM

Environment:
OS: Ubuntu 14.04 on Guest VM
VirtualBox: 4.3.6 on Host Machine Windows 7



Steps to follow:


  • Need to make sure "Virtualbox Guest Additions" is installed (see Resource-01)
  • Creating a folder in Host Windows
  • Create a 'Shared Folder' in VirtualBox
    1. Start the VM and go to 'Devices > Shared Folders Settings...'
    2. On Settings dialog, click on 'Shared Foldrers' which will show existing shared folders at right (see pic-01)
    3. Click on 'Add new shared folder definition' icon (see pic-01)
      Pic-01
    4. Specify 'folder path', 'Folder Name' (see pic-02) and click 'Ok' 
      Pic-02
    5. Click 'Ok' on Settings dialog

  • Prepare Ubuntu VM

    • Create a folder where host folder with be mapped to 
    • Run mount command - "sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) SharedWithVMs ~/SharedWithVMs". In this case shared folder in VirtualBox and folder in Ubuntu VM having same name
Resources:
  1. How to install "VirtualBox Guest Additions" - http://peerprogrammer.blogspot.com/2015/01/virtual-box-setup-install-guest.html


Friday, January 9, 2015

Virtual Box - Ubuntu - Setup - Install guest addition and make auto resize work in Ubuntu

Background:
This article helps to install VirtualBox guest addition and setup auto-resize window feature.

Environment:
1. Ubuntu - 14.04
2. VirtualBox - 4.3.6
 
 

Guest Additions offer the following features

1. Mouse pointer integration  Means pressing the Host key is no longer required to “free” the mouse from being captured by the guest OS as you used to do.
2. Shared foldersEasy to share files between host and guest machine just like you do in Windows network share.VirtualBox treat a certain host directory as a shared folder, and VirtualBox will make it available to the guest operating system as a network share.
3. Better video supportCustom video drivers shipped with VirtualBox Guest Additions provides extra high and non-standard video modes as well as accelerated video performance. With Guest Additions,3D graphics and 2D video for guest applications can be accelerated.

4. Time synchronization
Enables synchronization of host system’s time with guest operating system.

5. Shared clipboard
With the Guest Additions installed, the clipboard of the guest operating system can optionally be shared with your host operating system 
 
 
Steps to follow:
 
  • Install guest addition - option-01
    • Click on Install Guest Additions… from the Devices menu on VirtualBox screen, then choose Run when requested. This should start virtualBox guest addition installation automatically and just need to follow on screen instructions.
 
  • Install guest addition - option-02
    1. Open terminal (on Applications/System/Terminal or on Applications/Terminal or CTRL+ALT+T)
    2. Update APT database
      sudo apt-get update; (password might require)
    3. Install the latest security updates
      sudo apt-get upgrade;
    4. Install required packages
      sudo apt-get install build-essential module-assistant;
    5. Configure system for building kernel modules
      sudo m-a prepare;
    6. Click on Install Guest Additions… from the Devices menu on VirtualBox screen, then choose to browse the content of the CD when requested.
    7. Run
      sudo sh /media/cdrom/VBoxLinuxAdditions.run
    8. Follow the instructions on screen
 
 
  •  Setup auto-resize window
    Command: sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
 
 
Resources:
1. Link 01 - http://sharadchhetri.com/2014/10/07/ubuntu-14-04-install-virtualbox-guest-additions-also-create-videos/ 
 
 
 
 

Wednesday, July 11, 2012

VirtualBox - Setup - RDP to windows VM

There are two options to setup Remote Desktop in Guest VM using Oracle VirtualBox. Once the RDP is setup, windows RDP client can be used to connect to the VM.

1. Option-01: Use VirtualBox RDP feature
2. Option-02: Use guest VM's RDP directly

Environment Information:
1. Operating System: Windows 2008 R2
2. Oracle VirtualBox: 4.1.16

Option-01: Use VirtualBox RDP featureSetup Correct Network Adapter:

  1. Enable 'Remote Display Server' in VM Manager
    1. Go to VirtualBox Manager
    2. Select the VM where RDP is needed
    3. Click 'Settings'
    4. From left navigation panel, click 'Display'
    5. From right pane, select 'Remote Display' tab
    6. Check 'Enable Server'
    7. Provide a port number in 'Server Port:' (remember this port which will be needed to setup Firewall later)
    8. Click 'OK'
  2. Enable RDP in host:
    1. Click 'Start', point to 'Control Panel', click 'System and Security', click 'System' and then click 'Remote Settings' or
      Click 'Start', right-click 'My Computer', click 'Properties' and then click 'Remote Settings'
    2. On 'Remote' tab, under 'Remote Desktop' section, select 'Allow connections from computers', second option. (Based on need, third option can be selected; Allow connections only from computers running Remote Desktop with network level authentication)
  3. Create a Firewall rule in host:
    1. Click 'Start' - 'Administrator Tools' - Windows Firewall with Advanced Security'
    2. Click 'Inbound Rules' from left navigation panel
    3. Click 'New Rule...'
    4. Select 'Port' - hit 'Next'
    5. Select 'TCP', specify port number which is given in Step-01.07 - hit 'Next'
    6. Select 'Allow the connection' - hit 'Next'
    7. Select 'Domain', 'Private', 'Public' based on need - hit 'Next'
    8. Provide a unique name for the rule - hit 'Finish'
  4. Install VirtualBox Guest Additions
Option-02: Use guest VM's RDP directly:
  1. Enable Remote Desktop in guest:
    1. Click 'Start', point to 'Control Panel', click 'System and Security', click 'System' and then click 'Remote Settings' or
      Click 'Start', right-click 'My Computer', click 'Properties' and then click 'Remote Settings'
    2. On 'Remote' tab, under 'Remote Desktop' section, select 'Allow connections from computers', second option. (Based on need, third option can be selected; Allow connections only from computers running Remote Desktop with network level authentication)
  2. Setup Correct Network Adapter:
    1. Go to VirtualBox Manager
    2. Select the VM where RDP is needed
    3. Click 'Settings'
    4. From left navigation panel, click 'Network'
    5. Go to appropriate adapter tab. Most of the times, a VM has only one adapter, in that case 'Adapter 1' tab has to be selected
    6. Select 'Bridged Adapter' under 'Attached to:' dropdown
    7. Select the appropriate network from 'Name:'. If host machine has multiple network adapters (Wireless, NIC card etc.), all will be displayed here.
    8. Need to make sure 'Cable Connected' checkbox is checked
    9. Press 'OK'
Note:
1. Collect host OS's IP address and the port number against that RDP/firewall is setup to connect from RDP client when using Option-01.
2. Collect guest OS's IP address to connect from RDP client when using Option-02.