1

This question already has an answer here:

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:

http://ftp.us.debian.org/debian/pool/main/g/gcc-4.9/libgcc1_4.9.2-10_amd64.deb

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

to:

http://ftp.us.debian.org/debian/pool/main/g/gcc-4.9/libgcc1_4.9.2-10_amd64.deb

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.

thanks

marked as duplicate by muru, countermode, Eric Renouf, grochmal, Anthon Dec 27 '16 at 6:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 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 Dec 26 '16 at 22:03
6

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
http://archive.ubuntu.com/ubuntu/pool/universe/libs/libsbsms/libsbsms10_2.0.2-1_amd64.deb
http://archive.ubuntu.com/ubuntu/pool/universe/s/serd/libserd-0-0_0.22.0~dfsg0-2_amd64.deb
http://archive.ubuntu.com/ubuntu/pool/universe/s/sord/libsord-0-0_0.14.0~dfsg0-1_amd64.deb
http://archive.ubuntu.com/ubuntu/pool/universe/s/sratom/libsratom-0-0_0.4.6~dfsg0-1_amd64.deb
http://archive.ubuntu.com/ubuntu/pool/universe/s/suil/libsuil-0-0_0.8.2~dfsg0-1_amd64.deb
http://archive.ubuntu.com/ubuntu/pool/universe/a/audacity/audacity-data_2.1.2-1_all.deb
http://archive.ubuntu.com/ubuntu/pool/main/f/flac/libflac++6v5_1.3.1-4_amd64.deb
http://archive.ubuntu.com/ubuntu/pool/universe/libi/libid3tag/libid3tag0_0.15.1b-11_amd64.deb
http://archive.ubuntu.com/ubuntu/pool/universe/l/lilv/liblilv-0-0_0.22.0~dfsg0-1_amd64.deb
http://archive.ubuntu.com/ubuntu/pool/universe/p/portsmf/libportsmf0v5_0.1~svn20101010-4ubuntu1_amd64.deb
http://archive.ubuntu.com/ubuntu/pool/universe/v/vamp-plugin-sdk/libvamp-hostsdk3v5_2.6~repack0-2_amd64.deb
http://archive.ubuntu.com/ubuntu/pool/universe/a/audacity/audacity_2.1.2-1_amd64.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....

  • 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
4

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:

http://ftp.us.debian.org/debian/dists/<name>/<section>/binary-<architecture>/Packages.gz

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:

http://ftp.us.debian.org/debian/dists/jessie/Release
http://ftp.us.debian.org/debian/dists/jessie/Release.gpg

...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.

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

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
  • 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.