G'day, welcome back to the lab, the latest issue of magpie magazine came bundled with this free raspberry pi for desktop CD. So this means that you can boot the raspberry pi operating system raspbian on your desktop computer and that's that's super cool if you develop with raspberry pi a lot it means you can have a convenient work environment, not tethered to a Raspberry Pi, but still developing in the same environment. So I'm going to show you how to set this up. There is a tutorial in the magpie magazine and that goes into changing BIOS settings and actually rebooting your computer into this environment so that if you want to switch between your native operating systems like Linux Mac or Windows, you have to reboot into Raspberry Pi. And I mean that that works for this kind of system where you know it's completely offline that's why you've got the CD but this has kind of inspired me to do a tutorial on how to boot this CD on a virtual machine. Now of course if you didn't get the magazine you can still download the same stuff that's on this CD and follow along. I'll just show you the differences at the end of the video, for now, let's get started.
just a bit of prep we need to go to virtualbox.org and just download the latest version of VirtualBox this will work on Mac and Windows just fine. While that's downloading, I've already put my free CD into the CD drive on my computer so that's come up as G-Drive and once your download has finished for VirtualBox just install it and run it so I'm going to run my already installed version of VirtualBox and this is the interface that we were greeted with so here we're going to make a virtual computer, just like that.
So we're going to hit new and what's the name for this I'm going to call this RasPi because it's going to look and feel like a Raspberry Pi. Of course, we're under the Linux distros and I'm going to select Debian 64-bit so whatever you want to call the Machine and then Linux with Debian 64-bit. The memory size I'm going to leave that at the default we could bring it all the way down to 512 MB I wonder if that would be like more a more realistic Raspberry Pi? But since we have a computer, if you'd have RAM to spare, then yeah I'm just going to leave this at 1024 MB.
Yeah we're going to create the virtual hard disk now so this is going to like carve out the section of your computer's hard drive just for the use of this virtual installation of raspbian so I'm going to create that and yeah I'll just hit next on the Hard Disk file type, we will allow the dynamically allocated hard drive and we'll leave the default starting size at 8GB that's that's pretty sensible. What this means is that if you do need more than 8 GB then the than the section reserved for the installation will grow and your hard drive as required; so that's quite a flexible option. And yeah that's as simple as that we've created a virtual machine but now we have to tell it how to start up and also configure a few other things. So I'm going to highlight that virtual machine or right-click go to settings and what do we want first we want ok so the boot order it's going to try to boot from the optical disk before the hard disk that's good because we need to boot from the CD, the display we don't really have anything to change though we could change the video memory I'm going to leave that for now, storage this is where we set the interfaces for our machine, you can see we've got this RaspPi.VDI our controller that's like the virtual hard drive that we specified before but we need to attach the optical disk to this virtual machine so that it can run the installer. So I'm just going to select this empty slot here for the optical disk icon and I'm going to select this icon here host drive G, the host is the computer we're working on right now. So I'm going to select that. That's fine, what else can we have a look at shared folders? Yeah, that'll be something that we'll come to later I think. What else is there to do first up USB serial port, Network, audio, I think, I think that'll do for now. I'm just having a dive through these to see if there's anything else that I forgot I think we might be having a look at this menu once again later on there but I'm just going to hit OK now and we're set up a virtual machine so I'm going to double click on it and the very first thing that's going to happen is it's going to say hey I need a CD to boot off and I know that's right we already attached g-drive so what we're looking at I'll just minimize this to clean it up what we're looking at is the information on the CD this if we had put this into our computer change the BIOS settings and booted from the CD this is what we'd be looking at.
So I want to install the raspberry pi desktop x86 on this virtual machine, so I'm going to tap down to install or arrow down to install and just hit OK hit enter. These little notifications are from VirtualBox, I have an American layout keyboard, so I need to go up to American English and hit enter that way when I used the Shift+3 for hash it doesn't come up as a pound symbol probably and this will just run and I'll see you in the future when there's something to do.
Okay that took but a moment, so this is where we're going to select the partition disk, so I'm going to just use the guided entire disk option at the top and I'm just going to hit OK for this one as well and we're going to put all the files in one partition and that's recommended for new users anyway, so hit enter for that and I'll say yes finish partitioning and write changes to disk so enter for that and we just have to say that yes we want to set up these partitions, so yes write changes to the disks hit enter and away it goes again this will take it this will only take a few minutes.
Ok about three minutes into that process we're just getting this option to install the grub bootloader, I'm going to hit yes on that and now the device for the bootloader installation, I'm just going to go down to that prefilled one I don't want to enter the device manually. If you do accidentally go into that option you do you do have an option to go back anyhow and now I'm just going to hit continue to finish the installation.
You know I'll let this run and let you know how long it takes.
All right so that ran for like about half a minute and now we're going through this initial boot sequence automatically, so the installation finished, the screen went black, came up with a green kind of BIOS menu almost, and then it just started to launch automatically. And here we are, again, I've just got a notice from a virtual machine from the virtual machine that it's going to capture the Mouse and that's okay.
But here we are this is a pretty familiar environment for most people who are watching this video this looks a lot like the Raspberry Pi Raspbian desktop and we have pretty much all the trimmings that we had on the Raspberry Pi there are a few things missing like Wolfram, I think and a few other things but by and large this is a complete and seamless Raspberry Pi.
So there are a few things that we have to do from here this virtual machine doesn't know it's a virtual machine it's living inside this window but it doesn't know it and what that means is, if we want to resize this window to expand that desktop, it can't do it yet, so we're gonna have to install a few packages, so I'm just going to pull this over to the side and bring up my resources. I'll just open up the terminal first so we'll open up the terminal and run
sudo apt-get update
and while that's updating I'll just grab the long installation line that I need.
So what we what we're going to do is download a few packages onto our virtual machine that kind of allow it to interact with Oracle VirtualBox in a way that will allow us to copy files back and forth and even use like the the clipboard so we can copy and paste text back and forth which is super useful if you're you know copying long commands like the one that I'm gonna have to manually type out for instance so once this is finished which it has we're just going to execute this line so that the virtual machine knows that it's virtual and that it's running inside our an Oracle VM. So I'm going to run the
sudo apt-get install virtualbox-guest -dkms virtualbox-guest -x11 linux-headers-$(uname -r)
Oh BirtualBox is not a real thing my apologies what have I done VirtualBox I've put in one too many see this is exactly why we want that copy and paste functionality because I have just got this wrong twice finally I get the notice that I am going to download about 11.5MB of packages so I'm just going to hit YES on that and wait for it to finish. Actually while that's going I think I can get started with the next step so the things we have to do are enable the clipboard the shared clipboard so we can copy and paste text back and forth and also enable sharing a file with the with the virtual raspberry pi so that we can share our host machine files really easily with the raspberry pi that's just grateful workflow.
So the first thing we'll want is to go to machine actually devices let's start with devices and we'll grab the shared clipboard option and set that to bi-directional so that means that we can copy from into the raspberry pi either from the pipe to the computer or vice versa, bi-directional.
Okay that's it for the clipboard now we're going to do the file sharing so I'll just first add our user to the VirtualBox guest file sharing so that's sudo add user PI to VBoxSF and you should see that the user Pi was added I've already tried this once before. So I've got a warning saying that Pi was already a member of that and now we can set up the fol-, the folder that we want to share. I should save I guess I should reboot rather, so I'll do a sudo redo it and well that's going actually I probably should have shut down I won't be able to modify so I'm just going to power off the machine and go to the settings for VirtualBox again and this is where we can find the shared folders and I'm just going to add a folder so the folder path I'm just going to create a new folder on my desktop I think, so that's going to be we're going to call that test share and I'll select that folder, so the path the father is our desktop test share and I'll set that up to auto mount and hit OK.
Now in that folder this just appeared I'm going to create just a dummy file so we can make sure everything works so I'll call this text and I'll open it up and just put in one two three save that close it, minimize that, yep we can close our settings and open up our raspberry pi virtual machine again so just to reiterate we've set up the clipboard sharing and we've set up file sharing so now we can transfer files between our raspberry pi and our computer let's just close the loop on all that and make sure everything works. Close those notices. So the first thing that we did was actually tell the machine that it's a virtual machine so we should be able to resize this desktop and indeed we can if you try to do this before, and I think I showed you it didn't resize, but now now it knows that it lives within this window so we can we can you know we can go properly fullscreen on this you can see that bar hasn't extended out but once the display refreshes everything's fine I'm just going to go back to a windowed mode for that for now because I want to have a look at that clipboard functionality that's super useful.
So I'm just going to copy this one two three text from our share and I should be able to paste that into the terminal so for really long commands like the one that I had to do before that's now going to be super easy we can just copy them from wherever our copying them into our terminal directly and most importantly I think is that we have that shared directory, so I can go to the file manager if I go up to root and under media wherever that is media we have this new directory called SF underscore test share so, the shared directory is prefixed with SF and if we open that there's that txt file we created and indeed it has the contents one two three. So I'm going to close my test file on my host machine and I'm just going to edit this with four five six I'll save that on the raspberry pi, close it off, reopen it, and you can see that on the host machine the file has been modified so I mean this is this is wonderful this this test share directory now is kind of this this beautifully elegantly mounted portal between the two machines so if we if we do some some cool video stuff on one or the other we can move big files back and forth really quickly you'd have to worry about trying to do anything out of there like a virtual network or anything it's all built right into the file systems so you can put a shortcut for media SF test share on your desktop and you're ready to go.
So that just about wraps things up for this tutorial we took the free raspberry pi desktop CD and we installed it onto a virtual machine so now we have this really convenient development environment where we can develop raspberry pi related tasks and also do our regular computing all on the same machine now if you didn't have the CD and you wanted to download the same information that's on it I'll show you how we can do that.
So opening a browser we can navigate to rpf.io/x86 and what we can download is a virtual CD so we have virtual computers we could also have virtual CDs and you can see I've already downloaded that that ISO or virtual disc image file into my downloads folder so rather on the very first boot in the settings remember in setting the system up for storage we selected G Drive which was a CD drive that was actually a virtual CD Drive in this case rather than selecting a real CD to do from we could choose a virtual optical disk file and we could go to downloads and select this file that we downloaded and boot from that instead it's exactly the same thing whether you're booting from the CD or a disk image, it's the same data and VirtualBox is happy working with both so when you're setting up the machine if you don't have a CD drive you can do this step instead and the rest of this tutorial will proceed as normal. I'll catch you next time
Makers love reviews as much as you do, please follow this link to review the products you have purchased.