How to install Debian packages via internet instead of from a CD?

10,021

apt-get (like all other APT-based software: aptitude, synaptic, etc.) looks for packages in the places mentioned in the file /etc/apt/sources.list. In addition, files in the directory /etc/apt/sources.list.d are used (if their name isn't too “weird”).

Edit the file /etc/apt/sources.list to remove or comment out the line refering to the Debian CD. To comment out a line, add the character # at the beginning. You'll need to be root to edit that file. If you use nano, make sure not to inadvertently introduce a newline due to word wrap (run nano -w /etc/apt/sources.list, or press Alt+L to disable word wrap if it's enabled).

You'll need to have Internet package sources instead. Depending on options you picked during installations, they may or may not be already present. Even if they're present, the CD takes precedence for packages that are on the CD, if there is a line refering to the CD.

Here are some typical lines for network sources. Replace ftp.fr.debian.org by a mirror near you.

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

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

## Other updates
deb http://ftp.fr.debian.org/debian stretch/updates main non-free contrib
deb-src http://ftp.fr.debian.org/debian stretch/updates main non-free contrib

Once you've edited the sources.list file, run (as root) the command

apt-get update

Now you can install packages from the Internet.

Share:
10,021

Related videos on Youtube

Gilles 'SO- stop being evil'
Author by

Gilles 'SO- stop being evil'

Updated on September 18, 2022

Comments

  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 1 year

    When I enter root to install sudo on Debian Testing I type this:

    apt-get install sudo
    

    Which returns this:

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following NEW packages will be installed:
      sudo
    0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
    Need to get 0 B/920 kB of archives.
    After this operation, 2,895 kB of additional disk space will be used.
    Media change: please insert the disc labeled
     'Debian GNU/Linux testing _Stretch_ - Official Snapshot amd64 xfce-CDBinary-1 20150518-05:36'
    in the drive '/media/cdrom/' and press enter
    

    How would I install sudo onto Debian here over the Internet?

    • Admin
      Admin almost 9 years
      What does /etc/apt/sources.list contain?
    • Admin
      Admin almost 9 years
      Note that "Stretch" is the code name for the next release, currently in testing and in no way, shape or form production ready as the current stable release is barely a few months old. If you're unfamiliar with debian as your question suggests, I highly recommend sticking with Jessie for now.
  • McSinyx
    McSinyx almost 9 years
    And also to stick with testing, replace stretch with testing.