1 [[!meta title="Building a Tails image"]]
10 Tails can be built easily in a virtual machine using [Rake], [Vagrant] and
11 [VirtualBox]. The process requires a minimum of 1 GB of free memory and a
12 maximum of 10 GB of free storage.
14 [Rake]: http://rake.rubyforge.org/
15 [Vagrant]: http://vagrantup.com/
16 [VirtualBox]: http://www.virtualbox.org/
18 Set up the build environment on Debian Jessie:
20 1. Add Debian unstable to your APT sources.
21 2. Pin all packages from Debian unstable at 500 (`apt_preferences(5)`).
22 3. Install the needed tools:
24 $ sudo apt-get install git virtualbox rake vagrant/unstable
28 1. Add Debian Jessie and unstable to your APT sources.
29 2. Pin all packages from Debian Jessie and unstable at 500 (`apt_preferences(5)`).
30 3. Install the needed tools:
32 $ sudo apt-get install git virtualbox rake vagrant/unstable \
33 ruby-childprocess/jessie ruby-net-scp/jessie ruby-net-ssh/jessie
37 $ git clone git://git.tails.boum.org/tails
40 $ export TAILS_BUILD_OPTIONS="noproxy"
42 $ unset TAILS_BUILD_OPTIONS
44 The first time, this can take a little while to download the base virtual
45 machine from Tails mirror (around 300 MB). It will then boot the machine,
46 set it up and start the build process. When done, several `tails-*` files
47 should appear in the current directory.
49 After you are done working on Tails, do not forget to shut the virtual
54 One may also want to [[contribute/customize]] their image before building.
56 To know all available Rake tasks, please run `rake -T`.
61 If you have a local HTTP proxy, the build system will use it as long as
62 you properly set the `http_proxy` environment variable. The easiest way to
65 $ export http_proxy=http://proxy.lan:3142
67 This needs to be done before any other operations.
72 Options regarding the build process can be set using the
73 `TAILS_BUILD_OPTIONS` environment variable. Muliple options must be
74 separated by whitespaces.
76 The following options are available:
78 ### Memory build settings
80 Tails builds way faster when everything is done in memory. If your computer
81 runs Linux and happens to have more than 6.5 GB of free memory before you
82 start the virtual machine, it will automatically switch to 'build in RAM'
85 To force a specific behaviour please set:
87 * **ram**: start the virtual machine with 6.5GB of memory, build Tails
88 inside a `tmpfs`. Build fails if the system is not in a proper state to
90 * **noram**: start the virtual machine with 1GB of memory if not already
91 done, build Tails using the virtual machine hard disk.
93 ### HTTP proxy settings
95 Building Tails requires downloading a little bit more than 1 GB of Debian
96 packages. To preserve bandwidth and developer sanity, using a HTTP proxy is
97 nearly a must. Tails virtual machine contains a fully configured local HTTP
98 proxy that will be used if no other local proxy is defined.
100 The following flags can be used to force a specific behaviour:
102 * **extproxy**: use the proxy configured through the `http_proxy`
103 environment variable. Fail if it is not set.
104 * **vmproxy**: use the local proxy configured in the virtual machine even
105 if a local HTTP proxy is set.
106 * **noproxy**: do not use any HTTP proxy.
108 ### Bootstrap cache settings
110 A Tails build starts with `debootstrap`:ing a minimal Debian system
111 which then is modified into a full Tails system. This is a rather time
112 consuming step that usually does not have to be done: the packages used
113 in it rarely get updated and hence the result is exactly the same most
116 The following flags can be used to force a specific behaviour:
118 * **cache**: re-use a cached bootstrap stage (if available), and saves
119 the bootstrap stage to disk on successful build. This will also
120 reduce the amount of memory required for in-memory builds by around
121 150 MiB (see the **ram** option above). **Warning:** this option may
122 create subtle differences between builds from the exact same Tails
123 source which are hard to track to track and understand. Use this
124 option only if you know what you are doing, and if you are not
125 building an actual release.
126 * **nocache**: do the bootstrap stage from scratch (default).
128 ### SquashFS compression settings
130 One of the most expensive operations when building Tails is the creation
131 of the final SquashFS. It also depends on the compression algorithm used.
132 When working on the `stable` or `testing` branch, the image will be made
133 using the slow but efficient default. Any other setup will switch to the
136 Forcing a specific behaviour can be done using:
138 * **gzipcomp**: always use *gzip* to create the SquashFS.
139 * **defaultcomp**: always use the default compression algorithm.
141 ### Clean-up settings
143 Some operations are preserved accross builds. Currently they are:
145 * The wiki (for documentation).
146 * The bootstrap stage cache (see the **cache** option above).
148 In case you want to delete all these, the following option is available:
150 * **cleanall**: force a clean up before starting the build.
152 ### Virtual CPUs settings
154 The number of virtual CPUs that are allocated in the virtual machine can be set
157 * **cpus=_n_**: allocate _n_ CPUs to the virtual machine.
159 Obviously you should not allocate more virtual CPUs than the number of cores
160 available to the host system. When using Linux, the number of CPUs allocated
161 will default to be the same as the host system.
165 The build system can only work on files that have been *commited* to the Git
166 repository. By default, it will refuse to start a build in presence of
167 uncommited changes. This behaviour can be controlled by:
169 * **ignorechanges**: allow to make a build that will ignore changes in the Git
174 The fastest build you could pretend to get can be done by setting:
176 export TAILS_BUILD_OPTIONS="ram cache extproxy gzipcomp"
178 This will force the build to happen in RAM and allow skipping the
179 boostrap stage if one is cached, and will use use an HTTP proxy
180 external to the virtual machine, and SquashFS compression will be done
188 In order to build Tails manually, you need a running [Debian
189 Wheezy](https://www.debian.org/releases/wheezy/) system
190 and some [backports](http://backports.debian.org/). Anything else
196 The following Debian packages need to be installed:
198 * our `live-build` 2.x package, adapted for Wheezy. Its version is
199 something like *3.0.5+really+is+2.0.12-0.tails1*. One can install it
202 deb http://deb.tails.boum.org/ builder-wheezy main
204 This APT repository's signing key can be found on the keyservers.
205 It is certified by the [[!tails_website tails-signing.key
206 desc="Tails signing key"]], and its fingerprint is:
208 221F 9A3C 6FA3 E09E 182E 060B C798 8EA7 A358 D82E
211 * `eatmydata`, `time` and `whois` (for `/usr/bin/mkpasswd`)
212 * `ikiwiki` 3.20120725 or newer, available in wheezy-backports.
213 * `apt-get install libyaml-perl libyaml-libyaml-perl po4a perlmagick
214 libyaml-syck-perl` so that the wiki builds smoothly.
221 Add these lines to `/etc/live/build.conf`:
223 LB_PARENT_MIRROR_BINARY="http://ftp.us.debian.org/debian/"
224 LB_MIRROR_BINARY="http://ftp.us.debian.org/debian/"
229 Every build command must be run as `root`, at the root of a clone of the
230 [[`tails` repository|git]].
232 In short, a build shall be done using:
234 # lb clean --all && lb config && lb build
236 Running `lb config` or `lb build` in an environment that wasn't full
237 cleaned first is not supported.
239 ### Customize the build process if needed
241 If you need to set custom build settings that are specific to your
242 local environment, such as a custom Debian mirror or APT proxy, you
243 probably want to configure live-build a bit.
245 The most common customizations are documented on this wiki:
247 * to avoid compressing the SquashFS using XZ (efficient, but very
248 slow), `export MKSQUASHFS_OPTIONS='-comp gzip'` in your
250 * [[using a custom Debian mirror to build Tails
251 images|build/custom_mirror]];
252 * [[using squid-deb-proxy to build Tails images|build/squid-deb-proxy]]
253 (**Note**: most Tails contributors using the manual build method
254 use [[!debpts apt-cacher-ng]] instead, nowadays.)
256 More documentation about this can be found in the [Debian Live
257 Manual](http://live.debian.net/manual-2.x/html/live-manual.en.html).
262 More documentation about the build process can be found in the [Debian
263 Live Manual](http://live.debian.net/manual/oldstable/html/live-manual.en.html).
268 [[!map pages="contribute/build/*"]]