How to install virtual Ubuntu on Mac?

Important: I'm writing this when the last version of macOS (and the one I have installed) is Mojave. There is already a script which installs Mojave in a virtual machine here https://github.com/img2tab/okiomov. But if you are curios how to do everything manually to install High Sierra, then this guide may be useful.

After reading a few articles I ended up with these steps:

  1. On macOS, download the High Sierra installer (even if you have Mojave installed): https://itunes.apple.com/us/app/macos-high-sierra/id1246284741?ls=1&mt=12
  2. If the High Sierra Installer starts, quit it.
  3. Open "Disk Utility".
  4. Click on "File" > "New Image" > "Blank image...". Or just press cmd+N.
  5. In the "Size" field, enter 13 GB and save it wherever you want.
  6. If the image is not mounted automatically, double-click the file you just created to do it.
  7. Open "Terminal"
  8. Run sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled. If you changed the value of the "Name" field in the step where you changed the "Size", then instead of "Untitled" the image probably appears with that name you entered.
  9. Once the previous command finished, continue with the following steps.
  10. Copy the file to some device which you can get access from Ubuntu (external drive or whatever works for you).
  11. On Ubuntu, open the "Terminal".
  12. Run VBoxManage convertfromraw <path_to_input_.dmg_file> <path_to_output_.vdi_file>.
  13. Open "VirtualBox".
  14. 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).
  15. Once the machine is created, go to the "Settings".
  16. Select "Storage" and click to add a hard disk. When asked click on "Choose existing disk" and select the .vdi file you created using VBoxManage convertfromraw.
  17. Click "OK" and start the machine.
  18. Wait until you get to the screen where you have to choose the language. And choose your language.
  19. "macOS Utilities" appears. Select "Disk Utility" and click "Continue".
  20. Select the disk where you are going to install macOS (probably the same you created when creating the machine).
  21. Click "Erase".
  22. Verify that "Mac OS Extended (Journaled)" is the format selected and click "Erase".
  23. Once it finishes, Quit the "Disk Utility".
  24. Select "Install macOS" and click "Continue".
  25. Follow the instructions.
  26. Once it finishes, the machine automatically rebooted. What you have to do is power it off.
  27. Remove the installer hard disk from the machine. The one you added previously, not the one where you are installing macOS.
  28. Start the machine.
  29. You are going to see a screen where the last line is Shell>
  30. Run cd "macOS Install Data\Locked Files\Boot Files"
  31. Run boot.efi
  32. Continue the installation normally.

References:

  • https://support.apple.com/en-us/HT201372
  • https://forums.virtualbox.org/viewtopic.php?t=9041#p233273
  • https://astr0baby.wordpress.com/2018/04/22/installing-high-sierra-10-13-4-in-virtualbox-5-x/

Oracle VirtualBox is a cross-platform virtualization application. It installs on your existing Intel or AMD-based computers, whether they are running Windows, Mac, Linux or Solaris operating systems. VirtualBox can create and run a "guest" operating system (virtual machine) in a window of the host operating system. The virtual machine provides a self-contained environment in which to experiment with new software without risking damaging changes to the host operating system.

We will give an instruction with step-by-step screenshots to show how to install VirtualBox with an example of installing Ubuntu OS as a guest machine. We also explain how to share files between the host and guest operating systems.

Downloads

Note the instruction here is based on the latest version of the VirtualBox. If you have already installed an earlier version of VirtualBox, your experience may be different. It is recommended to use the latest version of VirtualBox to avoid issues. The VirtualBox forum is a good place to find a solution if you see any problems.

Go to VirtualBox website here to download the binary for your current operating system. Since our host machine is running on Windows, I'll choose 'x86/amd64' from Windows hosts. When download is finished, run the executable file. Continue with the installation of VirtualBox with the defaults. This will open VirtualBox at the end of the installation.

How to install virtual Ubuntu on Mac?

Create Virtual Machine

Click 'New' button to open a dialog.

How to install virtual Ubuntu on Mac?

Type a name for the new virtual machine. Since I am planning to install Ubuntu 14.04, I'll enter 'ubuntu1404'. Note that VirtualBox automatically changes 'Type' to Linux and 'Version' to 'Ubuntu (64 bit)'. These two options are exactly what we need.

How to install virtual Ubuntu on Mac?

The memory size depends on your host machine memory size. In my case, I have 12GB physical RAM. I like to allocate as much as possible for Ubuntu but leave some for my Windows host machine. I pick 8192 MB for my Ubuntu. Note that VirtualBox will create a swap partition with the same amount space as base memeory you have entered here. So later when you are selecting the size of the virtual hard drive, make sure it is large enough since the hard drive will be splitted into root (/)and swap partitions. The root partition contains by default all your system files, program settings and documents.

How to install virtual Ubuntu on Mac?

Accept the default 'Create a virtual hard drive now' and click 'Create' button.

How to install virtual Ubuntu on Mac?

Continue to accept the default 'VDI' drive file type and click 'Next' button.

How to install virtual Ubuntu on Mac?

Change the storage type from the default 'Dynamically allocated' to 'Fixed size' to increase performance.

How to install virtual Ubuntu on Mac?

For the virtual hard drive space, the default value is 8GB which is too little for RNA-Seq analysis. I'll pick 100GB since I have plenty of space in my hard disk. You want to choose a good size for your RNA-Seq analysis. If you realize the drive space is not large enough, you'll need to go over these steps again to create another virtual machine.

How to install virtual Ubuntu on Mac?

Click 'Create' button and VirtualBox will generate Ubuntu virtual machine.

How to install virtual Ubuntu on Mac?

Now the virtual machine is created. We are ready to install Ubuntu in this virtual machine. Select your new virtual machine and click 'Settings' button. Click on 'Storage' category and then 'Empty' under Controller:IDE. Click "CD/DVD" icon on right hand side and select the ubuntu ISO file to mount.

Note that if you have not downloaded 64-bit Ubuntu ISO file, you can check out this page for more information. When downloading Ubuntu ISO file, make sure to selecte 64-bit version. Also make sure the VT-x/Virtualization Technology has been enabled in your computer's BIOS/Basic Input Output System.

How to install virtual Ubuntu on Mac?
How to install virtual Ubuntu on Mac?
How to install virtual Ubuntu on Mac?

Since Tophat program can take an advantage of multiple processors/threads, it is a good idea to specify a large number of processors in virtual machine (default value is 1). You can change this number by clicking on 'System' category. In this case, I change the number of CPUs to 4 since 4 is the largest value shown on the green bar in my case. Now you can click 'OK' button to continue.

How to install virtual Ubuntu on Mac?

VirtualBox may pop up a message about 'Auto capture keyboard' option. Read the message there and check 'Do not show this message again' option before clicking OK.

How to install virtual Ubuntu on Mac?

Install Ubuntu

Back to Oracle VM VirtualBox Manager, click on the new Ubuntu virtual machine and hit 'Start' button. Now you shall see a 'Welcome' screen. Click 'Install Ubuntu' button. Note that the installation process may differ a little bit from version to version. The screenshots here are based on Ubuntu 14.04.1.

How to install virtual Ubuntu on Mac?

Click 'Continue' button.

How to install virtual Ubuntu on Mac?

Make sure 'Erase disk and install Ubuntu' option is selected and click 'Install Now' button.

How to install virtual Ubuntu on Mac?

Ubuntu will ask you a few questions. If the default is good, click 'Continue' button.

How to install virtual Ubuntu on Mac?
How to install virtual Ubuntu on Mac?

In 'Who are you?' dialog, enter your preferred name, username and password. Note that this user will have root/sudo privilege. Click 'Continue' button.

How to install virtual Ubuntu on Mac?

The installation will continue until it is finished.

How to install virtual Ubuntu on Mac?

After installation is complete, click 'Restart Now' button. When you see a screen with a black background saying 'Please remove installation media and close the tray (if any) then press ENTER:', just follow it.

How to install virtual Ubuntu on Mac?

Enter the password you have chosen and press 'Enter'.

How to install virtual Ubuntu on Mac?

The Ubuntu Desktop OS is ready. You may find the desktop screen is too small. Don't worry. You can solve this easily with "VirtualBox Guest Additions".

How to install virtual Ubuntu on Mac?

More About VirtualBox

Guest Additions

After the Ubuntu guest machine is installed, you will find the Ubuntu OS screen size is not extendable and you are not able to share folders between the host machine and Ubuntu.

Guest Additions software provide additional capability to a guest virtual machine, including mouse pointer integration, better video support, share folders, share clipboard, et al.

Before we proceed to install Guest Additions, make sure the current user has sudo/root privilege. If the current user does not have sudo/root privilege or it is not sure, run the following terminal command from an account (such as the user created when Ubuntu was first created; see the screenshot of 'Who are you?' above) with root privileges to enable the root privilege for the current user

sudo adduser USERNAME sudo
where USERNAME should be replaced by the current user's name.

To install Guest Additions, click Devices > Insert Guest Additions CD images…

How to install virtual Ubuntu on Mac?

Click 'Run' button (next to 'Cancel' button) to start the installation. Note that the version of VBOXADDITIONS should be matched with the one of VirtualBox you have installed.

How to install virtual Ubuntu on Mac?

Installing Guest Additions requires root privilege. Enter user's password (assume the current user has sudo privilege).

How to install virtual Ubuntu on Mac?

When the installation is finished, press Return key to close the terminal window.

How to install virtual Ubuntu on Mac?

Now prepare to restart the system to enable the change. Click 'Shutdown' on the menu and then the 'Restart' button.

How to install virtual Ubuntu on Mac?
How to install virtual Ubuntu on Mac?

After rebooting Ubuntu, you will see the desktop resolution is much better.

How to install virtual Ubuntu on Mac?

Before you can enable shared folders on the host machine, make sure you have installed VirtualBox Guest Additions software on the guest machine.

When Ubuntu guest machine is on, click on Devices > Shared folders settings…

How to install virtual Ubuntu on Mac?

Select Machine Folders and hit the add button (plus sign).

How to install virtual Ubuntu on Mac?

Browse to the folder you wish to access from the guest machine. Check Auto-mount and Make Permanent options and click OK button.

How to install virtual Ubuntu on Mac?

Click OK button once more.

How to install virtual Ubuntu on Mac?

Now type 'terminal' in Dash to open a Terminal.

How to install virtual Ubuntu on Mac?

Type the following line in the Terminal to add a user to 'vboxsf' group. This step is necessary in order to use the VB's 'Shared Folder' feature.

sudo adduser brb vboxsf
Replace 'brb' with your account name in Ubuntu. When you are done, restart the Ubuntu guest machine and go to /media/ directory. From Nautilus (file manager in Ubuntu), click Computer > File System > Media folder and inside it you will see a folder beginning with sf_ (the folder name is sf_Downloads in our example). Now you can transfer files between the Ubuntu guest machine and the Windows host machine in Nautilus.

Although Shared Folder system in VirtualBox is a nice feature, using VirtualBox shared folder directly for fastq data, annotation or output directory can significantly reduce the performance compared to a native (Ubuntu) system or VirtualBox native system.

BRB-SeqTools

After Ubuntu has been successfully installed on VirtualBox, users can be go back to download and use BRB-SeqTools program.

How to install Ubuntu virtual machine on Mac?

1- Right-click on the Ubuntu Virtual Machine under VirtualBox and click on settings. 2- Under settings navigate to storage and click on disk icon under attributes and choose the location where ubuntu-desktop iso file has been saved. Press Ok. 3- Select your VM under VirtualBox and click start to start installation.

How to install virtual Linux on Mac?

Running GUI Linux in a virtual machine on a Mac.
Download a Linux installation image. ... .
Configure the sample code project..
Install GUI Linux from an ISO image. ... .
Set up the VM. ... .
Enable copy-and-paste support between the host and the guest. ... .
Start the VM..

Can we install VM in Mac?

Virtualization programs such as Parallels Desktop and VMWare Fusion run on the macOS, but allow you to create a Virtual Machine – or VM – that mimics the hardware of a Windows PC. So you can create a VM on your Mac and then install Windows – or another operating systems, such as Linux – on the VM.

How to install Ubuntu in VM?

Step 1: Open VirtualBox and click on the New button. Step 2: Give a name to your Virtual Machine and select the location for it to install. Step 3: Assign RAM size to your Virtual Machine. Step 4: Create a Virtual Hard disk for the machine to store files.