apt-get prompts for CDs when installing packages, how do I make it stop?

37,389

Package sources are listed in /etc/apt/sources.list and /etc/apt/sources.list.d/*.list. Usually you would list official sources in the main file /etc/apt/sources.list and add third-party repositories in /etc/apt/sources.list.d/indicative_name.list.

If you installed from CD-ROM, there'll be a line with

deb cdrom:[some name]/ stable main

Remove it or comment it out (by adding a # at the beginning of the line). If you ever want to install from CD-ROM again, pop the CD in and run apt-cdrom to create a sources.list entry from that CD-ROM.

To install packages over the Internet, you would typically list a Debian mirror as a source. The system installation does this if you have an Internet connection. A typical set of entries look like this:

## Debian stable proper
deb http://ftp.fr.debian.org/debian squeeze main non-free contrib
deb-src http://ftp.fr.debian.org/debian squeeze main non-free contrib

## Security updates
deb http://security.debian.org/ squeeze/updates main contrib non-free
deb-src http://security.debian.org/ squeeze/updates main contrib non-free

## Other updates to the stable release (formerly volatile)
deb http://ftp.fr.debian.org/debian squeeze-updates main contrib non-free
deb-src http://ftp.fr.debian.org/debian squeeze-updates main contrib non-free

## Quasi-official backports
deb http://www.backports.org/debian/ squeeze-backports main non-free contrib
deb-src http://www.backports.org/debian/ squeeze-backports main non-free contrib

## Marillat: multimedia support and other less free or stable stuff
deb http://www.debian-multimedia.org squeeze main
deb-src http://www.debian-multimedia.org squeeze main
  • Replace squeeze by testing or unstable or whatever distribution you follow.
  • Remove contrib and non-free if you want to install free software exclusively.
  • If you don't live in France, replace ftp.fr.debian.org by the name of another Debian mirror.
  • The deb lines are for binary packages, the deb-src lines are for source packages. If you never want to download sources, you don't need the deb-src lines. If you do, you need a deb-src line to match each deb line.
  • Only two sources are strictly necessary: the distribution proper (protocol://mirror.example.com/debian release_name main) and security updates (deb http://security.debian.org/ release_name/updates). Include the others only if you want them:

    • stable-updates are updates of databases that need to be kept current, such as virus signature lists. Applies to the stable release only.
    • Backports are pacakges from unstable that are recompiled for stable. Even if you include this source, the packages will only be installed on explicit request: if a package also has a version outside backports, the non-backports version will be preferred even if it's older. Applies to the stable release only.
    • Debian multimedia has packages that don't meet the legal requirements of the main distribution. They're mainly useful for desktop machines, to support more audio and video formats.

There are many other unofficial repositories if you're after a specific application.

Share:
37,389

Related videos on Youtube

Shang Wang
Author by

Shang Wang

(╯°□°)╯︵ ┻━┻

Updated on September 18, 2022

Comments

  • Shang Wang
    Shang Wang over 1 year

    I used ubuntu linux before, and I installed debian OS on my labtop using DVDs that I burned. But when I'm trying to use apt-get to install software, the system always asks me to insert disk to proceed. I wonder if there is a way to change the repository configuration so that I can retrieve installation files online instead of using disks.

    • Admin
      Admin almost 13 years
      I just found out that it's the sources.list file that have caused the problem. But after I comment the "deb cdrom" thing, I'm no longer able to get any software update :( Does anyone have a nice sources.list file?
  • Shang Wang
    Shang Wang almost 13 years
    you r awesome, gilles!!