Say for example I wish to install the latest Debian package "libgcc1" for Jessie on AMD64.

How can I determine the correct URL to download from https://packages.debian.org

For example, in this case, clicking manually through the https://packages.debian.org website gets me ultimately to the correct download, which is:


IMPORTANT NOTE: I do NOT have apt available. I am writing some code that manually extracts the dependency names from .deb packages, but I am now stuck trying to work out the next steps, which is to get the correct actual .deb package for the package name.

So for example I need to go from these bits of information:

  • package name: libgcc1
  • version: latest
  • architecture: amd64
  • debian release: jessie



How can I determine this relationship?

EDIT: for all the people asking "Why not use apt?", the answer is that the core problem I am trying to solve is to install apt. I can't use apt because I am trying to install apt.


  • 1
    Don't forget you really should be considering the security updates, too, which are in a separate repository package list – roaima Dec 26 '16 at 11:44
  • 2
    Re: your edit: A Debian system without such an essential package as apt is very broken. Either (1) fix it by downloading apt using apt from elsewhere (maybe even using debootstrap?), or (2) reinstall, or (3) find and install apt by hand with a web browser, then install other packages using apt. – Celada Dec 26 '16 at 21:32
  • 2
    debootstrap --variant=minbase is your best bet then — it only installs essential packages and apt. That's the absolute barest minimum you can have with a working apt and guaranteed working packages when you do install them later (I'm assuming that you want apt so you can then install other packages). – Stephen Kitt Dec 26 '16 at 21:50
  • 1
    Seriously, minbase installs the minimum viable Debian system for the given release, 101 packages for Jessie. If you try to get away with anything less, you're asking for trouble down the road because any package can rely on all essential packages being installed, without depending on them. – Stephen Kitt Dec 26 '16 at 21:59
  • 1
    You're doing it wrong. If you want to install Debian packages, use debootstrap and install Debian's package manager. Redoing the work that went into debootstrap will take you ages and will fail repeatedly as Debian evolves. – Gilles 'SO- stop being evil' Dec 26 '16 at 22:03

Well, if you had apt available...

apt-get -y install --print-uris $PACKAGE | cut -f 2 -d \' | grep \.deb

It will actually give you all of the packages needed for whatever it is goign to install.

user@darkstar:~/ $ apt-get -y install --print-uris audacity | cut -f 2 -d \' | grep \.deb

Since you don't, look at http://ftp.us.debian.org/debian/dists/stable/main/binary-adm64 and grab a copy of the Packages.gz file there. Look through it, and you'll see The package name listed as

Package: audacity

A few lines after that, you'll see

Filename: pool/main/a/audacity/audacity_2.0.6-2_amd64.deb

And there ya go! Unfortunately, the line number isn't consistent....

| improve this answer | |
  • See edit to explain why I cannot use apt. – Duke Dougal Dec 26 '16 at 21:15
  • Did you read the rest of my answer/reply? The part that comes after "Since you dont..." – ivanivan Dec 26 '16 at 21:21

If you don't have apt available, you'll be stuck basically reimplementing apt. It probably makes more sense to just get apt. But if you must...

Start the same way apt itself does: from a URL as specified in /etc/apt/sources.list, such as http://ftp.us.debian.org/debian/. Don't forget the to take into account the additional entries you might have in that list for updates, security.debian.org, and possibly backports.

You need to evaluate the rules in /etc/apt/preferences{,.d} to know which source any particular package should come from and you need to do version number comparisons and to evaluate pinning rules.

Build a full URL from that:


That file contains the relative URLs to all of the individual packages.

You also need the following files in order to verify the hash of that file to check its integrity:


...and the public key from /etc/apt/trusted* that lets you verify that. The Release file contains hashes for all the other files, which you should verify.

I'll have forgotten to take into account a bunch of other subtle rules about the format and layout of a Debian package repository.

As you can see, much better to just use apt.

| improve this answer | |
  • See edit to explain why I cannot use apt. – Duke Dougal Dec 26 '16 at 21:14

It is better to install and use apt .

To download the package run:

apt-get download libgcc1

To get the path to your .deb package , run:

apt-cache show libgcc1 | grep Filename

sample outpout:

Filename: pool/main/g/gcc-4.9/libgcc1_4.9.2-10_amd64.deb
| improve this answer | |
  • See edit to explain why I cannot use apt. – Duke Dougal Dec 26 '16 at 21:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.