Install Ubuntu On Mac Virtualbox



Windows, macOS – which one do you want to use today? On a traditional setup, you’re stuck with one or the other. But with virtual box, you actually have macOS on a Windows PC.

It’s the freedom that computer users have enjoyed with Linux and other operating systems.

But Apple has made it difficult to install their operating system on anything other than their own hardware. All of that is changing, and Virtual Box is responsible for it and the rise of the Hackintosh.

At the time of writing I am running Ubuntu 20.04 and Virtualbox 6.1.6. If you do not yet have Virtualbox running with Ubuntu installed, go ahead and follow my tutorial on how to get this up and running first. If you plan to install a fresh copy of Ubuntu, I would recommend downloading Quartus in the background as the file is large and may take. On Ubuntu, open the 'Terminal'. Run VBoxManage convertfromraw. Open 'VirtualBox'. Create a new machine of Type 'Mac OS X' and Version 'macOS 10.13 High Sierra (64-bit)' (probably others work, but I just tried with that one). Once the machine is created, go to the 'Settings'.

To install Ubuntu on your virtual machine, you'll need the installation media. For installation on a computer you would typically burn the ISO file to a DVD or USB stick. Fortunately, if you're installing Ubuntu in a VM, you can just use the downloaded ISO. Various versions of Ubuntu are available. Aug 26, 2019 In this article, we will be showing how to install the Linux system Ubuntu on a virtual machine on MAC. VirtualBox provides system virtualization that is useful for trying out new operating systems and testing out new softwares while protecting the host system which is in our case MAC OS. You are basically setting up a virtual machine inside your existing system and with this, you can add a.

New to hackintosh? Learn more about it in our what is hackintosh? overview.

Note: A lot of people will be able to get a mac virtual machine one Windows running smoothly, but sound doesn’t seem to work well. That’s really not an issue because you’ll still be able to access all of your apps and software.

I also recommend that you have access to a real Mac. You might be able to find some distributions of the High Sierra ISO online, but there is always a risk when downloading from an unofficial source. Instead, borrow a Mac from a friend, or use your own and download the High Sierra OS from the App Store.

Check out our high sierra installation guide for hackintosh

Everything You Need to Get Started with Installing macOS on VirtualBox

Before we go through the steps on how to install macOS on Virtual Box, let’s get everything together that you’ll need to get started.

  1. Open up your Mac
  2. Go to the App Store
  3. Type in “High Sierra”

You’ll want to search for your desired operating system (we’ll be using High Sierra), and Download it.

Note: You’ll need a decent computer to be able to run Virtual Box. Your computer will need to meet these minimum requirements:

  • Dual core processor
  • 4GB Ram or higher
  • 64-bit

If your computer doesn’t meet these requirements, you won’t be able to run macOS properly. You’ll be able to download VirtualBox from the official website. I’m not going to go through the installation process, as the website will have all of the information you need to be able to install VirtualBox.

I do recommend that you read all of the documentation and ask any questions that you have in the community section of the website.

VirtualBox 6.0 was just released, so it’s definitely a great time to get started with your own macOS.

Extract macOS Sierra

Make sure you’ve downloaded High Sierra, and then you’ll want to run a few commands from your terminal . You’ll be able to open the terminal at: Applications > Utilities > Terminal. Once inside of the terminal, you’ll want to run the following commands:

Go to your desktop and rename the file, removing the “.cdr” extension. You need this extension to read “.iso” for it to work properly.

You’ve successfully created your own ISO file so that you can bootup your macOS.

How To Install Ubuntu On VirtualBox

The next step is to copy the file over to your Windows machine (using a large USB drive seems to work best). This file will be mounted in your virtual machine later on in the article, so it’s very important that this step is completed successfully.

Creating a mac Virtual Machine on Windows

You’ll want to create a virtual machine, and this is really easy. You’ll open up VirtualBox and click New. You’ll want to have the following parameters selected or entered before clicking Next.

  • Name: High Sierra
  • Type: Mac OS X
  • Version: Mac OS X (64-bit)

Pay attention when selecting the version because you may find that High Sierra is offered as a version when you go to install it. But if it’s not, you can just choose the settings I listed above and they should work fine.

You’ll then be proceeding through all of the settings.

When you come up to the RAM setting, you’ll want to be generous. VirtualBox requires a minimum of 4GB or RAM to run, but the more the better.

Why?

You’ll want to provide at least 4GB to your macOS, or 4096MB to be precise. A general rule of thumb is that if you can spare it, supply more RAM to your virtual machine. RAM will allow the operating system to put more information into memory and retrieve it faster.

For better overall performance, supply as much RAM as you can.

The next steps are also important, and they’ll include:

  • Hard Disk: Choose the “Create a virtual hard disk now” setting.
    • Choose VDI when choosing the hard disk type.
    • Choose Fixed Size instead of Dynamic for added speed.
    • Set the size of the drive to at least 25GB.

You’ll now have your virtual machine using the RAM and disk space properly, and you’ll have to work your way through a few screen prompts before having everything setup properly.

Configuring Your VirtualBox to Run macOS High Sierra

We’ve made a lot of progress so far, and now it’s time to configure your virtual machine properly. You’ll see in the main window of VirtualBox that “High Sierra” is listed. Click on this and then click on the “Settings” button.

You’ll want to go to “System” and make sure that the following are unchecked on the Motherboard tab:

  • Floppy
  • Network

Click on the Processor tab and make sure that you have 2 or more CPUs set for your virtual machine.

The next few settings are rather simple:

  • Display: Video Memory with a minimum of 128MB
  • Storage: Click “Empty” and then click on the CD at the top right. Choose your High Sierra ISO file

Now you’ll need to click “Ok,” and save all of the changes you’ve made. Close out your VirtualBox now.

Apple is very strict on the system that their operating system runs on, so it’s very important that you do your best to configure your virtual machine in such a way that it tricks the installer to thinking you’re on a retail machine.

We’ll now be going into the Windowscommand prompt.

You’ll do this by:

  • Clicking the Start Menu
  • Typing “Command Prompt”
  • Right-clicking on the Command Prompt desktop app
  • Choosing Run as administrator

It’s very important to follow all of the following command prompts exactly. Your goal is to run each command, one by one, hitting the Enter button and waiting for the command to complete successfully.

Remember that VirtualBox needs to be closed before running these commands, or it won’t work properly.

You have to make sure that the virtual machine is properly named “High Sierra” for this method to work. If not, you’ll be able to go back and make changes to the name to get everything to work properly.

Once all of the commands are completed, and there are no errors, you’ll then be able to open up your VirtualBox and get macOS High Sierra installed properly on VirtualBox.

It’s a long process, but we’re almost done with your installation.

Running VirtualBox and the macOS Installer

You’ve almost learned how to install macOS on VirtualBox entirely, and we’re on the home stretch. You’ll want to open up your VirtualBox and then click on your virtual machine that you set up earlier.

Now, click “Start.”

There will be a lot of information displayed on the screen as everything starts running. I recommend stepping away from the machine and letting it run for a few minutes before coming back. Some errors can hang for 5 minutes or longer.

If you’ve done everything properly, you can be confident that the installer will boot properly.

You’ll eventually be presented with the option to pick a Language. If you’ve reached this point, you’re doing very well and are almost ready to run your macOS.

The next steps can be followed:

  • Choose your desired language, and click
  • Click “Disk Utility” and then
  • Click “View” and then “Show All Devices.”
  • Click on your empty virtual drive that has been setup and click “Erase.”
  • Choose the following settings:
    • Name: Macintosh HD
    • Format: Mac OS Extended (Journaled)
    • Scheme: GUID Partition Map
  • Click “Erase” and close Disk Utility when the process is complete.
  • Click “Reinstall macOS.”
  • Click “Continue.”

You’ll come up to one point where you’ll be asked to choose a hard drive, and you’ll want to select the Macintosh HD partition that you just created with the Disk Utility.

We’ve successfully copied all of the files on the virtual machine, but we’re not done just yet. Seagate driver for mac.

Exit your virtual machine and then go back to your virtual machine’s settings. You’ll need to change up your Storage settings. Click on your ISO for High Sierra in the “Storage Tree.” You’ll click that CD icon just like we did earlier and then choose “Remove Disk from Virtual Disk.”

You need to do this to unlink the ISO from your virtual machine.

Start up your virtual machine and you should come across a black screen with the EFI Internal Shell. You’ll want to look for FS1. If this is listed in yellow, click on the virtual machine and then type fs1: and hit the Enter button.

You should be in the fs1 directory.

Type in the following commands:

  1. cd “macOS Install Data”
  2. cd “Locked Files”
  3. cd “Boot Files”

Now we’ll run the installer by running: boot.efi and hitting enter.

If everything goes well, you’ll come across a graphical installer and will just have to work through the prompts. The virtual machine will reboot eventually and then you’ll need to go through the settings and the rest of the setup process.

Soon enough, you’ll be right inside of macOS, where you’ll be able to start using your mac virtual machine on Windows.

Having a virtualbox mac OS is the easiest method of using mac as and when you need it. In addition, using virtualbox is far less complicated than the dual boot hackintosh method we have looked at previously.

My laptop is a late 2011 MacBook Pro running OS X 10.9 Mavericks. It's my personal laptop, so I use it for everything - browsing, e-mail, and programming. While the OS X experience is wonderful, application development can be frustrating. For example, right now I'm trying to develop a Boost Python module, and I am having trouble compiling it on OS X.

I intend to run my application in a Linux environment, so instead of learning the intricacies of porting my code and makefile to Mac OS X, I decided to install a local Ubuntu Server virtual machine (VM) on my MacBook. I installed Ubuntu Server instead of Ubuntu Desktop because I wanted to run a lightweight Linux environment, which should save laptop resources. I simply run the VM in the background, and ssh into it from the Mac terminal. Easy and awesome!

This entire tutorial should take approximately 20 minutes (not including download times).

Install VirtualBox

Download and install VirtualBox here. Theinstructions below were testing with VirtualBox 4.3.18 on OS X 10.9.5.

Download Ubuntu

Download the Ubuntu Server 14.04.01 LTS iso image.

Setting up the Virtual Machine (VM)

You can configure your virtual machine (VM) using the VirtualBox graphical program, but it's quicker to set it up from the command line. I've adapted these commands in part from this blog post.

The commands below will create a virtual machine called 'UbuntuServer',attach a 32 GB virtual hard drive, attach a DVDdrive loaded with the Ubuntu Server disk image, and allocate 1 GB of RAM. We also attach a network card and set up port forwarding.

Start the VM for the first time

For the first boot, we will start the VM with a graphical display so we can installthe Ubuntu operating system. From your OS X terminal:

The VM will boot from the DVD Drive, which has the Ubuntu Server installation CD image loaded.

Install Ubuntu Server

Install Ubuntu Server using the installation wizard with the default settings. The installer is interactive - it should take about 10 minutes to complete the installation. As part of the installation you will be asked to select a username and a password.

After installation is complete, the machine will reboot. Log in at the prompt.

Hint: If you accidentally click on the VM GUI window, VirtualBox may 'hijack' your mouse pointer to try passing it to the VM. If this happens and you lose your mouse pointer, press the left command key to get your mouse pointer back.

Install the OpenSSH Server

After installing the Ubuntu operating system and logging in to VM, to install the ssh server, issue the following command in the Ubuntu VM:

Now you can try logging into your virtual machine over ssh through port 2222, which has been set up to forward to port 22 of your VM. From the OS X terminal:

Congrats! :-)

For the rest of this installation guide, I recommend issuing all VM commands over ssh because the display is better than the VM GUI console, and you can easily paste commands into the Mac ssh terminal.

Install VirtualBox Guest Additions (for shared folders)

To share a folder from your host machine (i.e. Mac) with the VM, you need to installthe VirtualBox Guest Additions in the VM.

Before you can install the Guest additions, you need to install gcc and make into the VM. Make sure your laptop is connected to the internet (in the VM):

From the VirtualBox VM GUI window menu, select 'Devices -> Insert Guest Additions CD Image..'. If prompted, choose 'Force Unmount'.

This will insert the VirtualBox GuestAdditions installation CD into the VM's DVD drive. From the VM terminal (or, more comfortably, the ssh terminal), mount the CD drive and run the installation script. In the VM:

Finally, add your user to the vboxsf group so you can access shared folders (in the VM)

For the GuestAdditions installation to take effect, you need to reboot the VM. We'll take care of that in the next section when we boot the VM without a GUI.

Starting the VM without GUI.

Now that ssh has been installed and configured, you can run the VM in the background without a GUI window.

First, shutdown the VM using one of these methods:

  • From the VM GUI, close the window and select 'Send Shutdown Signal', OR
  • From the VM GUI menu, select 'Machine -> ACPI Shutdown' OR
  • From the Mac terminal, issue vboxmanage controlvm UbuntuServer poweroff

Next, start the VM without a GUI from the OS X terminal:

The VM will be running in the background. Give the VM a few moments to boot up, and then you can try to log in again over ssh as before from the OX X terminal: ssh -p 2222 <username>@localhost.

Access shared folders

To access your Mac home directory from the VM:

Your files should be there. If you get a 'permission denied', make sure you added your user to the vboxsf group.

Contratulations. Now you have a local lightweight Linux environment that you can access over ssh!

Quick Reference

To shutdown the VM:

You can also pause the VM instead of shutting it down:

To start the VM:

To log into the VM over ssh:

Additional Tweaks

Here are some solutions to other issues that may arise:

Configure the Grub Boot Loader

On one occasion I powered off the VM while it was booting. The next time time I tried to start the VM without the GUI, I could not log in over ssh because, unknown to me at the time, the VM was sitting in the GRUB bootloader menu waiting for my input.

You can configure GRUB to timeout by editing the VM's GRUB configuration file at/etc/default/grub with the line:

which willtimeout the bootloader with the default selection after 2 seconds whenever the systemis started after the last boot failed. For more info, see the Ubuntu GRUB 2 page.

Keeping SSH Alive when laptop sleeps

Mac

Configure the VM ssh server to keep connections alive by editing the VM's config file/etc/ssh/sshd_config and adding the following:

Ubuntu For Virtualbox Download

When your laptop sleeps, you may find that your ssh connection to the VM is terimnated.This is the result of some VirtualBox bug which has since been resolved provided that you change the VM's DNS resolution setting:

That did the trick for me.

Go Top

Install Ubuntu Server On Virtualbox Mac

Please enable JavaScript to view the comments powered by Disqus.comments powered by Disqus