1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <!DOCTYPE html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /><meta name="keywords" content="GNU, Emacs, Libre Software, Hurd, Guile, Guix" /><meta name="description" content="GNUcode.me is a website focusing on libre software projects, especially the GNU project." /><link type="application/atom+xml" rel="alternate" title="GNUcode.me -- Feed" href="/feed.xml" /><a rel="me" href="https://fosstodon.org/@thegnuguy"></a><link type="text/css" href="css/footer.min.css" rel="stylesheet"></link><link type="text/css" href="css/header.min.css" rel="stylesheet"></link><link type="text/css" href="css/main.min.css" rel="stylesheet"></link><title>Installing OpenBSD on a VM — GNUcode.me</title></head><body><header><nav><ul><li><a href="index.html">GNUcode.me</a></li><li><a href="services.html">Services</a></li><li><a href="about.html">About</a></li><li><a href="business-ideas.html">Business-ideas</a></li></ul></nav></header><h1>Installing OpenBSD on a VM</h1><main><section class="basic-section-padding"><article><h3>by Joshua Branson — August 05, 2022</h3><div><p>I am of the opinion, that in order to learn how to use an operating system, you
- have to use it often. Since I am madly in love with Guix System, but have an
- interest in the GNU/Hurd and OpenBSD, I might as well install those OSs on a
- virtual machine! I have already done that with the GNU/Hurd, and today I also
- did it for OpenBSD.</p><p>I was not that hard to do. I used this guide to <a href="https://wiki.qemu.org/index.php/Hosts/BSD#OpenBSD">install OpenBSD on a vm.</a></p><p>First let’s create a qemu img for OpenBSD.</p><p><code>qemu-img create -f qcow2 hd0.qcow2.img 100G</code></p><p>Now, let's create an install script.</p><pre><code>cat install-bsd.sh
- #!/bin/sh
- qemu-system-x86_64 -m 2048 \
- -no-reboot \
- -cdrom cd71.iso \
- -drive if=virtio,file=hd0.qcow2.img,format=qcow2 \
- -enable-kvm \
- -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:7922-:22 \
- -device virtio-net,netdev=mynet0 \
- -smp 2</code></pre><p>As always installing OpenBSD is an absolute breeze. I do not know how to
- manually partition things, so I just chose the auto install. Also OpenBSD
- supports a <code>us.swapcaps.dvorak</code> keyboard layout. That’s my layout! How cool is
- that!? And it sets up that layout for the console and X by default. Guix
- System does that, but not so well for wayland.</p><pre><code>cat run-bsd.sh</code></pre><p>Now let's create a run script.</p><pre><code>#!/bin/sh
- qemu-system-x86_64 -m 4G \
- -no-reboot \
- -drive if=virtio,file=hd0.qcow2.img,format=qcow2 \
- -enable-kvm \
- -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:7922-:22 \
- -device virtio-net,netdev=mynet0 \
- -smp 2</code></pre><p>I find the <code>-no-reboot</code> option helpful, because OpenBSD likes to try to autoreboot
- itself, even when you give it the command: <code>halt</code>.</p><p>I have ran OpenBSD before for about a week before, and it is always a pleasure
- to read man afterboot. With OpenBSD the man pages are absolutely excelent.</p><p>One of the first things I did was:</p><p><code># cp /etc/examples/doas.conf /etc/</code></p><p>Now my user <code>berno</code> can use <code>doas</code> to install packages! Let’s install Emacs!</p><p><code>doas pkg_add emacs</code></p><p>Also OpenBSD has a habit of printing clues to the console after you type in a
- command. For examle, after you install a package, OpenBSD tells you that it has
- installed README files in <code>/usr/local/bsah/blah/README/emacs/</code>. I find it really
- cool that it reminds you of this. Also, when you run <code>doas syspatch</code> it will
- tell you that it updated syspatch. It will also say something like:</p><blockquote><p>Please run syspatch again to apply the patches.</p></blockquote><p>That’s a handy tip! And indeed, <code>doas syspatch -c</code> showed that the patches had
- not yet been applied.</p><p>Also whilst searching for the internet for how to install OpenBSD on a vm image,
- I came accross <a href="https://www.skreutz.com/posts/autoinstall-openbsd-on-qemu/">blog post</a> that describes that you can automate OpenBSD installs.
- That might be something to play with later!</p><p>I would like to also set up my local OpenBSD to set up ssh. That way I could do
- something like this:</p><pre><code>#+BEGIN_SRC shell :dir /ssh:berno@localhost:/home/berno :exports both
- ls | wc -l
- #+END_SRC
- #+RESULTS:
- : 9</code></pre><p>I also think it would be fabulous if the OpenBSD team started to make a
- guix-like package manager/distro. I imagine that they could use perl to do it,
- since it seems like OpenBSD has embraced perl as their scripting language, and I
- think it their man pages show that perl can use some rather low lever operating
- system interfaces.</p></div></article></section></main><footer><p>© 2020 Joshua Branson. The text on this site is free culture under the Creative Commons Attribution Share-Alike 4.0 International license.</p><p>This website is build with Haunt, a static site generator written in Guile Scheme. Source code is <a href="https://notabug.org/jbranso/gnucode.me">available.</a></p><p>The color theme of this website is based off of the famous <a href="#3f3f3f" target="_blank">zenburn</a> theme.</p></footer></body>
|