apt-fast is a shell script wrapper for apt-get and aptitude that can drastically improve apt download times by downloading packages in parallel, with multiple connections per package.
sudo add-apt-repository ppa:apt-fast/stable
sudo apt-get update
sudo apt-get -y install apt-fastYou can use the Ubuntu PPA to get a graphical configuration file setup and automatic updates, for details see:
Some distros, such as PCLinuxOS, include apt-fast in their repositories. However, if not included like in Debian or Kali Linux, then the PPA can be manually added by creating a new file /etc/apt/sources.list.d/apt-fast.list:
deb [signed-by=/etc/apt/keyrings/apt-fast.gpg] http://ppa.launchpad.net/apt-fast/stable/ubuntu focal main
To retrieve the signed keys and install apt-fast, execute the following commands as root:
mkdir -p /etc/apt/keyrings
curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xBC5934FD3DEBD4DAEA544F791E2824A7F22B44BD" | gpg --dearmor -o /etc/apt/keyrings/apt-fast.gpg
apt-get update
apt-get install apt-fastNote that the PPA version jammy might need to be updated with the recent Ubuntu LTS codename to stay up-to-date.
See the release list for possible LTS codenames to try.
To install apt-fast without interaction, execute the following commands as root after adding the package sources to the sources.list as instructed above:
DEBIAN_FRONTEND=noninteractive apt-get install -y apt-fastTo update specific configuration values, use the debconf command line interface as root, e.g.:
echo debconf apt-fast/maxdownloads string 16 | debconf-set-selections
echo debconf apt-fast/dlflag boolean true | debconf-set-selections
echo debconf apt-fast/aptmanager string apt-get | debconf-set-selectionsYou can quickly install apt-fast by running:
/bin/bash -c "$(curl -sL https://git.io/vokNn)"A manual install can be performed as such:
cp apt-fast /usr/local/sbin/
chmod +x /usr/local/sbin/apt-fast
cp apt-fast.conf /etcYou need to have aria2c installed:
apt-get install aria2Then run apt-fast instead of apt-get or aptitude.
The completions for the respective shells use the existing apt-get completion. It is required that the apt-get completion be installed. In the case of Bash, the package bash-completion is required. For Zsh and Fish, the required completions are included by default (in their *-common packages).
apt-get install bash-completion
cp completions/bash/apt-fast /etc/bash_completion.d/
chown root:root /etc/bash_completion.d/apt-fast
. /etc/bash_completioncp 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-fastcp completions/fish/apt-fast.fish /etc/fish/conf.d/completions/
chown root:root /etc/fish/conf.d/completions/apt-fast.fish
source /etc/fish/conf.d/completions/apt-fast.fishmkdir -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.5The apt-fast configuration file is located at: /etc/apt-fast.conf
_APTMGR=apt-getChange package manager used for installation. Supported are apt-get, aptitude, apt.
Note: When using Linux Mint, don't use apt because the distributor provides a custom shell script with different functionality unsupported by apt-fast.
DOWNLOADBEFORE=trueSet this to any value to suppress the apt-fast confirmation dialog and download packages directly. Leave empty to ask for confirmation. This option doesn't affect package manager confirmation.
Adding multiple mirrors will further speed up downloads and distribute load. Be sure to add mirrors near your location. Official mirror lists:
Then add them to the whitespace- and comma-separated list in the config file, e.g.:
MIRRORS=( 'http://deb.debian.org/debian','http://ftp.debian.org/debian, http://ftp2.de.debian.org/debian, http://ftp.de.debian.org/debian, ftp://ftp.uni-kl.de/debian' )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 as well!
_MAXNUM=5Set to the maximum number of connections aria2c uses.
_MAXCONPERSRV=10Set to the maximum number of connections per server aria2c uses.
_SPLITCON=8Set to the maximum number of connections per file aria2c uses.
_MINSPLITSZ=1MSet to the size of each split piece. Possible values: 1M-1024M
_PIECEALGO=defaultSet to the piece selection algorithm to use. Possible values: default, inorder, geom
DLLIST='/tmp/apt-fast.list'Location of the aria2c input file, used to download the packages with options and checksums.
_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.
apt-fast uses APT's proxy settings (Acquire::http::proxy, Acquire::https::proxy, Acquire::ftp::proxy) and if those are not available, the environment settings (http_proxy, https_proxy, ftp_proxy). Refer to APT's or the system's documentation.
DLDIR='/var/cache/apt/apt-fast'Directory where apt-fast (temporarily) downloads the packages.
APTCACHE='/var/cache/apt/archives'Directory where apt-get and aptitude download packages.
APT_FAST_APT_AUTH=1Try to authenticate packages from sources that require login.
VERBOSE_OUTPUT=yShow aria2 download file instead of package listing before download confirmation. Unset to show package listing.
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 for a list of possible values. Disabled when not using terminal.
Consider apt-fast and all of its derivatives licensed under the GNU GPLv3+.
Copyright: 2008-2012 Matt Parnell
Improvements, maintenance, revisions - 2012, 2017-2019 Dominique Lasserre
- Travis/travisn000 - support for complex apt-get commands
- Alan Hoffmeister - 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