Skip to content

Instantly share code, notes, and snippets.

@sagittarius-a
Created April 19, 2022 20:36
Show Gist options
  • Save sagittarius-a/ec38406604b77b076df3c2acd41b7c21 to your computer and use it in GitHub Desktop.
Save sagittarius-a/ec38406604b77b076df3c2acd41b7c21 to your computer and use it in GitHub Desktop.
FreeBSD CURRENT installation in QEMU

Default STABLE installation

See the handbook if need be.

Post installation

As root:

pkg update
pkg install sudo vim git
vim /etc/ssh/sshd_config
# Replace PermitRootLogin

vim /etc/rc.conf
# Add `sshd_enable="YES"`

/etc/rc.d/sshd restart

Update sudoers file if need be.

Installing CURRENT

As root:

cd /usr/src
git clone https://github.com/freebsd/freebsd-src
# Around 2.3 GiB to download
cd freebsd-src
  • Install world: make -j4 buildworld. Very long process.
  • Install kernel: make -j4 kernel

Then follow other steps from https://docs.freebsd.org/en/books/handbook/cutting-edge/#makeworld

Links

#!/bin/bash
export VMNAME=freebsd-14
export MYUSERNAME=freebsd
export LANG=en_US.UTF-8
export LOCALE=$LANG
PROCESSORS=4
MEMORY=4096
CD_IMG=./iso/FreeBSD-13.0-RELEASE-amd64-disc1.iso
HD_IMG=~/usr/vm/$VMNAME/$VMNAME.img
# Share a directory between host and VM
PASSTHROUGH_DISK_OPTS=""
#"-virtfs local,id=passthr1,path=/home/$MYUSERNAME/vm/vm-shared,security_model=passthrough,writeout=immediate,mount_tag=passthr1"
# Directly open a port to the VM
REDIR=""
# REDIR="-redir tcp:3000::22"
# The MAC address is freely choosable
# NETWORK_OPTS="-net tap,ifname=tap0,script=no,downscript=no -net nic,macaddr=BA:CE:BA:CE:00:02"
NETWORK_OPTS="-nic user,hostfwd=tcp::2222-:22"
OPTIONS=
#-nographic
#-full-screen
qemu-system-x86_64 -m $MEMORY -smp $PROCESSORS -boot c -enable-kvm -vga vmware -cdrom $CD_IMG -hda $HD_IMG $PASSTHROUGH_DISK_OPTS $REDIR $NETWORK_OPTS $OPTIONS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment