43

I have apt-get 0.7.23.1 on host machine. I do not have root, thus not able to update it, or install other packages.

I want to download .deb packages with it, but neither

apt-get -d bash

(Invalid operation bash)

nor

apt-get -d install bash

(do not have root)

work.

On my home machine with a newer version of apt-get I can

apt-get download bash

and it does exactly what I want it to.

How can I perform the same on the host machine?

Zanna
  • 72,312
disfated
  • 1,083

3 Answers3

37

The command apt-get download wasn't added until version 0.8.11 of apt. It was first available in Ubuntu 11.04 (which uses apt 0.8.13.2). I'm not sure what you're running as AFAICT no supported version of Ubuntu contains version 0.7.23.1 of apt. You should really have the system administrator upgrade the machine. (I know, not very helpful.)

It's not clear from your question whether or not you have access to a graphical environment. If you do, your best bet would be to grab the files from http://packages.ubuntu.com/

This is also possible from the command line as there are predictable urls. For instance:

wget http://archive.ubuntu.com/ubuntu/pool/main/a/apt/apt_0.7.25.3ubuntu9.4_i386.deb

You can find the correct version and whether the package is in main or universe by using apt-cache policy.

This is of course scriptable. Here's a quick one:

#! /bin/bash
PACKAGE=$1
URI=`apt-cache show $PACKAGE | grep "Filename:" | cut -f 2 -d " "`
wget http://archive.ubuntu.com/ubuntu/$URI
David Foerster
  • 36,890
  • 56
  • 97
  • 151
18

apt-get download [package] works without root privileges but only for Ubuntu Natty and newer. You can also use apt download [package].

If you've got aptitude installed, you can run use aptitude download [package]

RobinJ
  • 9,020
1

If there are many variants, then download all

 #! /bin/bash

 PACKAGE=$1
 apt-cache show $PACKAGE | grep "Filename:" | while read -r line; do URI=`echo "${line}" | cut -f 2 -d " "`; wget "http://archive.ubuntu.com/ubuntu/$URI"; done
guest
  • 11