5 ms·
Simulate an Ubuntu-like VM inside macOS
- beeman 3y agoI have been using Multipass [0] for a while and it works great to quickly spin up an Ubuntu environment on my MacBook. It supports cloud config in case you want a custom instance. It seems to be limited to running Ubuntu instances only (at least, I haven't figured out how to run other Linux instances) but if you want a quick clean Ubuntu VM I would recommend it. 0: https://multipass.run/ https://multipass.run/
- yashodhanmohan 3y agoThis looks quite interesting! Much more elaborate in options I guess. Though the limitation to Ubuntu is something they should look into expanding. Does it also allow me to persist state?
- MonaroVXR 3y ago> Does it also allow me to persist state? You mean snapshots like a real vm? No, and thats why I don't use it. Edit already, since I was wrong https://discourse.ubuntu.com/t/multipass-snapshot-command/39755 https://discourse.ubuntu.com/t/multipass-snapshot-command/39...
- Erratic6576 3y ago$ brew install multipass
- k_roy 3y agoLeeloo Dallas Multipass
- lioeters 3y agoI second this recommendation. Multipass is a convenient cross-platform way to run Ubuntu VMs.
- yashodhanmohan 3y agoWould love if Multipass could extend to other UNIX flavors as well.
- moondev 3y agoOn Linux you can specify any cloud-init qcow2 image with file:// or http(s):// and it works beautifully
- intpx 3y agoMultipass is pretty clutch for trivial VMs on MacOs for sure. I use it for a bunch of ssh jump boxes running vpns to different sites. The macOS build does not support custom images (lest not without [some truly insane hacks](https://github.com/canonical/multipass/issues/1260#issuecomment-1152222880 https://github.com/canonical/multipass/issues/1260#issuecomm...) , which doesn’t really matter for what I use it for but it is kind of a bummer. If you need something with a little more grunt but don’t want to go full blown with writing your own QEMU tooling or fussing with something like UTM or Parallels, [quickemu](https://github.com/quickemu-project/quickemu https://github.com/quickemu-project/quickemu) is a really nice qemu wrapper with sane defaults that can expose a whole lot of power if you need it.
- ascendantlogic 3y agoI tend to use https://lima-vm.io/ https://lima-vm.io/ these days when I need a quick VM environment locally on my laptop.
- freetime2 3y agoLima is what I use as well. It's quick and easy to just fire up a VM with default settings, but also very easy to configure with different file sharing options, port forwarding, different linux distributions, etc. (their examples are also pretty good IMO [1]). In particular I use it to run an amd64 VM, which I need to run a stubborn service for work that doesn't run on arm CPUs. [1] https://github.com/lima-vm/lima/tree/master/examples https://github.com/lima-vm/lima/tree/master/examples
- gbraad 3y agoI want a VM so I run a container?
- js2 3y agoThis reads a bit like "when all you have is a hammer" because it seems like what you want is a VM, not a container[^1]. Have you considered using VM software instead of Docker and using an Ubuntu VM directly? Some options: https://mac.getutm.app/ https://mac.getutm.app/ https://tart.run/ https://tart.run/ https://orbstack.dev/ https://orbstack.dev/ (using its "machines" functionality) [^1]: Of course macOS docker is running a Linux VM under-the-hood, but that's an implementation detail.
- yashodhanmohan 3y agoI have used VM softwares before and would have preferred using them in all honesty. This was more of an exploratory "can I do this? if yes, how far can I take it?" exercise. I just wanted to see how much effort would it take if I just wanted to "simulate" stuff (turns out 4 measly scripts). Plus I already use Docker in my work. This helps me avoid installing the VM software separately.
- fragmede 3y agoNot to mention, Parallels, VMWare, VirtualBox, QEMU
- cassianoleal 3y agoUTM (GP's first link) is a GUI on top of QEMU. Well, that plus the native macOS hypervisor framework as of a few months ago.
- chucksta 3y agoLast I tried Vritualbox isn't reliably available on M1
- cassianoleal 3y agoAbout OrbStack's machines: > Strictly speaking, OrbStack machines are not independent VMs, but they're virtually indistinguishable for most intents and purposes — just with better integration. This is why we choose to call them "machines". https://docs.orbstack.dev/architecture#linux-machines https://docs.orbstack.dev/architecture#linux-machines
- j16sdiz 3y agoWhy "stimulate" an Ubuntu-"like" VM when you can have real Ubuntu in a real VM? This docker-based solution looks needlessly complex.
- yashodhanmohan 3y agoJust to see if I can. Just a small weekend exercise. "Complexity" might be subjective though, but then again it looks simple to me because I made it, so I might be excessively biased.
- sgarland 3y agoFrom TFA, the author mentions things like `date` having different args on Mac (BSD utils) and Linux (GNU utils). While true, you can just install GNU utils on a Mac, and get access to all of those, prefixed by g (e.g. GNU sed is launched with gsed). Linuxify [0] is a decent shell script that does all of this for you. [0]: https://github.com/darksonic37/linuxify https://github.com/darksonic37/linuxify
- mook 3y agoIf you already use homebrew, that works too: https://github.com/Homebrew/homebrew-core/blob/3ef7d3e13549bdb977d180600b77d2ae02962378/Formula/c/coreutils.rb#L106 https://github.com/Homebrew/homebrew-core/blob/3ef7d3e13549b...
- k_roy 3y agoYou can also do the same thing just with homebrew. I regularly replace a number of CLI utils because the BSD alternatives often have silly defaults/incompatible changes No gsed, just sed.
- sgarland 3y agoYeah, the script is just calling brew install over a list anyway. I also outright replace sed and awk with their GNU equivalents. Better options and behavior, IMO. The only downside is if you have to share a script with someone, and then have to figure out how to make it work with stock.
- rswail 3y agoIf you use Macports (much more consistent than homebrew and much more attentive to the way MacOS works and MacOS SIP etc works) then installing the GNU utils ports gives you a standard GNU environment, so pretty close to Ubuntu/Fedora etc. Of course, networking etc and DNS and other system services will be the native MacOS, but MacOS is a Unix. It has its own init with launchtl and DNS/mDNS with scutil and mDNSResponder.
- yashodhanmohan 3y agoYep, used to use linuxify a few years back. But then it used to mess with my internal scripts. Anyhow, this was just a "what-if" exercise. Plus, Ubuntu was a test OS, but CentOS/RHEL were real PITA on client systems and this gives me a quick way out from spinning up a VM while still maintaining control. But agreed, if I just wanted GNU utils, I'd have just gone ahead with linuxify.
- oujiii 3y agoCould this be used to spin up older os x (and older Linux and Windows)? Or would any of the other services do that? Would be really nice for my work!
- yashodhanmohan 3y agoAnything that has a base Docker image available, this would work. RHEL, Debian, etc should work without much effort. I have not seen older OSX Docker images so probably not. Windows server does offer some base docker images.
- dakiol 3y agoI use multipass to run Ubuntu VMs on macos (m1). It works flawlessly. Zero issues so far (I keep around 3 or 4 VMs running in the bg and they still work after days/weeks with no issues regarding the network or whatever)
- TheFuzzball 3y agoA big flaw in this approach is that the `ubuntu:latest` VM is not necessarily the same userland as a real Ubuntu installation (e.g. Ubuntu Server 20.04 != ubuntu:20.04).
- pjmlp 3y ago> There are times, when you’re working on a remote system that has a Unix system like Ubuntu, RHEL, etc. While on a certified UNIX system, naturally the solution is to use a VM. /s