Skip to content

Instantly share code, notes, and snippets.

@gustavohenrique
Last active April 30, 2023 17:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gustavohenrique/fecbb3c59444590914516fd6a3e1bf76 to your computer and use it in GitHub Desktop.
Save gustavohenrique/fecbb3c59444590914516fd6a3e1bf76 to your computer and use it in GitHub Desktop.
running old linux distro using qemu

install

# Linux
sudo pacman -Syu qemu
sysctl -a | grep machdep.cpu.features # accelerators found

# Mac
brew install qemu

running

# Old Linux
qemu-img create -f qcow2 hd.qcow2 5G
qemu-system-i386 -boot d -m 512 -hda $PWD/hd.qcow2 -cdrom  $PWD/Conectiva6.0.iso -net nic,vlan=0 -net user,vlan=0 -localtime

qemu-kvm -m 16M -drive if=ide,format=qcow2,file=slackware.qcow2 \
 -netdev user,id=slirp -device ne2k_isa,netdev=slirp \
 -serial stdio -redir tcp:22122::22

# Modern Linux
cd ~/linux
image="ubuntu-desktop-18.04"
qemu-img create -f qcow2 ${image}.qcow2 70G
qemu-system-x86_64 \
  -m 2048 \
  -vga virtio \
  -show-cursor \
  -usb \
  -device usb-tablet \
  -enable-kvm \
  -cdrom ${image}.iso \
  -drive file=${image}.qcow2,if=virtio \
  -accel hvf \ # hvf in MacOS kvm in Linux 
  -cpu host \
  -net user,hostfwd=tcp::10022-:22 \ # ssh user@localhost -p10022
  -net nic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment