Selasa, 27 November 2018

Raspbery Pi VM


How to run Raspberry Pi Desktop on Windows or macOS


How to run Raspberry Pi Desktop on Windows or macOS
Our articles usually show you how to do things on a Raspberry Pi. This time, we’re changing things up: we’re going to show you how to use a PC or Mac to run the Raspberry Pi Foundation’s desktop operating system, Debian with Raspberry Pi Desktop (for brevity’s sake, we’ll call it just “Raspberry Pi Desktop” from now on). This Raspbian-like OS (as the names imply, both operating systems are based on Debian) allows you to use your PC or Mac as a kind of substitute for your Raspberry Pi. That makes it useful for testing out projects when your Pi isn’t handy. It’s also fun because it backs the familiar Raspbian interface with your PC or Mac’s hardware, which is much more powerful than the little Pi.
The simplest way to get Raspberry Pi Desktop up and running is to install the operating system, but that will require you to dedicate a computer to the project (or at least to partition a hard drive). If you want to keep running Windows or macOS on your computer, your best bet is to run Raspberry Pi Desktop on a virtual machine – which is exactly what we’ll show you how to do in this guide.

How to run Raspberry Pi Desktop on Windows or macOS

Step 1: Download and install VirtualBox

Because we’re going to run Raspberry Pi Desktop on a virtual machine, we’ll need to download Oracle VM VirtualBox. In Oracle’s own words, “VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use.”
You can download the software from VirtualBox’s Downloads page. Just choose the right version for your operation system (there are two: a Windows version and a macOS version). After you’ve downloaded the executable, install VirtualBox by following the installation wizard’s instructions.

Step 2: Download Debian with Raspberry Pi Desktop

Next, you’ll need to download the image file of Raspberry Pi Desktop from the Raspberry Pi Foundation’s site.

Step 3: Launch VirtualBox and create a new virtual machine

Now that we’ve both VirtualBox and Raspberry Pi Desktop downloaded, we’re ready to launch VirtualBox and create a new virtual machine.

Run VirtualBox and click the New icon, then enter:
Name: Whatever you like. Keep it short. I suggest rpi or raspberrypi.
Type: Linux
Version: Other Linux (32-bit)
Click Next
Memory size: 1024MB
Click Next
Hard disk
Select Create a virtual hard disk now
Click Create
Select VDI (the default)
Click Next
Select Dynamically allocated (the default)
Click Next
Select 8GB
Click Create
Click “New,” and you should see a screen like this:
Create Virtual Machine
We don’t want to create a Windows virtual machine, of course, so let’s change the settings a bit. First, choose a descriptive name for your virtual machine (for example, “Raspberry Pi”), then select Linux from the Type dropdown menu and Debian (64-bit) from the Version dropdown menu. After that, click Next.
On the next screen, you can use the recommended memory size of 1024 MB – this corresponds to the Raspberry Pi 3’s memory size.
The next screen is about adding a hard disk to your new virtual machine. Just click Create, unless you have some reason to modify the settings. Then, click Next on this screen and again on the next.
Finally, you can choose the size of your hard disk. We used the recommended size of 8 GB, but you may want to have a larger hard disk. When you’re ready, click Create.
Now we have the settings of our virtual machine in place.

Step 4: Install Raspberry Pi Desktop

Click Start to start the installation of Raspberry Pi Desktop. You should see a screen like this:
Select start-up disk
Browse to the folder where you saved the image file of Raspberry Pi Desktop, select the file, and click Start. What you should see next is a menu titled “Debian GNU/Linux installer boot menu.” Use the arrow keys – or i – and Enter to select Install.
On the next screen, select your preferred keyboard layout and continue by pressing Enter.
Choose Guided – use the entire disk and keep pressing Enter to Select disk to partition and choose the Partitioning scheme. Finally, Finish partitioning and write changes to disk.
You might want to grab a cup of coffee or tea while the system is installing.
After a while, the installation wizard prompt you: “Install the GRYB boot loader to the master boot record?” Select Yes, and choose /dev/sda.
When the installation wizard has installed everything, you should see a screen like this:
Raspberry Pi Desktop
Look familiar? If you’ve used Raspbian before, it should!

Step 5: Make the virtual machine interactive

Our virtual machine is successfully running Raspberry Desktop now, but the screen size is a bit small, and it doesn’t get bigger when you click Maximize. We can make our machine more interactive by installing VirtualBox Guest Additions. Guest Additions makes it possible for us to resize the screen, use the clipboard, and share files between our PC or Mac and the virtual machine.
To do this, first open Terminal and make sure that your system is up to date:
sudo apt-get update
sudo apt-get upgrade
You’ll have to type the commands because our virtual machine isn’t very cooperative, yet.
Now we’re ready to install VirtualBox Guest Additions:
sudo apt-get install linux-headers-$(uname -r) virtualbox-guest-dkms virtualbox-guest-x11
With Guest Extensions installed, click on the Devices menu and select Shared Clipboard > Bidirectional.
If you rebooted your virtual machine now, you would be able to use the same clipboard on both your PC or Mac and the virtual machine. You would also be able to resize the screen. But let’s not reboot, yet. Instead, let’s first to add our user to the vboxsf group to enable file sharing between the virtual machine and PC or Mac:
sudo adduser pi vboxsf
Now we’re ready to shut down our virtual machine and set up a shared folder. This the shutdown command:
shutdown -h now

Step 6: Set up a shared folder

To set up a shared folder, right-click on your virtual machines name and select Settings…, or press Ctrl+S with your virtual machine selected.
From the menu that opens, select Shared Folders.
Click the button with the green plus sign that adds a new shared folder.
From the Folder Path dropdown many, select Other… and then the folder you’d like to share. When you’re ready, click OK and check Auto-mount.
Add Share
If you start your virtual machine again and launch the file manager, you should see your shared folder with the prefix “sf_” in the /media directory. Any file you put in that folder will also show up in the corresponding folder in/on your PC or Mac, and vice versa.
And that’s it! You now have Raspberry Pi Desktop running on a virtual machine on your PC or Mac, and you can easily use the clipboard and manage folders while you’re working on your next project.

Tidak ada komentar:

Posting Komentar