Linux On Mac Virtualbox



In this article I’ll try to get into all (okay, maybe not all) possible troubles related to using a VirtualBox guest-machine with Linux, running on a Mac OS (High Sierra, 10.13) host. But actually it’s not about Mac OS and all the steps will be the same for Windows and Linux hosts too. But anyway.

Install Linux on Mac OS using VirtualBox. If playback doesn't begin shortly, try restarting your device. You're signed out. Sep 06, 2013 What we need to do is change the boot order so that VirtualBox knows where to look for the virtual machine file on the Mac. When the Ubuntu - System settings window appears, click the System tab. Virtualbox is a powerful tool that allows many different operating systems to be run from other operating systems within a window, and best of all it is totally free! We are not limited to just Ubuntu, we could run all different flavours of Linux and even Windows (yes, Windows is. Apr 30, 2016 Ever wanted to try out Linux, but didn’t really want to go about dual-booting it or even erasing your own operating system to simply take it for a test run? In this case, a virtual machine is the way to go, and you can do that right in a free program called VirtualBox. Step 6: Install Sierra. Insert sierra.iso to the sierra VM’s optical driver, and follow the instruction to install Sierra. Note: In the installer, Go to Utilities Disk Utility. Select the VirtualBox disk and choose Erase to format it as a Mac OS Extended (Journaled) drive.

The aim is to get a Linux guest-machine running in a fullscreen mode on a dedicated desktop (screen) with a decent performance.

Nothing special here, except for maybe Gatekeeper (or whoever) that might block VirtualBox from installing/starting. In that case you’ll need to go to Security & Privacy and allow it (Open Anyway).

Create a new virtual machine. Give it 4 GB RAM and 128 MB video. Just in case, that’s my settings:

And I did not enable 2D/3D acceleration.

Linux Operating System

Insert Linux installation image (I usen Debian) into machine, start it and install Linux there.

Virtualbox

Having done that you might notice that you can only have maximum 1024x768 resolution. To have more you need to downloadExtension Pack for VirtualBox (and install Guest Additions for guest-machine).

Open terminal in your guest-machine and install necessary packages:

Insert Guest Additions image:

It will get mounted as a CD-ROM. Open it and copy VBoxLinuxAdditions.run from there to /tmp/. Go there in terminal and execute:

It might give you some warning about session manager and some unsupported protocols, but for me it didn’t affect anything. Reboot the guest-machine and you’ll have a proper screen resolution.

I miscalculated the size of my virtual disk image (VDI). I gave it 20 GB initially, but having installed the stuff I wanted (Qt with Device Creation packages), I discovered that I have only ~4 GB left, but I needed to install even more stuff, which meant I needed to increase my VDI to at least 30 GB (add 10 GB more). But here’s problem - I created a fixed size VDI (I always create fixed ones), which is a bit problematic to resize (fixed, eh). But it is still possible.

Shutdown the guest-machine and exit VirtualBox app. Open Terminal, find VBoxManage and run modification command:

Oh shit, I forgot (again) that I have a fixed VDI, so I got this error:

You need to clone the disk first:

Now you can resize the cloned disk, because by default new disks are dynamic ones:

And after that make a fixed clone of it:

Now go to your guest-machine settings and delete old disk from SATA controller. And then delete it from Virtual Media Manager. And now add your new extended disk to your machine’s SATA controller:

But then you need to edit partitions inside the guest-machine to extend old ones to the free space. You can use GParted for that. And better to do it from a Live CD.

In my case GParted didn’t allow me to extend existing partition to the free space because I had swap area between them. So I deleted it, extended the main partition and re-created swap area back.

But after that I got the following error during the boot:

It’s nothing serious, because after 90 seconds OS boots normally. But anyway it’s better to fix it: wait for the system to boot and edit /etc/fstab file: updating the GUID of deleted swap partition with the new value (you can look for it in the GParted).

By the way, don’t forget to right-click on swap partition at GParted and set Swapon option (on the screenshot it is already pressed, so you can see Swapoff):

So, I got my guest-machine running in fullscreen, I managed to extend its disk, but there was an annoying feeling that it wasn’t performing well. It wasn’t very responsive and even mouse pointer was moving with delays. But it was tolerable. Till the moment I ran a Knoppix Live CD, and it was really fast, so immediately I suspected my Xfce DE and decided to try some other (LXDE). Turns out, it’s quite an easy thing to do:

And that’s it. Now simply reboot you guest-machine and choose LXDE at logon screen. For me performance of guest-machine got significantly improved.

So, that was the last of my problems and now I can easily switch between my Mac OS host and Linux virtual machine using 3-finger swipe just like this:

If video doesn’t play in your browser, you can download it here

…Yes, I have an unregistered Sublime Text. But it’s just too damn expensive ($80) and I haven’t decided yet it will be my main editor. I’m still evaluating several others.

Guest machine is running fine, but how to exchange files with it? There are ways to do it via shared folder or even drag-and-drop from host, but I prefer to use an SSH server and connect via SFTP, since it’s Linux we’re talking about anyway.

Network

By default guest machines get only NAT network, so they have access to internet, but they are “invisible” for their hosts - you can’t even ping it. To establish a direct “link” between host and guest go to the VirtualBox’s Preferences and create a host-only network like it is shown on screenshots:


After that you can run ifconfig on your MacOS host and see that vboxnet0 was created.

Now open Settings of your guest machine, add Adapter 2 and choose vboxnet0:

Start your guest machine and edit network interfaces:

Add this to the end of the file:

You might have different name of the interface (mine is enp0s8) - check ifconfig/ip a. And as you can see, I set a static IP for the guest machine, because I want to save connection settings in my FTP-client. So, actually there was no point in setting DHCP in VirtualBox preferences.

Save the file and reboot the guest machine (just in case). Now you should be able to ping it from your host.

SFTP

If simply connecting to the host via SSH under your username doesn’t work, then you’ll need to set-up an SSH server. I used this instruction.

Most probably you already have SSH server installed in your guest machine. If not, then install it:

Add a new group and include your user (mine is vasya) to it (or you can create a new user, but that’s just a virtual machine, so I prefer to keep things easy):

Linux On Macos Virtualbox

Now create a folder, that will be accessed via SFTP, and then create a share folder inside it and make vasya:sftpgroup its owner:

Edit SSH server config:

Find Subsystem sftp string, comment default value and add new one:

Go to the very end of file (it is important) and add settings for your share folder:

Save the file and restart SSH server:

If you didn’t place Match section in the very end of the config, then you will get an error like this:

Pay attention, will you? Go back and fix it.

After SSH server will restart successfully, you will be able to connect to your guest machine via any FTP client (that supports SFTP) from your host:

In this chapter, you will learn about how to install kali Linux on VirtualBox. In the previous chapter, we have installed the VirtualBox, now its time to install the Kali Linux. Let’s install the Kali Linux step by step. If you haven’t installed the VirtualBox, then please visit the chapter How to install VirtualBox in Mac OS and install it.

Step 1:

  1. Open VirtualBox and click on new
  2. Now a popup window will appear
  3. Name: Provide the machine Name
  4. Machine folder: location of the files
  5. type: Linux
  6. Version: Debian (64-bit)
  7. Click on continue

Step 2:

  1. Assign the ram size
  2. Click on continue
Mac

Step 3:

  1. Choose the hard disk here
  2. Create a virtual hard disk now
  3. Click on continue

Step 4:

  1. Select the VDI (Virtual box disk image)
  2. Click on continue

Step 5:

  1. Select dynamically allocated
  2. Click on continue

Step 6:

  1. Now set the limit for memory
  2. Click on Create

Step 7:
At this point creating the virtual machine is been finished, now let us configure the kali Linux

Step 8:

  1. Right-click on the virtual machine
  2. Go to settings
  3. Click on storage
  4. Click on empty
  5. Click on the disk icon and select the choose disk file
  6. Click on ok

Run Linux On Mac

Step 9:
Now click on the power button and select the install option

Now the os will be installed and keep selecting the appropriate option in the installation process.