2014-11-22 09:01:49 -05:00
---
2021-03-13 13:06:18 -05:00
lang: en
2015-04-10 16:17:45 -04:00
layout: doc
2015-10-11 03:04:59 -04:00
redirect_from:
2021-06-16 01:33:51 -04:00
- /doc/qubes-iso-building/
2019-04-06 17:12:48 -04:00
- /doc/qubes-r3-building/
2015-10-28 18:14:40 -04:00
- /en/doc/qubes-r3-building/
2019-04-06 13:15:56 -04:00
- /en/doc/qubes-iso-building/
2015-10-11 03:04:59 -04:00
- /doc/QubesR3Building/
- /wiki/QubesR3Building/
2021-03-13 13:06:18 -05:00
ref: 63
2021-06-16 02:19:45 -04:00
title: Qubes ISO Building
2014-11-22 09:01:49 -05:00
---
2018-02-22 05:25:50 -05:00
Build Environment
-----------------
2020-09-22 06:36:51 -04:00
Fedora 32 has been successfully used to build Qubes R4.0 with the below steps.
2018-02-22 05:25:50 -05:00
Other rpm-based operating systems may also work.
2020-09-22 06:36:51 -04:00
Travis-CI uses Ubuntu 18.04 to perform test builds, except it can not test the `./setup` script.
2014-11-27 08:36:07 -05:00
2020-09-22 06:36:51 -04:00
In `dom0` , install the Fedora 32 template if you don't already have it.
2018-02-22 05:25:50 -05:00
2015-09-26 19:00:33 -04:00
~~~
2020-09-22 06:36:51 -04:00
sudo qubes-dom0-update qubes-template-fedora-32
2018-02-07 04:55:41 -05:00
~~~
2020-09-22 06:36:51 -04:00
Create a standalone AppVM from the Fedora 32 template.
2018-02-22 05:25:50 -05:00
Set private storage to at least 60 GB if you will be building only the default templates; 100 GB or more if you plan on additional.
2018-02-07 04:55:41 -05:00
It's not required, but if you allocate additional CPU cores, the build process can utilize them at some steps such as the kernel build.
2018-02-07 05:20:12 -05:00
Likewise, more memory (up to 16 GB) can help.
2019-04-06 13:15:56 -04:00
Last, you may want to disable memory balancing, but keep in mind the impact on your other qubes.
2018-02-07 04:55:41 -05:00
2019-04-06 13:15:56 -04:00
Once you've built the development AppVM, open a Terminal window to it and install the necessary dependencies (see [QubesBuilder ](/doc/qubes-builder/ ) for more info):
2018-02-07 04:55:41 -05:00
~~~
2020-09-22 06:36:51 -04:00
$ sudo dnf install git createrepo rpm-build rpm-sign make python3-sh rpmdevtools rpm-sign dialog perl-open python3-pyyaml perl-Digest-MD5 perl-Digest-SHA
2015-09-26 19:00:33 -04:00
~~~
2014-11-27 08:36:07 -05:00
2018-02-22 05:25:50 -05:00
Get the necessary keys to verify the sources (run these and other commands below as a regular user, not root):
2014-11-22 09:01:49 -05:00
2015-09-26 19:00:33 -04:00
~~~
2018-02-22 05:25:50 -05:00
wget https://keys.qubes-os.org/keys/qubes-master-signing-key.asc
2021-03-13 12:03:23 -05:00
gpg --import qubes-master-signing-key.asc
2018-02-22 05:25:50 -05:00
gpg --edit-key 36879494
2018-02-22 13:26:58 -05:00
fpr
# Verify fingerprint! See Note below!
# Once verified, set trust to *ultimate*
# (Typical sequence is trust, 5, q)
2018-02-22 05:25:50 -05:00
wget https://keys.qubes-os.org/keys/qubes-developers-keys.asc
gpg --import qubes-developers-keys.asc
2018-02-07 04:55:41 -05:00
~~~
**Note** In the above process, we do *not* rely on the security of our server (keys.qubes-os.org) nor the connection (ssl, cert) -- we only rely on you getting the Qubes Master Signing Key fingerprint *somehow* and ensuring they match!
2018-05-21 22:57:52 -04:00
See [Verifying Signatures ](/security/verifying-signatures/#1-get-the-qubes-master-signing-key-and-verify-its-authenticity ) for verification sources.
2018-02-07 04:55:41 -05:00
Now let's bootstrap the builder. Unfortunately, the builder cannot verify itself (the classic Chicken and Egg problem), so we need to verify the signature manually:
2014-11-22 09:01:49 -05:00
2015-09-26 19:00:33 -04:00
~~~
2018-02-22 05:25:50 -05:00
git clone git://github.com/QubesOS/qubes-builder.git
cd qubes-builder
git tag -v `git describe`
2015-09-26 19:00:33 -04:00
~~~
2014-11-22 09:01:49 -05:00
2018-02-22 05:25:50 -05:00
**Note** It's very important to check if the verification message contains "Good signature from ..." and does not contain "WARNING: This key is not certified with a trusted signature!".
2018-02-22 13:26:58 -05:00
Assuming the verification went fine, we're good to go with all the rest without ever thinking more about verifying digital signatures on all the rest of the components, apart from an additional step if doing a non-scripted build.
2018-02-07 04:55:41 -05:00
The builder will do that for us for each component, every time we build, even for all auxiliary files (e.g. Xen or Linux kernel sources).
2014-11-22 09:01:49 -05:00
2018-02-22 05:25:50 -05:00
Build using setup script
-----------------
2019-04-06 13:15:56 -04:00
Let's configure the builder first (see [procedure ](/doc/qubes-iso-building/#build-using-manual-steps ) at bottom if you would prefer to manually configure):
2014-11-22 09:01:49 -05:00
2015-09-26 19:00:33 -04:00
~~~
2018-02-22 05:25:50 -05:00
cd ~/qubes-builder
./setup
# Select Yes to add Qubes Master Signing Key
# Select Yes to add Qubes OS Signing Key
2019-04-06 13:15:56 -04:00
# Select 4.0 for version
2018-02-07 04:55:41 -05:00
# Stable
2020-09-22 06:36:51 -04:00
# Select Yes for fast Git cloning
2019-04-06 19:27:59 -04:00
# Select Current (if you want the option to use pre-built packages)
2020-09-22 06:36:51 -04:00
# Select No (we want a full build)
2020-02-22 19:36:50 -05:00
# Select fc30 and buster (for the currently shipping templates)
2019-04-06 13:15:56 -04:00
# Select builder-rpm, builder-debian, template-whonix, mgmt-salt
2020-09-22 06:36:51 -04:00
# Select Yes to add adrelanos's third party key
# Select Yes (to download)
2019-04-06 13:15:56 -04:00
~~~
Once it completes downloading, re-run `setup` to add the Whonix templates:
~~~
./setup
# Choose the same options as above, except at templates select:
2020-09-22 06:36:51 -04:00
# fc30, buster, whonix-gateway-15, whonix-workstation-15
2015-09-26 19:00:33 -04:00
~~~
2014-11-22 09:01:49 -05:00
2018-02-22 13:26:58 -05:00
Continue the build process with:
2014-11-22 09:01:49 -05:00
2015-09-26 19:00:33 -04:00
~~~
2018-02-22 05:25:50 -05:00
make install-deps
make get-sources
2018-02-07 04:55:41 -05:00
~~~
2019-04-06 19:27:59 -04:00
When building the Whonix templates, you will often need to add/update the `WHONIX_TBB_VERSION` variable in `builder.conf` at this stage to specify the currently shipping Tor Browser version.
2018-03-25 08:56:30 -04:00
See the related note under [Extra Whonix Build Options ](/doc/building-whonix-template/ ).
2019-04-06 19:27:59 -04:00
You may also want to add `COMPONENTS := $(filter-out gcc,$(COMPONENTS))` to bypass a multiple hour compile step.
See [QubesBuilder ](/doc/qubes-builder/#use-pre-built-qubes-packages ) for more detail.
2018-02-07 04:55:41 -05:00
Finally, if you are making a test build, use:
~~~
2018-02-22 05:25:50 -05:00
make qubes
make iso
2018-02-07 04:55:41 -05:00
~~~
2018-02-22 13:26:58 -05:00
Or for a fully signed build (this requires setting `SIGN_KEY` in `builder.conf` ):
2018-02-07 04:55:41 -05:00
~~~
2018-02-22 05:25:50 -05:00
make qubes
make sign-all
make iso
2015-09-26 19:00:33 -04:00
~~~
2014-11-22 09:01:49 -05:00
Enjoy your new ISO!
2018-02-07 04:55:41 -05:00
2018-02-22 05:25:50 -05:00
Build using manual steps
-----------------
Instead of using `./setup` , you can manually configure the build.
The script takes care of a lot of the keyring preparation for us, so we first need to set that up.
If you will be building Whonix templates:
~~~
cd ~
gpg --keyserver pgp.mit.edu --recv-keys 916B8D99C38EAF5E8ADC7A2A8D66066A2EEACCDA
gpg --fingerprint 916B8D99C38EAF5E8ADC7A2A8D66066A2EEACCDA
~~~
2018-02-22 13:26:58 -05:00
**Note:** It's very important to check the fingerprint displayed against multiple sources such as the [Whonix web site ](https://www.whonix.org/wiki/Whonix_Signing_Key ), etc.
2018-02-22 05:25:50 -05:00
It should look something like this:
~~~
pub 4096R/2EEACCDA 2014-01-16 [expires: 2021-04-17]
Key fingerprint = 916B 8D99 C38E AF5E 8ADC 7A2A 8D66 066A 2EEA CCDA
uid Patrick Schleizer < adrelanos @ riseup . net >
sub 4096R/CE998547 2014-01-16 [expires: 2021-04-17]
sub 4096R/119B3FD6 2014-01-16 [expires: 2021-04-17]
sub 4096R/77BB3C48 2014-01-16 [expires: 2021-04-17]
~~~
Next, prepare the Git keyring directory and copy them in:
~~~
export GNUPGHOME=~/qubes-builder/keyrings/git
mkdir --parents "$GNUPGHOME"
cp ~/.gnupg/pubring.gpg "$GNUPGHOME"
cp ~/.gnupg/trustdb.gpg "$GNUPGHOME"
chmod --recursive 700 "$GNUPGHOME"
~~~
Copy one of the example configurations:
~~~
2018-02-22 06:42:45 -05:00
cd ~/qubes-builder
2018-02-22 05:25:50 -05:00
cp example-configs/qubes-os-master.conf builder.conf
~~~
2018-02-22 13:26:58 -05:00
Edit `builder.conf` , referring to `doc/Configuration.md` for a description of all available options.
2018-02-22 05:25:50 -05:00
2018-02-22 13:26:58 -05:00
Continue the build process with:
2018-02-22 05:25:50 -05:00
~~~
make install-deps
make get-sources
2018-02-22 13:26:58 -05:00
unset GNUPGHOME
2018-02-22 05:25:50 -05:00
~~~
2018-02-07 04:55:41 -05:00
2018-03-25 08:56:30 -04:00
When building the Whonix templates, you will often need to add/update the `WHONIX_TBB_VERSION` variable at this stage to specify the currently shipping Tor Browser version.
See the related note under [Extra Whonix Build Options ](/doc/building-whonix-template/ ).
2018-02-22 05:25:50 -05:00
Finally, if you are making a test build, use:
~~~
make qubes
make iso
~~~
2018-02-22 13:26:58 -05:00
Or for a fully signed build (this requires setting `SIGN_KEY` in `builder.conf` ):
2018-02-22 05:25:50 -05:00
~~~
make qubes
make sign-all
make iso
~~~
Enjoy your new ISO!