APT is a collection of tools for managing the installation of software packages on Debian based Linux distributions, including Ubuntu and Raspbian.
The following instructions show you how to only install the required packages, free up disk space by removing support for unused locales, and (if necessary) connect using a proxy server.
Skip optional packages
By configuring APT not to download the details of any source packages and not to install any recommended or suggested packages, you can minimize the amount of disk space required by the system. You may occasionally find that some functionality you were expecting is ‘missing’ but this is usually solved by tracking down the additional optional package or packages required, and installing them separately.
As a beginner when I decided not to install everything automatically there were times when this did cause some minor issues, but as a result I do now know a bit more about how Linux works and what does what than I would have done otherwise. These days it is much less troublesome, probably because package maintainers are doing a better job of identifying all the required packages that their software depends on.
To modify the configuration you need to be running as a superuser.
$ sudo -i
# vi /etc/apt/sources.list
deb http://ftp.uk.debian.org/debian/ wheezy main contrib
# deb-src http://ftp.uk.debian.org/debian/ wheezy main
deb http://security.debian.org/ wheezy/updates main contrib
# deb-src http://security.debian.org/ wheezy/updates main
deb http://ftp.uk.debian.org/debian/ wheezy-updates main contrib
# deb-src http://ftp.uk.debian.org/debian/ wheezy-updates main
# vi /etc/apt/apt.conf.d/10norecommends
# vi /etc/apt/apt.conf
Removing unwanted locales
To reduce the amount of system resources used by each software package we can delete the language specific files associated with the locales we are not using. To do this we need to install a utility called localepurge.
# apt-get install localepurge
Reading package lists... Done
Building dependency tree
Creating config file /etc/locale.nopurge with new version
localepurge: Disk space freed in /usr/share/locale: 46820 KiB
localepurge: Disk space freed in /usr/share/man: 3604 KiB
Total disk space freed by localepurge: 50424 KiB
Using a web proxy
If you are behind a proxy server you can either export the proxy settings as environment variables (see below) or include the proxy settings a configuration file. For recent Debian or Raspbian distributions (squeeze wheezy jessie) use the following command to create a new file.
# vi /etc/apt/apt.conf.d/01Proxy
# vi /etc/apt/apt.conf
# export http_proxy=http://username:password@proxy:port
# export ftp_proxy=ftp://username:password@proxy:port
# export https_proxy=https://username:password@proxy:port
# apt-get install package-name