Skip to content

Packer scripts to prepare virtual appliances from official ISO images

Notifications You must be signed in to change notification settings

alt-cloud/alt-packer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Packer VM image build instructions

Contents


Overview

This repository contains Packer definitions to build images to boot ALT Linux in virtual environments as KVM, VirtualBox, etc.

Preparation

Update the kernel like:

sudo update-kernel

and reboot to take advantage of new kernel packages.

Install the following dependencies:

  • make
  • jq
  • curl
  • wget
  • qemu-kvm
  • qemu-ui-sdl
  • virtualbox
  • packer
  • vagrant (only if you plan to distribute boxes via Vagrant Cloud)
  • kernel-modules-kvm-std-def
  • kernel-modules-virtualbox-std-def
  • nbd-client, nbd-server (if you plan to transfer images using NBD)

and add the necessary kernel module to the list of modules to load:

For Intel:

echo kvm_intel >> /etc/modules-load.d/kvm.conf

For AMD:

echo kvm_amd >> /etc/modules/kvm.conf

You will also need to add user to vmusers group for QEMU:

usermod -aG vmusers username

You will also need VirtualBox service working and the user added into VirtualBox group:

usermod -aG vboxadd,vboxusers username
systemctl enable virtualbox
systemctl start virtualbox

Then reboot the machine.

  • Create the packer_cache directory (or symlink it) and download the necessary ISOs into it.

Building images

You may start building image for QEMU like:

make image target=alt-workstation headless=false BASE_VERSION=9 TARGET_VERSION=9 VM_TYPE=qemu

or if you want to build image for VirtualBox:

make image target=alt-server headless=false BASE_VERSION=9 TARGET_VERSION=9 VM_TYPE=vbox

Publishing images

You may publish previously built boxes using Vagrant software like:

export VAGRANTCLOUD_TOKEN="my_cloud_auth_token"
make publish orgname=myorg target=alt-server VM_TYPE=vbox BASE_VERSION=9 TARGET_VERSION=9
make publish orgname=myorg target=alt-workstation VM_TYPE=qemu BASE_VERSION=9 TARGET_VERSION=9

Syncing images

In order to keep images up-to-date there is sync_images script provided in the repository. It parses the corresponding ditro configuration files and checks if the necessary images are provided in the ./packer_cache directory. It's advised to set up to start this script using crond in order to keep images synchronized.

It is also possible to invoke the script using make sync command.

Using images with Vagrant

You may find Vagrantfile templates in vagrant directory. Just go into subdirectory corresponding to the box you want to start and type

vagrant up

Deploying images to Proxmox

First export QCOW2 image from build machine using NBD (on port 12345):

nbd-server 12345 /mnt/disk/alt-packer/qemu-alt-server-9-amd64/qemu-alt-server-9-amd64

On the client you need to issue command to connect to NBD server (assuming server IP is 192.168.1.101):

nbd-client -D 192.168.1.101 12345

On client, you may check that QCOW2 image is mounted using these commands:

file -s /dev/nbd0

or better:

qemu-img info /dev/nbd0

Then (on client) use qemu-img utility to transfer image to block device of your choice:

qemu-img dd bs=1M if=/dev/nbd0 of=/dev/pve/zvol/vm-100-disk-1

This may take quite a time because of large file transfer.

Then disconnect the client:

nbd-client -d /dev/nbd0

and stop the server with SIGINT (pressing Ctrl+C).

Troubleshooting

  • In case of problems with autoinstaller add instdebug option to kernel boot parameters.
  • In case of errors like No space left on device when using /tmp directory - set TMPDIR variable to another location.

About

Packer scripts to prepare virtual appliances from official ISO images

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scheme 58.9%
  • Shell 29.4%
  • Python 9.0%
  • Makefile 2.7%