~apt-fast/apt-fast/apt-fast-ro

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<!---
apt-fast v1.8
Use this just like aptitude or apt-get for faster package downloading.

Copyright: 2008-2012 Matt Parnell, http://www.mattparnell.com
Improvements, maintenance, revisions - 2012 Dominique Lasserre

You may distribute this file under the terms of the GNU General
Public License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
-->

apt-fast 1.8
============
apt-fast is a shellscript wrapper for apt-get and aptitude that can drastically improve apt download times by downloading packages in parallel, with multiple connections per package.

## Table of Contents

- [Installation](#installation)
  - [Ubuntu PPA](#ubuntu-ppa)
  - [Quick Install](#quick-install)
  - [Manual](#manual)
  - [Autocompletion](#autocompletion)
    - [Bash](#bash)
    - [Zsh](#zsh)
  - [Man page installation](#man-page-installation)
- [Configuration](#configuration)
  - [Package manager](#package-manager)
  - [Confirmation dialog](#confirmation-dialog)
  - [Multiple mirrors](#multiple-mirrors)
  - [Maximum connections](#maximum-connections)
  - [Maximum connections per server](#maximum-connections-per-server)
  - [Maximum connections per file](#maximum-connections-per-file)
  - [File split size](#file-split-size)
  - [Piece selection algorithm](#piece-selection-algorithm)
  - [Downloadmanager file](#downloadmanager-file)
  - [Downloadmanager command](#downloadmanager-command)
    - [Proxy](#proxy)
  - [Download folder](#download-folder)
  - [APT archives cache](#apt-archives-cache)
  - [Colors](#colors)
- [License](#license)
- [Special thanks](#special-thanks)

Installation
------------

```sh
sudo add-apt-repository ppa:apt-fast/stable
sudo apt-get update
sudo apt-get -y install apt-fast
```

### Ubuntu PPA ###
You can use the Ubuntu PPA to get a graphical configuration file setup and automatic updates, for details see:

* [ppa:apt-fast/stable](https://code.launchpad.net/~apt-fast/+archive/stable)

Some distros, such as PCLinuxOS include apt-fast in their repos.

### Quick Install ###
You can quickly install `apt-fast` by running:

```bash
/bin/bash -c "$(curl -sL https://git.io/vokNn)"
```

### Manual ###
A manual install can be performed as such:

```sh
cp apt-fast /usr/local/sbin/
chmod +x /usr/local/sbin/apt-fast
cp apt-fast.conf /etc
```

You need to have [aria2c](http://aria2.sourceforge.net/) installed:

```sh
apt-get install aria2
```

Then simply run apt-fast instead of apt-get or aptitude.


### Autocompletion ###
#### Bash ####

```sh
cp completions/bash/apt-fast /etc/bash_completion.d/
chown root:root /etc/bash_completion.d/apt-fast
. /etc/bash_completion
```

#### Zsh ####

```sh
cp completions/zsh/_apt-fast /usr/share/zsh/functions/Completion/Debian/
chown root:root /usr/share/zsh/functions/Completion/Debian/_apt-fast
source /usr/share/zsh/functions/Completion/Debian/_apt-fast
```

### Man page installation ###

```sh
mkdir -p /usr/local/share/man/man8/
cp ./man/apt-fast.8 /usr/local/share/man/man8
gzip -f9 /usr/local/share/man/man8/apt-fast.8
mkdir -p /usr/local/share/man/man5/
cp ./man/apt-fast.conf.5 /usr/local/share/man/man5
gzip -f9 /usr/local/share/man/man5/apt-fast.conf.5
```

Configuration
-------------
The apt-fast configuration file is located at: `/etc/apt-fast.conf`


### Package manager ###
```sh
_APTMGR=apt-get
```
Change package manager used for installation. Supported are apt-get, aptitude, apt.


### Confirmation dialog ###
```sh
DOWNLOADBEFORE=true
```
To suppress apt-fast confirmation dialog and download packages directly set this to any value. To ask for confirmation, leave empty. This options doesn't affect package manager confirmation.


### Multiple mirrors ###
Adding multiple mirrors will further speed up downloads and distribute load, be sure to add mirrors near to your location.
Official mirror lists:

* Debian: http://www.debian.org/mirror/list
* Ubuntu: https://launchpad.net/ubuntu/+archivemirrors

Then add them to whitespace and comma separated list in config file, e.g.:

```sh
MIRRORS=( 'http://ftp.debian.org/debian, http://ftp2.de.debian.org/debian, http://ftp.de.debian.org/debian, ftp://ftp.uni-kl.de/debian' )
```

```sh
MIRRORS=( 'http://archive.ubuntu.com/ubuntu, http://de.archive.ubuntu.com/ubuntu, http://ftp.halifax.rwth-aachen.de/ubuntu, http://ftp.uni-kl.de/pub/linux/ubuntu, http://mirror.informatik.uni-mannheim.de/pub/linux/distributions/ubuntu/' )
```

*NOTE:* To use any mirrors you may have in sources.list or sources.list.d you will need to add them to the apt-fast.conf mirror list.


### Maximum connections ###
```sh
_MAXNUM=5
```
Set to maximum number of connections aria2c uses.


### Maximum connections per server ###
```sh
_MAXCONPERSRV=10
```
Set to maximum number of connections per server aria2c uses.


### Maximum connections per file ###
```sh
_SPLITCON=8
```
Set to maximum number of connections per file aria2c uses.


### File split size ###
```sh
_MINSPLITSZ=1M
```
Set to size of each split piece. Possible values: 1M-1024M


### Piece selection algorithm ###
```sh
_PIECEALGO=default
```
Set to piece selection algorithm to use. Possible values: default, inorder, geom


### Downloadmanager file ###
```sh
DLLIST='/tmp/apt-fast.list'
```
Location of aria2c input file, used to download the packages with options and checksums.


### Downloadmanager command ###
```sh
_DOWNLOADER='aria2c --no-conf -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} -i ${DLLIST} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} --connect-timeout=600 --timeout=600 -m0'
```
Change the download manager or add additional options to aria2c.

#### Proxy ####
```sh
_DOWNLOADER='aria2c --no-conf -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} --http-proxy=http://username:password@proxy_ip:proxy_port -i ${DLLIST}'
```
To use apt-fast behind a proxy, use `--http-proxy` option of aria2c and set username, password and proxy_port accordingly.


### Download folder ###
```sh
DLDIR='/var/cache/apt/archives/apt-fast'
```
Directory where apt-fast downloads the packages.


### APT archives cache ###
```sh
APTCACHE='/var/cache/apt/archives'
```
Directory where apt-get and aptitude download packages.


### Colors ###
```sh
cGreen='\e[0;32m'
cRed='\e[0;31m'
cBlue='\e[0;34m'
endColor='\e[0m' 
```
Terminal colors used for dialogs. Refer to [ANSI Escape sequences](http://ascii-table.com/ansi-escape-sequences.php) for a list of possible values. Disabled when not using terminal.


License
-------
Consider apt-fast and all of its derivatives licensed under the GNU GPLv3+.

Copyright: 2008-2012 Matt Parnell, http://www.mattparnell.com
Improvements, maintenance, revisions - 2012 Dominique Lasserre


Special thanks
--------------
 * Travis/travisn000 - support for complex apt-get commands
 * [Alan Hoffmeister](https://github.com/alanhoff) - aria2c support
 * Abhishek Sharma - aria2c with proxy support
 * Luca Marchetti - improvements on the locking system and downloader execution
 * Richard Klien - Autocompletion, Download Size Checking (made for on ubuntu, untested on other distros)
 * Patrick Kramer Ruiz - suggestions
 * Sergio Silva - test to see if axel is installed, root detection/sudo autorun, lock file check/creation
 * Waldemar {BOB}{Burnfaker} Wetzel - lockfile improvements, separate config file
 * maclarke - locking improvements