Debian Appliance Builder: Difference between revisions
(21 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
= Introduction | == Introduction == | ||
Creating high quality appliances is a difficult task and requires deep knowledge of the underlying operating system. So we created the 'Debian Appliance Builder' to simplify that task. 'dab' is a script to automate the creation of OpenVZ appliances. It is basically a rewrite of debootstrap in perl, but uses OpenVZ instead of chroot and generates OpenVZ templates. Another difference is that it supports multi-stage building of templates. That way you can execute arbitrary scripts between package installation steps to accomplish what you want. | Creating high quality appliances is a difficult task and requires deep knowledge of the underlying operating system. So we created the 'Debian Appliance Builder' to simplify that task. 'dab' is a script to automate the creation of OpenVZ appliances. It is basically a rewrite of debootstrap in perl, but uses OpenVZ instead of chroot and generates OpenVZ and now also LXC templates. Another difference is that it supports multi-stage building of templates. That way you can execute arbitrary scripts between package installation steps to accomplish what you want. | ||
Furthermore, some common tasks are fully automated - like setting up a database server (mysql or postgres). To accomplish minimal template creation time, packages are cached to a local directory, so you do not need a local Debian mirror (although this would speed up the first run). All generated templates includes an appliance description file. Those can be used to build appliance repositories. | Furthermore, some common tasks are fully automated - like setting up a database server (mysql or postgres). To accomplish minimal template creation time, packages are cached to a local directory, so you do not need a local Debian mirror (although this would speed up the first run). All generated templates includes an appliance description file. Those can be used to build appliance repositories. | ||
'dab' is licensed under GPLv2 (Open source). | 'dab' is licensed under GPLv2 (Open source). | ||
== Main features | The version of this page having the OpenVZ DAB Manual is [http://pve.proxmox.com/mediawiki/index.php?title=Debian_Appliance_Builder&oldid=7718 here] | [[Media:Debian_Appliance_Builder_-_OpenVZ_2015-10-22.zip|here]] | [http://web.archive.org/web/20150912221447/http://pve.proxmox.com/wiki/Pvectl_manual Pvectl manual] | [http://web.archive.org/web/20150912222146/http://pve.proxmox.com/wiki/Qm_manual Qm Manual] | [http://web.archive.org/web/20150912221208/http://pve.proxmox.com/wiki/Vzctl_manual Vzctl Manual] | ||
== Main features == | |||
*Fully automated build process with standard 'make' scripts | *Fully automated build process with standard 'make' scripts | ||
Line 15: | Line 17: | ||
*Simplifies various tasks like database installation | *Simplifies various tasks like database installation | ||
*Appliances can be certified and integrated into the Proxmox VE download directory | *Appliances can be certified and integrated into the Proxmox VE download directory | ||
*Supports Debian 5, 6 and | *Supports Debian 5, 6, 7 and 8 based appliances | ||
*Generates 32 or 64 bit appliances | *Generates 32 or 64 bit appliances | ||
*Automatic dependency resolution | *Automatic dependency resolution | ||
== Target audience | == Target audience == | ||
'dab' is an easy way for software vendors and open source project to package their product into a "ready-to-run" appliance. Appliances can be published into the Proxmox VE appliance download directory to reach the target customer. See [[Download templates (Video)]]. | 'dab' is an easy way for software vendors and open source project to package their product into a "ready-to-run" appliance. Appliances can be published into the Proxmox VE appliance download directory to reach the target customer. See [[Download templates (Video)]]. | ||
In order to work with 'dab', basic Linux knowledge is needed. | In order to work with 'dab', basic Linux knowledge is needed. | ||
== DAB for LXC in PVE 4+ == | |||
[http://forum.proxmox.com/threads/23541-DAB-for-LXC-in-PVE-4 DAB can now be used to create LXC templates] where the SSH keys are regenerated at creation / cloning time. | |||
* Get the LXC Guest IP inside the guest: | |||
VMID=`hostname -I` | |||
* [https://github.com/ddimick/proxmox-lxc-idmapper LXC ID Mapper] | |||
* [https://forum.proxmox.com/threads/get-vmid-from-inside-lxc-guest.116078/ Get VMID within Debian/Ubuntu LXC Guest] | |||
== Updates to DAB == | |||
DAB is developed in the Git Repo at: | |||
https://git.proxmox.com/?p=dab.git;a=summary | |||
The DAB binary is located at: | |||
/usr/share/perl5/PVE/DAB.pm | |||
An [[Media:Unofficial_DAB_for_PVE3.zip|unofficial backported DAB for PVE 3.x]] is [http://forum.proxmox.com/threads/23541-DAB-for-LXC-in-PVE-4?p=117985#post117985 discussed here]. | |||
= Installation | OpenVZ '''conf''' directory in PVE 1.x is at <tt>/etc/vz/conf</tt> whilst in PVE 3 it is in <tt>/etc/pve/openvz/</tt> and is set in '''DAB.pm''' as my <tt>$cfgdir = "/etc/vz/conf";</tt> or my <tt>$cfgdir = "/etc/pve/openvz";</tt> around line 312. | ||
== Installation == | |||
The script needs to be run as root, so it is not recommended to start it on a production machine with running containers. | The script needs to be run as root, so it is not recommended to start it on a production machine with running containers. | ||
== System requirements | == System requirements == | ||
Prepare your operating system - you can install 'dab' on the following operating systems: | Prepare your operating system - you can install 'dab' on the following operating systems: | ||
Line 38: | Line 60: | ||
*Debian 64/Ubuntu 64 with OpenVZ Kernel (not tested) | *Debian 64/Ubuntu 64 with OpenVZ Kernel (not tested) | ||
== 'dab' installation | == 'dab' installation == | ||
Log into Proxmox VE, and install 'dab' using apt: | Log into Proxmox VE, and install 'dab' using apt: | ||
Line 48: | Line 70: | ||
Both <tt>ftp://</tt> and <tt>http://</tt> work for the '''wget''' URLs above. | Both <tt>ftp://</tt> and <tt>http://</tt> work for the '''wget''' URLs above. | ||
== 'dab' sample templates | == 'dab' sample templates == | ||
Check for current examples: Latest build files: https://git.proxmox.com/?p=dab-pve-appliances.git;a=summary | Check for current examples: Latest build files: https://git.proxmox.com/?p=dab-pve-appliances.git;a=summary | ||
Line 57: | Line 79: | ||
<pre>tar -zxvf dab-pve-appliances_2011-09-13.tar.gz</pre> | <pre>tar -zxvf dab-pve-appliances_2011-09-13.tar.gz</pre> | ||
= | == Build Virtual Appliances == | ||
= Build Virtual Appliances | |||
We published several examples to show how to work with 'dab'. To start, just build a first OS template based on our examples. If you understand the basics, you can start customizing your own appliance (based on a standard OS template). | We published several examples to show how to work with 'dab'. To start, just build a first OS template based on our examples. If you understand the basics, you can start customizing your own appliance (based on a standard OS template). | ||
Basic recommendations | === Basic recommendations === | ||
*Choose the best suitable base OS (squeeze) | *Choose the best suitable base OS (squeeze) | ||
Line 324: | Line 92: | ||
*Define the update procedure for users running the appliance in production: if you use Debian packages, update is easy (apt-get update) | *Define the update procedure for users running the appliance in production: if you use Debian packages, update is easy (apt-get update) | ||
*Contact the Proxmox support team for help [http://forum.proxmox.com/ Proxmox Support Forum] | *Contact the Proxmox support team for help [http://forum.proxmox.com/ Proxmox Support Forum] | ||
== Debian 6 Standard (Squeeze, i386) == | == Debian 6 Standard (Squeeze, i386) == | ||
Line 385: | Line 152: | ||
== Other OS sample Appliances == | == Other OS sample Appliances == | ||
These example OS templates are included in the [ | These example OS templates are included in the [https://git.proxmox.com/?p=dab-pve-appliances.git;a=summary dab-pve-appliances] | ||
You can find descriptions of available Virtual Appliances [[:Category: Virtual Appliances|here]]. | |||
= Get support | == Get support == | ||
[[Get support]] including commercial support offering concerning 'dab'. | [[Get support]] including commercial support offering concerning 'dab'. | ||
= Related Forum Posts = | == Related Forum Posts == | ||
* [http://forum.proxmox.com/threads/1919-Makefile-dab-template ATUIN's generic DAB File Template] | * [http://forum.proxmox.com/threads/1919-Makefile-dab-template ATUIN's generic DAB File Template] | ||
* [http://forum.proxmox.com/threads/19894-Mods-to-Updated-DAB-pm Oct 2014 mods to DAB.pm] based on the [https://git.proxmox.com/?p=dab.git;a=summary DAB Git Repo] - [[Media:DAB_127_2014-10-02.zip|Cache]] | |||
[[Category: | [[Category:Virtual Appliances]] [[Category:HOWTO]] |
Latest revision as of 20:53, 3 October 2022
Introduction
Creating high quality appliances is a difficult task and requires deep knowledge of the underlying operating system. So we created the 'Debian Appliance Builder' to simplify that task. 'dab' is a script to automate the creation of OpenVZ appliances. It is basically a rewrite of debootstrap in perl, but uses OpenVZ instead of chroot and generates OpenVZ and now also LXC templates. Another difference is that it supports multi-stage building of templates. That way you can execute arbitrary scripts between package installation steps to accomplish what you want.
Furthermore, some common tasks are fully automated - like setting up a database server (mysql or postgres). To accomplish minimal template creation time, packages are cached to a local directory, so you do not need a local Debian mirror (although this would speed up the first run). All generated templates includes an appliance description file. Those can be used to build appliance repositories.
'dab' is licensed under GPLv2 (Open source).
The version of this page having the OpenVZ DAB Manual is here | here | Pvectl manual | Qm Manual | Vzctl Manual
Main features
- Fully automated build process with standard 'make' scripts
- Local package cache
- Multi-stage build process
- Creates and includes appliance description files
- Simplifies various tasks like database installation
- Appliances can be certified and integrated into the Proxmox VE download directory
- Supports Debian 5, 6, 7 and 8 based appliances
- Generates 32 or 64 bit appliances
- Automatic dependency resolution
Target audience
'dab' is an easy way for software vendors and open source project to package their product into a "ready-to-run" appliance. Appliances can be published into the Proxmox VE appliance download directory to reach the target customer. See Download templates (Video).
In order to work with 'dab', basic Linux knowledge is needed.
DAB for LXC in PVE 4+
DAB can now be used to create LXC templates where the SSH keys are regenerated at creation / cloning time.
- Get the LXC Guest IP inside the guest:
VMID=`hostname -I`
Updates to DAB
DAB is developed in the Git Repo at:
https://git.proxmox.com/?p=dab.git;a=summary
The DAB binary is located at:
/usr/share/perl5/PVE/DAB.pm
An unofficial backported DAB for PVE 3.x is discussed here.
OpenVZ conf directory in PVE 1.x is at /etc/vz/conf whilst in PVE 3 it is in /etc/pve/openvz/ and is set in DAB.pm as my $cfgdir = "/etc/vz/conf"; or my $cfgdir = "/etc/pve/openvz"; around line 312.
Installation
The script needs to be run as root, so it is not recommended to start it on a production machine with running containers.
System requirements
Prepare your operating system - you can install 'dab' on the following operating systems:
- Proxmox VE (fastest)
- Proxmox VE inside Proxmox VE (KVM) - (most comfortable)
- Proxmox VE inside VMWare/XEN 64bit virtual machine
- Debian 64/Ubuntu 64 with OpenVZ Kernel (not tested)
'dab' installation
Log into Proxmox VE, and install 'dab' using apt:
apt-get install dab
Or download and install it manually:
wget http://download.proxmox.com/debian/dists/squeeze/pve/binary-amd64/dab_1.2-3_all.deb
The bleeding edge known to work and is available at:
wget http://download.proxmox.com/debian/dists/squeeze/pvetest/binary-amd64/dab_1.2-4_all.deb
Both ftp:// and http:// work for the wget URLs above.
'dab' sample templates
Check for current examples: Latest build files: https://git.proxmox.com/?p=dab-pve-appliances.git;a=summary
Older examples are on ftp://download.proxmox.com/sources/
wget http://download.proxmox.com/sources/dab-pve-appliances_2011-09-13.tar.gz
Unpack with tar:
tar -zxvf dab-pve-appliances_2011-09-13.tar.gz
Build Virtual Appliances
We published several examples to show how to work with 'dab'. To start, just build a first OS template based on our examples. If you understand the basics, you can start customizing your own appliance (based on a standard OS template).
Basic recommendations
- Choose the best suitable base OS (squeeze)
- Choose the right architecture (i383 or amd64)
- Always try to use deb packages for applications (instead of tar.gz files)
- Pre-configure applications as much as possible (PHP, Apache, MySql, Postgresql, etc.) - based on the recommendations of the software
- Use unique keys and passwords (auto generate them during first start-up)
- Define the update procedure for users running the appliance in production: if you use Debian packages, update is easy (apt-get update)
- Contact the Proxmox support team for help Proxmox Support Forum
Debian 6 Standard (Squeeze, i386)
This example shows the basic steps when creating appliances with 'dab'. First step is to create a temporary working directory and cd into that directory (or just cd into the previously un-tared examples):
mkdir debian-6.0-standard cd debian-6.0-standard
Now you need to create/edit the configuration file called 'dab.conf':
Suite: lenny Architecture: i386 Name: debian-6.0-standard Version: 6.0-1 Section: system Maintainer: Proxmox Support Team <support@proxmox.com> Infopage: http://pve.proxmox.com/wiki/Debian_6.0_Standard Description: Debian 6.0 (standard) A small Debian Lenny system including all standard packages.
Next step: Download the available package lists:
dab init
Start the creation process with:
dab bootstrap
Finally build the final appliance package with:
dab finalize
Thats all. Simply upload the final template to your Proxmox VE server (/var/lib/vz/template/cache/) and test what you created. Sure, always check if everything went well before releasing a template. For this purpose all output is logged to a file called 'logfile'.
When finished you may want to cleanup your working directory with:
dab clean
or use 'dist-clean' if you also want to erase the package cache directory:
dab dist-clean
You can automate above steps using make. Simply create a file called 'Makefile' (here is an example):
BASEDIR:=$(shell dab basedir) all: info/init_ok dab bootstrap dab finalize info/init_ok: dab.conf dab init touch $@ .PHONY: clean clean: dab clean rm -f *~ .PHONY: dist-clean dist-clean: dab dist-clean rm -f *~
To start template creation you can now simply type:
make
and
make clean
to cleanup the directory.
The Build your first DAB Appliance Template page shows how to practically setup DAB and get along building templates.
Other OS sample Appliances
These example OS templates are included in the dab-pve-appliances
You can find descriptions of available Virtual Appliances here.
Get support
Get support including commercial support offering concerning 'dab'.