How to speed up slow apt-get install on Debian or Ubuntu

If you feel that package installation by apt-get or aptitude is often too slow on your Debian or Ubuntu system, there are several ways to improve the situation. One option is to use apt-fast, which is actually a shell script wrapper written around apt-get and aptitude, and can accelerate package download speed.