[pt-br] Update translation bits.
[tails-test.git] / wiki / src / contribute / build / squid-deb-proxy.mdwn
blob70bb47a2e23af969c3c723d4d2bfa421a01e68e6
1 [[!meta title="Using squid-deb-proxy to build Tails images"]]
3 [[!toc levels=2]]
5 # Why?
7 The Debian mirrors live-build uses are very much configurable (see
8 [[build/custom_mirror]]), but Tails uses some non-Debian APT
9 repositories whose location cannot be adapted to your build
10 environment using only live-build settings.
12 Moreover, some packages fetch data online over HTTP at install time
13 i.e. at Tails build time.
15 Both of these factors make it hard to build Tails offline... unless
16 you have a HTTP proxy with all necessary files cached on disk, that is
17 able to switch to offline mode.
19 # How?
21 ## Install and configure squid-deb-proxy
23 squid-deb-proxy is a Debian proxy solution based on Squid with a
24 tweaked configuration. It has a [homepage on
25 Launchpad](https://launchpad.net/squid-deb-proxy) and packages in
26 Ubuntu.
28 On the other hand, we've found the upstream and Ubuntu packages to
29 require many changes to be usable in Debian and especially for Tails
30 purposes. Until we manage to turn our changes into a proper Debian
31 package and make them generic enough to be pushed upstream, we
32 recommend using the installation instructions bellow.
34 1. Install necessary dependencies:
36            apt-get install squid3
38 2. Create the necessary directories:
40            install -o root  -g root -m 00755 -d /etc/squid-deb-proxy
41            install -o proxy -g root -m 00750 -d /var/cache/squid-deb-proxy
42            install -o proxy -g root -m 00750 -d /var/log/squid-deb-proxy
44 3. Install the attached configuration files; all shall be owned by
45    `root:root` and have `00644` permissions unless otherwise noted:
47  * [[/etc/squid-deb-proxy/squid-deb-proxy.conf|squid-deb-proxy/squid-deb-proxy.conf]]
48    is the main configuration file passed to Squid3.
49  * [[/etc/squid-deb-proxy/allowed-networks-src.acl|squid-deb-proxy/allowed-networks-src.acl]]
50    lists the network sources that are allowed to access the cache
51  * [[/etc/squid-deb-proxy/mirror-dstdomain.acl|squid-deb-proxy/mirror-dstdomain.acl]]
52    lists the network destinations the proxy is allowed to reach
53  * [[/etc/init.d/squid-deb-proxy|squid-deb-proxy/squid-deb-proxy]] is
54    the initscript; it needs to be made executable.
56 4. Adapt the configuration for your needs:
58  * The example `cache_mem` setting shall be changed depending on the
59    amount of RAM your build machine has
60  * The example `cache_dir` has a 10G limit that is a bit high if you
61    only want to use squid-deb-proxy to build Tails.
63 5. Have the proxy start on boot:
65            update-rc.d squid-deb-proxy defaults
67 6. Start the proxy:
69            invoke-rc.d squid-deb-proxy start
71 ## Use the proxy for live-build and APT
73 You need to set a few options in live-build's configuration file
74 (`/etc/live/build.conf`).
76 First, the following line asks live-build to use the configured proxy
77 for any use of APT it makes:
79         LB_APT_HTTP_PROXY="http://127.0.0.1:8000/"
81 Second, you probably need to [[ask live-build to use a custom Debian
82 mirror|build/custom_mirror]] to fit the destination domain
83 restrictions you set previously up.
85 ## Use the proxy for non-APT purposes
87 Export the `http_proxy='http://127.0.0.1:8000/'` environment variable
88 in the (root) shell you want to run the build in. This way, HTTP
89 requests that are made by anyone else than APT during the build will
90 use the configured Squid proxy.
92 ## Build offline
94 Un-comment the settings in the *Offline mode* section at the end of
95 `/etc/squid-deb-proxy/squid-deb-proxy.conf`.