Dev/Build Documentation/14 full

< Dev‎ | Build Documentation


This page documents how to build Whonix VirtualBox .ova and KVM .qcow2 images. For Qubes-Whonix, see Dev/Qubes#Build_Qubes-Whonix_Templates.

Host Preparation[edit]

  • You need to build on Debian stretch, such as Whonix-Workstation 14 or a Debian stretch VM.
  • You cannot build on Whonix-Gateway (due to networking issues).
  • It is recommended to set your terminal (for example Konsole) to unlimited scrollback, so you can watch the full build log.
  • You need ~ 30 GB free disk space.
  • Do not build as root.
  • Short: Don't add private files to Whonix's source code folder! [...]

Long: [...] Unless you know what you are doing. Technically, it would work. This is recommended against. Those files would get managed by the respective package. When you later update Whonix debian packages, your files would get deleted by the package manager. Also adding private files to Whonix's source code folder, later contributing to Whonix's development and accidentally pushing the wrong git branch would be a disaster. Better add your private files to Whonix after building Whonix. Or add a custom build step adding your files, which then get copied from a folder outside of Whonix's source folder. See "Source Code Changes" in "Optional Build Configuration" below.

  • Short: Make sure there aren't any VMs in VirtualBox (inside your build machine) already called Whonix-Gateway or Whonix-Workstation!

Long: Because the build script would fail, because it tries to create VMs either named Whonix-Gateway or Whonix-Workstation. Running the clean script between builds will prevent this error.

  • Short: Do not try to build Whonix-Gateway and Whonix-Workstation at the same time!

Long: Building Whonix-Gateway and Whonix-Workstation at the same time is not supported due to limitations in the build script. In other words, do not try to run for example sudo ~/Whonix/whonix_build --flavor whonix-gateway -- --build --target virtualbox and sudo ~/Whonix/whonix_build --flavor whonix-workstation -- --build --target virtualbox at the same time. The build would probably fail.

  • Short: Don't use images created inside Continuous Integration (CI) environments for anything besides testing!

Usually you are not using CI environments without knowing.

You can find out if you are running inside a CI environment by running.

echo "$CI"

If it shows nothing, i.e.

Everything is fine.

Otherwise, if it were to show.


Then don't use these images for anything besides testing.


  • Get the source code
sudo apt-get update
sudo apt-get install git curl
cd; git clone --jobs=4 --recursive
  • Learn how to verify the code here.
  • Install APT Cache. (If you want to use onion sources AND you are not behind Whonix-Gateway see APT Cache in "optional build configuration" below).
sudo apt-get install apt-cacher-ng

VM Creation[edit]

The following build targets are available:

--target virtualbox
--target qcow2
--target raw
--target root
  • --target virtualbox creates .ova images VirtualBox
  • --target qcow2 creates .qcow2 images for KVM and QEMU
  • --target raw creates .raw images
  • --target root is for Physical Isolation Build Documentation
  • --target virtualbox, --target qcow2, and --target raw can be combined to build multiple images at once.

Note: These instructions use VirtualBox as an example, assume you have the Whonix source code at ~/, and assume you are using APT Cache.

Delete any existing Whonix-Gateway virtual machine with the following command. Warning: This will delete any virtual machine named Whonix-Gateway from VirtualBox installed on your build machine!

sudo REPO_PROXY= ~/Whonix/whonix_build --flavor whonix-gateway --target virtualbox --clean

Delete any existing Whonix-Workstation virtual machine with the following command. Warning: This will delete any virtual machine named Whonix-Workstation from VirtualBox installed on your build machine!

sudo REPO_PROXY= ~/Whonix/whonix_build --flavor whonix-workstation --target virtualbox --clean

Build a Whonix-Gateway virtual machine image.

sudo REPO_PROXY= ~/Whonix/whonix_build --flavor whonix-gateway --target virtualbox --build

Build a Whonix-Workstation virtual machine image.

sudo REPO_PROXY= ~/Whonix/whonix_build --flavor whonix-workstation --target virtualbox --build

The resulting .ova, .qcow2 and/or .raw images can be found in ~/whonix_binary folder.

While building, you might see a few Expected Build Warnings.

Random News:

Please consider a recurring payment for your Priority Support!

https | (forcing) onion

Share: Twitter | Facebook

This is a wiki. Want to improve this page? Help is welcome and volunteer contributions are happily considered! See Conditions for Contributions to Whonix, then Edit! IP addresses are scrubbed, but editing over Tor is recommended. Edits are held for moderation.

Whonix is a licensee of the Open Invention Network. Unless otherwise noted, the content of this page is copyrighted and licensed under the same Libre Software license as Whonix itself. (Why?)

Whonix is provided by ENCRYPTED SUPPORT LP. See Imprint.