Setup Virtual box 4.x.x with Windows XP and iTunes for Home sharing under Ubuntu


After experiencing intermittent success with iTunes under Wine since upgrading iTunes to 10.4.1; both from the perspective of iTunes working with Wine and also with Wine/iTunes worknig with Apple TV2 (ATV2). I've decided to bite the bullet and run iTunes within a virtual instance of Windows XP running on top of Ubuntu 10.04. I've tried this on both an Intel Atom based server (without native support for virtualisation) and with an AMD Neo server (with native virtualisation support). I've had good results on both set ups using Oracles free VirtualBox and Windows XP SP3, best of all it was rather simple - here's how...
 I'm using Ubuntu 10.04 LTS in this post with Oracle Virtual box 4.x.x and iTunes 10.4.1.10.

VirtualBox is a powerful x86 and AMD64/Intel64 virtualisation product for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL) version 2. See "About VirtualBox" for an introduction.

Presently, VirtualBox runs on Windows, Linux, Macintosh, and Solaris hosts and supports a large number of guest operating systems including but not limited to Windows (NT 4.0, 2000, XP, Server 2003, Vista, Windows 7), DOS/Windows 3.x, Linux (2.4 and 2.6), Solaris and OpenSolaris, OS/2, and OpenBSD.

VirtualBox is being actively developed with frequent releases and has an ever growing list of features, supported guest operating systems and platforms it runs on. VirtualBox is a community effort backed by a dedicated company: everyone is encouraged to contribute while Oracle ensures the product always meets professional quality criteria.


Virtual Box isn't in the Ubutnu 10.04 synaptic package manager / software centre so you'll need to grab it later on from virtualbox's website - thankfully there's a debian package and a command in this post which will do this all for you:

1. First of all install the dependencies for VirtualBox:

sudo apt-get install iasl xsltproc uuid-dev zlib1g-dev libqt3-headers libasound2-dev libqt4-network libqt4-opengl libqtcore4 libqtgui4 linux-headers-`uname -r` build-essential


2. Move to a temporary directory to download the virtualbox debian package:

cd /tmp


3. Download the VirtualBox package, you may want to adjust the version number here for the latest version:

wget http://download.virtualbox.org/virtualbox/4.1.2/virtualbox-4.1_4.1.2-73507~Ubuntu~lucid_i386.deb


4. Install VirtualBox from the debian package:


sudo dpkg -i virtualbox-4.1_4.1.2-73507~Ubuntu~lucid_i386.deb


5. Start VirtualBox via Applications > System Tools > Oracle VM VirtualBox

6. Create New Windows VM, click New (blue cog icon) and use the following settings:


Name: <insert whatever you like>

Operating System: Microsoft Windows
Version: Windows XP

Click Next

Base memory size: 192mb (default)

Click Next 
 
Start-up disk checked
Create new hard disk checked

Click Next 
 
VDI VirtualBox Disk Image checked


Click Next 
  
Dynamically Allocated

checked 

Choose your location 
Size, I recommend no less than 20gb

Create

7. Now time to virtually insert your Windows XP disc using an ISO in this post.:

Right click the new Virtual Machine image and select Settings > Storage
Select Add attachment
Select your Windows image / iso /cd

8. Now to select the media folders from the host Ubuntu O/S   that you want the Windows iTunes instance to share via Home sharing.

Select Shared Folders
Add your photo and music folders native to the host Ubuntu O/S, for me I created two shares, a Music and Photo share:


Music
Read only - Uncheck (I want iTunes to manage my music folder)
Auto-mount - Check
Make Permanent - Check


Photos
Read only - Checked (I don't want iTunes to alter my image folder)
Auto-mount - Checked
Make Permanent - Checked


Click Ok and exit settings

9. Start the Virtual Machine (VM) 


10. The VM should boot off of the Windows ISO you previously selected; install Windows with default-ish settings. Once Windows is installed, install iTunes as you would normally.


11. Turn off the Virtual Machine from the VM window click Machine > ACPI Shutdown

12. Now unmount the CD image from the VM Settings under Storage, click the virtual CD drive and select remove attachment and click remove and OK to exit settings.


13. Fire up the VM again to configure iTunes... in iTunes under Advanced select Turn on Home Sharing, this will prompt you to authorise the PC with your Apple account.

14. Now choose the photos you want to share via Home sharing, under the Advanced menu select Choose Photos to Share... navigate to your shared photos folder which will be under Network Places somewhere since it is a shared folder from the Ubuntu host O/S to Windows virtual O/S.

15. Finally to test fire up your Apple TV 2 and you should see your virtual Windows iTunes home share available, if not check you Ubuntu firewall setting.

Overall this has been far more successful, stable and less timing consuming to operate than using iTunes under Wine. Even running on the Atom I've been happy with performance ymmv. Shame the ATV2 still doesn't support natively DLNA without rooting...


EDIT December 2012: Playing with a little more recently I found if I changed the Virtual Machine to use a bridged network adapter rather that an nat network adapter Home Sharing was far more stable and smooth. NAT should still work but it may require some more configuration to get it working properly which I don't have time to look into at current.

2 comments:

  1. Does this work for Wifi iPhone/iPad sync as well?

    ReplyDelete
  2. it should do, although I haven't tested it yet.

    ReplyDelete