Qemu Ubuntu For Mac

How to Install QEMU on Ubuntu. QEMU is a Linux emulator used to create virtual machines. Many people use Virtual Box on Windows, but fir Linux, you can use QEMU instead. Check if the CPU has the support of hardware for virtualization.

Edit February 5 2020: There is now an official checkra1n release for Linux with no QEMU or Virtualization required! Watch my video here! Hey jailbreakers! I’ve got a simple step by step guide on how you can dual boot Windows 10 and Ubuntu Linux 18.04 to run the checkra1n jailbreak tool! How to install macOS in a virtual machine (QEMU) on Linux using Sosumi snap package To install Sosumi you'll need to be able to install Snap packages on your system. This is enabled by default in Ubuntu, and on other Linux distributions follow the instructions from the Snapcraft docs. Install the Sosumi snap package: sudo snap install sosumi. Then, download the Ubuntu 15.04 server installation image and boot the Virtual machine. I already downloaded the installation image and kept it in my home directory. To boot the Virtual machine, run: qemu-system-x8664 -hda ubuntu.img -boot d -cdrom /home/sk/SoftBackup/OS Images/New/ubuntu-15.04-server-amd64.iso -m 640. For 32bit VM, use.

  • 1QEMU on OS X (macOS) hosts

While QEMU's main host platform is Linux, it is also supported on operating systems for Apple's Mac computers (known as OS X or macOS). The official support policy covers the last two released versions of OSX; QEMU might work on older versions, but it is not guaranteed and it might not even compile on older versions.

Please note that fewer developers work on QEMU for Mac hosts, so it might be less stable (but I don't think it is). If you can replicate a bug on a Linux hosted QEMU before reporting it, this is helpful as it means a wider set of people might look into it.

Some system emulations on Linux use KVM, a special emulation mode which claims to reach nearly native speed.KVM is mainly used for x86 (32 and 64 bit) emulation on x86 hosts running Linux. Should you want to run Qemu with KVM support on a G5, depending on your distribution, you might have to compile your own kernel with KVM support.There exists a port of QEMU to Hypervisor.framework (a kernel module from Apple which is similar in spirit to KVM), but unfortunately it is not included in upstream QEMU.

Building QEMU for OS X

The system requirements are:

  • One of the last two most recent versions of OS X (currently that's 10.13 or 10.14)
  • The clang compiler shipped with the version of Xcode for that OS X. GCC might also work, but we recommend clang

Qemu Ubuntu Mac

Additional build requirements are:

You may find it easiest to get these from a third-party packagersuch as Homebrew, Macports, or Fink.

After downloading the QEMU source code, double-click it to expand it.

Then configure and make QEMU. The target-list option is used to build only the machine or machines you want. If you don't specify it, all machines would be built. Probably not what you want.

This way doesn't require you to wait for the configure command to complete:

If your system has the 'say' command, you can use it to tell you when QEMU is done

You can use './configure --help' to see a full list of options.

Here are all the currently available machines:

  • aarch64-softmmu
  • alpha-softmmu
  • arm-softmmu
  • cris-softmmu
  • i386-softmmu
  • lm32-softmmu
  • m68k-softmmu
  • microblaze-softmmu
  • microblazeel-softmmu
  • mips-softmmu
  • mips64-softmmu
  • mips64el-softmmu
  • mipsel-softmmu
  • moxie-softmmu
  • or32-softmmu
  • ppc-softmmu
  • ppc64-softmmu
  • ppcemb-softmmu
  • s390x-softmmu
  • sh4-softmmu
  • sh4eb-softmmu
  • sparc-softmmu
  • sparc64-softmmu
  • tricore-softmmu
  • unicore32-softmmu
  • x86_64-softmmu
  • xtensa-softmmu
  • xtensaeb-softmmu


We recommend building QEMU with the -default compiler provided by Apple, for your version of Mac OS X (which will be 'clang'). The configure script will automatically pick this.

Errors on old compilers

Note: If after the configure step you see a message like this:

ForFor

you may have to install your own version of gcc. You can build it from source (expect that to take several hours) or obtain third party binaries of gcc available from Homebrew or MacPorts.

You can have several versions of GCC on your system. To specify a certain version, use the --cc and --cxx options.

Build with LLVM/Clang 7

If you need to compile with newer versions of clang (to get f.i. AVX/AVX2 support), you can install llvm through e.g., brew.

Note that building for machines with CPUs supporting such extensions will exclude running your binary on earlier machines.

Compile with:

Contacts

If there are any issues with this web page, please let me know.

Qemu Ubuntu For Mac High Sierra

Retrieved from 'https://wiki.qemu.org/index.php?title=Hosts/Mac&oldid=9274'

I first learned about libvirt and QEMU three years ago when I wrote a guide on how to virtualize macOS on a Linux system. Today I will be showing the opposite, virtualizing Linux on macOS using the same tools. I was surprised that with so many software developers using MacBooks everyday, nobody has created a guide on how to use libvirt and QEMU with macOS.

Why is libvirt and QEMU better? First of all, it's free and open-source. Unlike Parallels Desktop and VMWare Fusion, you won't need to pay for expensive subscriptions or manage licenses. There does exist an open-source alternative (from Oracle!) called VirtualBox, which works pretty well. However, VirtualBox does not support macOS's Hypervisor.Framework, a virtualization API created to limit kernel modification. This means the installer will ask for admin access to install kernel extensions, a feature Apple is now phasing out for security reasons. QEMU on the other hand has had support for Hypervisor.Framework since 2018. Just say no to kexts!

Furthermore, like many developers, I like to run VMs headless, i.e. without a desktop GUI, so that I can SSH into them. Running VMs in the background seems like a simple feature, but it requires a lot of complex configuration for both VirtualBox and VMWare Fusion. And Parallels wants you buy the Pro Edition to gain access. Market segmentation at its finest... With libvirt, VMs start headless. Plus, when you shutdown macOS, it sends a shutdown signal to your VMs as well.

To be clear, this method doesn't support USB Passthrough, GPU Passthrough, or bridge networking. But if you just need to test, for example, node.js or nginx on a Linux VM, then this method is great.

Installing libvirt and QEMU

Ubuntu
  1. First, install homebrew, which is a package manager for macOS.
  2. Run brew install qemu gcc libvirt.
  3. Since macOS doesn't support QEMU security features, we need to disable them:
  4. Finally start the libvirt service, with brew services start libvirt. It will start after boot as well.

Installing Ubuntu Server 20.04

There are two ways to access the virtual display of the VM, either using a VNC client or the virt-viewer program. I recommend RealVNC Viewer. The VNC client is responsive and quick to install, but if you have multiple VMs you need to manually manage the different ports. With virt-viewer, you get a popup with all the VMs currently running, but it is laggy and takes an eternity to install. virt-viewer can be installed through homebrew. The rest of this guide uses VNC.

  1. Create a vms folder in your home directory, and generate a disk image. Change 50g to the size of your prefered disk:

  2. Download the Ubuntu Server 20.04 Install Image and my libvirt XML template and place the .iso and .xml files in the same folder.

  3. Modify the following elements in the ubuntu.xml file to match your your VM preferences and file paths. Save, then run virsh define ubuntu.xml followed by virsh start ubuntu.

  4. Start RealVNC Viewer and connect to localhost. Click the Ctrl+Alt+Del button to reboot the machine, and quickly press Esc to get into the boot menu. Press the number that matches the Ubuntu Server image.

  5. Install Ubuntu Server normally, making sure to enable the SSH server. Once it restarts you can connect to the VM from your terminal by running ssh -p 2222 user@localhost.

  6. To send a shutdown signal to your VM, run virsh shutdown ubuntu. To force shutdown, run virsh destroy ubuntu.

  7. To forward a port, e.g. port 443 from the VM to port 8443 locally, run the following: ssh -p 2222 -L8443:localhost:443 user@localhost

Multiple VMs

If you want to create multiple VMs, create an XML file for each machine with a unique UUID, VM name, and VNC port. Also, change the hostfwd argument so that each VM exposes a different port for SSH, e.g. 2223 instead of 2222. After you have defined them all, you can get a list of the VMs that are currently running with virsh list.

References:

Install Mac Os On Qemu

Note: More discussion on Hacker News