Install Alpine in QEMU: Difference between revisions

From Alpine Linux
m (→‎Before You Start: Grammar improvement.)
 
(26 intermediate revisions by 12 users not shown)
Line 1: Line 1:
[http://wiki.qemu.org/Index.html QEMU] is a very flexible open source machine emulator and virtualizer. QEMU is able to virtualize x86, PowerPC, and S390 guests.
==Before You Start==


=Before You Start=
* Download the [https://alpinelinux.org/downloads latest Alpine image].
* Install QEMU on your system (e.g. <code>sudo apt install qemu</code> on Ubuntu, <code>yum -y install qemu</code> on Fedora)


* First [http://alpinelinux.org/downloads download the latest Alpine CD image].
If you are using Alpine Linux, you can install:
* Install qemu on your system (e.g. <tt>yum -y install qemu</tt> on a Fedora based system)
 
{{Cmd|# apk add {{pkg|qemu|arch=}} {{pkg|qemu-img|arch=}} {{pkg|qemu-system-x86_64|arch=}} {{pkg|qemu-ui-gtk|arch=}}}}


==Create the Virtual Machine==
==Create the Virtual Machine==
Line 10: Line 12:
Create a disk image if you want to install Alpine Linux.
Create a disk image if you want to install Alpine Linux.


{{Cmd|qemu-img create alpine.qcow 8G}}
{{Cmd|qemu-img create -f qcow2 alpine.qcow2 8G}}


The following command starts qemu with the alpine iso image as cdrom and boot device, the default network configuration, 256 MB memory, and the disk image that was created in the previous step.  
The following command starts QEMU with the Alpine ISO image as CDROM, the default network configuration, 512MB RAM, the disk image that was created in the previous step, and CDROM as the boot device.


{{Cmd|qemu -cdrom alpine-2.2.1-x86_64.iso -hda alpine.qcow -boot d -net nic -net user -m 256 -localtime}}
{{Cmd|1=qemu-system-x86_64 -m 512 -nic user -boot d -cdrom alpine-standard-{{AlpineLatest}}-x86_64.iso -hda alpine.qcow2 -display gtk -enable-kvm}}


{{Tip|Replace <tt>qemu</tt> with <tt>qemu-kvm</tt> if your hardware support this.}}
{{Tip|Remove option <code>-enable-kvm</code> if your hardware does not support this.}}


After the installation qemu can be started from disk image (<tt>-boot c</tt>) without cdrom.
Log in as <code>root</code> (no password) and run: {{Cmd|setup-alpine}}
Follow the [[Alpine_setup_scripts#setup-alpine|setup-alpine installation steps]].


{{Cmd|qemu alpine.qcow -boot c -net nic -net user -m 256 -localtime}}
Run <code>poweroff</code> to shut down the machine.


== Live mode ==
== Booting the Virtual Machine ==
If your just want to give Alpine Linux a try, qemu can be used without a disk image.
After the installation, QEMU can be started from disk image (<code>-boot c</code>) without CDROM.


{{Cmd|qemu -m 512 -cdrom alpine-2.2.1-x86_64.iso}}
{{Cmd|qemu-system-x86_64 -m 512 -nic user -hda alpine.qcow2}}


[[Category:Virtualization]]
[[Category:Virtualization]]

Latest revision as of 17:16, 21 January 2024

Before You Start

  • Download the latest Alpine image.
  • Install QEMU on your system (e.g. sudo apt install qemu on Ubuntu, yum -y install qemu on Fedora)

If you are using Alpine Linux, you can install:

# apk add qemu qemu-img qemu-system-x86_64 qemu-ui-gtk

Create the Virtual Machine

Create a disk image if you want to install Alpine Linux.

qemu-img create -f qcow2 alpine.qcow2 8G

The following command starts QEMU with the Alpine ISO image as CDROM, the default network configuration, 512MB RAM, the disk image that was created in the previous step, and CDROM as the boot device.

qemu-system-x86_64 -m 512 -nic user -boot d -cdrom alpine-standard-3.20.3-x86_64.iso -hda alpine.qcow2 -display gtk -enable-kvm

Tip: Remove option -enable-kvm if your hardware does not support this.

Log in as root (no password) and run:

setup-alpine

Follow the setup-alpine installation steps.

Run poweroff to shut down the machine.

Booting the Virtual Machine

After the installation, QEMU can be started from disk image (-boot c) without CDROM.

qemu-system-x86_64 -m 512 -nic user -hda alpine.qcow2