How can I get a list of all packages available for a specific version of Ubuntu (not necessarily the one I have installed)?

5,455

Solution 1

Use chdist. This command allows you to run apt-get and apt-cache as usual, but for a different release of Ubuntu (or Debian or in fact any other Debian-derived distribution).

It also provides a wrapper around grep-dctrl which easily allows you to search and report on metadata fields.

Solution 2

1. On-line

I prefer use of http://packages.ubuntu.com/ as muru's answer

2. Off-line, Manual

Otherwise looking for an off-line solution then you should be MR. APT and start downloading them from http://archive.ubuntu.com/ubuntu/dists/.

p=$(pwd); for c in main universe multiverse restricted; do for u in "" -security -updates; do for a in binary-amd64 binary-i386; do mkdir trusty${u}_${c}_$a; cd trusty${u}_${c}_$a; wget http://archive.ubuntu.com/ubuntu/dists/trusty$u/$c/$a/Packages.bz2; cd $p; done; done; done;

Results:

$ tree
.
├── trusty_main_binary-amd64
│   └── Packages.bz2
├── trusty_main_binary-i386
│   └── Packages.bz2
├── trusty_multiverse_binary-amd64
│   └── Packages.bz2
├── trusty_multiverse_binary-i386
│   └── Packages.bz2
├── trusty_restricted_binary-amd64
│   └── Packages.bz2
├── trusty_restricted_binary-i386
...

3. Off-line, using apt-cache/overlay-filesystem/chroot

Going bad, advanced setup:

Actually, I'm going to use a custom sources.list* with same apt-cache installed on 16.04, but apt will not overwrite the 16.04 real lists files in /var/lib/apt/lists/, changes will go to the overlay file-system.

Setup:

sudo apt-get install chroot
mkdir sandbox0
cd sandbox0
mkdir upper work merged
sudo mount -t overlay overlay -o lowerdir=/,upperdir=./upper,workdir=./work ./merged
sudo chroot merged/
echo "deb http://archive.ubuntu.com/ubuntu/ trusty universe multiverse main restricted" > /etc/apt/sources.list
rm -r /etc/apt/sources.list.d/*
apt-get update
exit

Use: (you may prepare a script)

sudo mount -t overlay overlay -o lowerdir=/,upperdir=./upper,workdir=./work ./merged
sudo chroot merged/

apt-cache ...

Solution 3

You already have the command to list all possible posted, but ok lets go a bit deeper shall we? So apt-cache search . or apt-cache search '' output around 2300+ lines which is in fact the whole amount of all possible packages including different DE versions.

To make it more easy you could only get the names with:

apt-cache search '' | sort -d | awk '{print $1}'

Or is you like more information and dont mind a long long list you could roll that through apt-cache policy:

apt-cache policy $(apt-cache search '' | sort -d | awk '{print $1}')
Share:
5,455

Related videos on Youtube

JonasCz
Author by

JonasCz

Cruising through space and time ¯\(ツ)/¯

Updated on September 18, 2022

Comments

  • JonasCz
    JonasCz almost 2 years

    I can get a list of all available packages and their details using the following command:

    apt-cache search .
    

    Which outputs a list of packages which looks like this:

    i   0ad                - Real-time strategy game of ancient warfare
    i   0ad-data           - Real-time strategy game of ancient warfare (data files)                            
    i   0ad-data-common    - Real-time strategy game of ancient warfare (common data files)                        
    p   0ad-dbg            - Real-time strategy game of ancient warfare (debug)                                    
    p   0xffff             - Open Free Fiasco Firmware Flasher                                                     
    p   2ping              - Ping utility to determine directional packet loss                                     
    p   2vcard             - perl script to convert an addressbook to VCARD file format                            
    p   3270-common        - Common files for IBM 3270 emulators and pr3287                                        
    p   389-admin          - 389 Directory Administration Server 
    ...
    

    How can I get such a list of packages for a version of Ubuntu which I don't have installed?

    So, specifically, where can I download the database of all available packages for a specific version of Ubuntu, and how do I get the details (Possibly including version, size, long description...) from it, in plaintext or in a format which is easy to parse with a script?

  • JonasCz
    JonasCz about 8 years
    Yes, but I asked "for a specific version of Ubuntu which I don't have installed ?", so I don't have this list in my apt-cache yet, I need to get it from the internet somehow. Do you know how I could do that ?
  • Videonauth
    Videonauth about 8 years
    mhmm yes at least for the desktop versions there are manifest files, let me find the link to one ok?
  • Videonauth
    Videonauth about 8 years
  • JonasCz
    JonasCz about 8 years
    Unfortunately that isn't the complete list of all available packages (It's just the list of packages on the ISO), which is what I need, nor does it have the descriptions and other data, which I need as well. Any other possibilities ?
  • Videonauth
    Videonauth about 8 years
    Not that I know, really this is the best guess I can give you. the lists in the manifest only not contain the canonical stuff I think. they are beside that pretty complete.
  • JonasCz
    JonasCz about 8 years
    Okay, thanks anyway, and +1 because of the useful information on how to get the long list with more details. Thanks :-)
  • JonasCz
    JonasCz about 8 years
    Thanks, this seems to offer exactly what I need, and looks like it'll be easier to get working than the method from Sneetsher's answer.
  • user.dz
    user.dz about 8 years
    Great, this is the canonical answer. You beat me :D. Nice to know about such tool.