Packer KVM: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
 
(13 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 +
=Webserver=
 +
*[[Packer Webserver]]
 +
=KVM Host=
 +
==Packer Build File==
 +
*~/packer/debian-kvm.json
 
<syntaxhighlight lang=json>
 
<syntaxhighlight lang=json>
 
{
 
{
  "variables": {
 
    "username": "root@pam",
 
    "password": "Sehr-Geheim"
 
  },
 
 
   "builders": [
 
   "builders": [
 
     {
 
     {
Zeile 24: Zeile 25:
 
         " debconf/priority=critical",
 
         " debconf/priority=critical",
 
         " preseed/url=http://daisy.xinux.org/preseed/debian11/preseed.cfg <wait>",
 
         " preseed/url=http://daisy.xinux.org/preseed/debian11/preseed.cfg <wait>",
         "debian-installer=de_DE.UTF-8 <wait>",<pre>
+
         "debian-installer=de_DE.UTF-8 <wait>",
 
 
 
         "auto <wait>",
 
         "auto <wait>",
 
         "locale=de_DE.UTF-8 <wait>",
 
         "locale=de_DE.UTF-8 <wait>",
Zeile 38: Zeile 38:
 
       ],
 
       ],
 
       "qemuargs": [
 
       "qemuargs": [
                 ["-display", "gtk"]<pre>
+
                 ["-display", "gtk"]
  
 
             ],
 
             ],
Zeile 44: Zeile 44:
 
       "ssh_username": "vagrant",
 
       "ssh_username": "vagrant",
 
       "ssh_timeout": "15m",
 
       "ssh_timeout": "15m",
       "ssh_password": "vagrant",
+
       "ssh_password": "vagrant",http://daisy.xinux.org/isos/debian-11.3.0-amd64-netinst.iso
 
       "shutdown_command": "echo 'vagrant' | sudo -S /sbin/shutdown -hP now"
 
       "shutdown_command": "echo 'vagrant' | sudo -S /sbin/shutdown -hP now"
 
     }
 
     }
 
   ]
 
   ]
 
}
 
}
 +
</syntaxhighlight>
 +
 +
==Bild Vorgang starten==
 +
*packer build debian11-qemu.json
 +
<pre>
 +
qemu output will be in this color.
 +
 +
==> qemu: Retrieving ISO
 +
    qemu: Found already downloaded, initial checksum matched, no download needed: http://daisy.xinux.org/isos/debian-11.3.0-amd64-netinst.iso
 +
==> qemu: Creating hard drive...
 +
==> qemu: Starting HTTP server on port 8603
 +
==> qemu: Found port for communicator (SSH, WinRM, etc): 2970.
 +
==> qemu: Looking for available port between 5900 and 6000 on 127.0.0.1
 +
==> qemu: Starting VM, booting from CD-ROM
 +
==> qemu: Overriding defaults Qemu arguments with QemuArgs...
 +
==> qemu: Waiting 10s for boot...
 +
==> qemu: Connecting to VM via VNC (127.0.0.1:5903)
 +
==> qemu: Typing the boot command over VNC...
 
</pre>
 
</pre>
</syntaxhighlight>
+
[[Datei:Packer-1.png]]
 +
==Abschluss der Installation==
 +
<pre>
 +
==> qemu: Using ssh communicator to connect: 127.0.0.1
 +
==> qemu: Waiting for SSH to become available...
 +
==> qemu: Connected to SSH!
 +
==> qemu: Gracefully halting virtual machine...
 +
    qemu:
 +
    qemu: Wir gehen davon aus, dass der lokale Systemadministrator Ihnen die
 +
    qemu: Regeln erklärt hat.  Normalerweise läuft es auf drei Regeln hinaus:
 +
    qemu:
 +
    qemu:    #1) Respektieren Sie die Privatsphäre anderer.
 +
    qemu:    #2) Denken Sie nach, bevor Sie tippen.
 +
    qemu:    #3) Mit großer Macht kommt große Verantwortung.
 +
    qemu:
 +
    qemu: [sudo] Passwort für vagrant:
 +
==> qemu: Converting hard drive...
 +
Build 'qemu' finished.
 +
 
 +
==> Builds finished. The artifacts of successful builds are:
 +
--> qemu: VM files in directory: output-qemu
 +
</pre>
 +
==Ergebnis==
 +
*file output-qemu/packer-qemu
 +
output-qemu/packer-qemu: QEMU QCOW2 Image (v3), 5242880000 bytes

Aktuelle Version vom 5. April 2022, 13:30 Uhr

Webserver

KVM Host

Packer Build File

  • ~/packer/debian-kvm.json
{
  "builders": [
    {
      "type": "qemu",
      "disk_size": "5000",
      "format": "qcow2",
      "accelerator": "kvm",
      "iso_url": "http://daisy.xinux.org/isos/debian-11.3.0-amd64-netinst.iso",
      "iso_checksum_type": "sha256",
      "iso_checksum": "7892981e1da216e79fb3a1536ce5ebab157afdd20048fe458f2ae34fbc26c19b",
      "http_directory": "config",
      "boot_wait": "10s",
      "boot_command": [
        "<esc><wait>",
        "install <wait>",
        "/install/vmlinuz<wait>",
        " initrd=/install/initrd.gz",
        " auto-install/enable=true",
        " debconf/priority=critical",
        " preseed/url=http://daisy.xinux.org/preseed/debian11/preseed.cfg <wait>",
        "debian-installer=de_DE.UTF-8 <wait>",
        "auto <wait>",
        "locale=de_DE.UTF-8 <wait>",
        "kbd-chooser/method=us <wait>",
        "keyboard-configuration/xkb-keymap=de <wait>",
        "fb=false <wait>",
        "debconf/frontend=noninteractive <wait>",
        "console-setup/ask_detect=false <wait>",
        "console-keymaps-at/keymap=de <wait>",
        "grub-installer/bootdev=/dev/vda <wait>",
        "<enter><wait>"
      ],
      "qemuargs": [
                ["-display", "gtk"]

            ],
      "memory": "4096",
      "ssh_username": "vagrant",
      "ssh_timeout": "15m",
      "ssh_password": "vagrant",http://daisy.xinux.org/isos/debian-11.3.0-amd64-netinst.iso
      "shutdown_command": "echo 'vagrant' | sudo -S /sbin/shutdown -hP now"
    }
  ]
}

Bild Vorgang starten

  • packer build debian11-qemu.json
qemu output will be in this color.

==> qemu: Retrieving ISO
    qemu: Found already downloaded, initial checksum matched, no download needed: http://daisy.xinux.org/isos/debian-11.3.0-amd64-netinst.iso
==> qemu: Creating hard drive...
==> qemu: Starting HTTP server on port 8603
==> qemu: Found port for communicator (SSH, WinRM, etc): 2970.
==> qemu: Looking for available port between 5900 and 6000 on 127.0.0.1
==> qemu: Starting VM, booting from CD-ROM
==> qemu: Overriding defaults Qemu arguments with QemuArgs...
==> qemu: Waiting 10s for boot...
==> qemu: Connecting to VM via VNC (127.0.0.1:5903)
==> qemu: Typing the boot command over VNC...

Packer-1.png

Abschluss der Installation

==> qemu: Using ssh communicator to connect: 127.0.0.1
==> qemu: Waiting for SSH to become available...
==> qemu: Connected to SSH!
==> qemu: Gracefully halting virtual machine...
    qemu:
    qemu: Wir gehen davon aus, dass der lokale Systemadministrator Ihnen die
    qemu: Regeln erklärt hat.  Normalerweise läuft es auf drei Regeln hinaus:
    qemu:
    qemu:     #1) Respektieren Sie die Privatsphäre anderer.
    qemu:     #2) Denken Sie nach, bevor Sie tippen.
    qemu:     #3) Mit großer Macht kommt große Verantwortung.
    qemu:
    qemu: [sudo] Passwort für vagrant:
==> qemu: Converting hard drive...
Build 'qemu' finished.

==> Builds finished. The artifacts of successful builds are:
--> qemu: VM files in directory: output-qemu

Ergebnis

  • file output-qemu/packer-qemu
output-qemu/packer-qemu: QEMU QCOW2 Image (v3), 5242880000 bytes