97
sudo apt-get install pppoe

will download pppoe package and install it.

Is it possible to just download pppoe package and not install it with apt-get command?

wget http://ftp.us.debian.org/debian/pool/main/p/ppp/ppp_2.4.7-1+4_amd64.deb

ppp_2.4.7-1+4_amd64.deb is in the current directory now.

cd  /tmp
sudo  apt-get install  -d  ppp
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  ppp
0 upgraded, 1 newly installed, 0 to remove and 95 not upgraded.
Need to get 0 B/346 kB of archives.
After this operation, 949 kB of additional disk space will be used.
Download complete and in download only mode

No ppp_2.4.7-1+4_amd64.deb or ppp related package in /tmp.

sudo  find  /tmp  -name  ppp*

Nothing found.

Where is the package ppp in /tmp with command

cd  /tmp
sudo  apt-get install  -d  ppp

??

0

9 Answers 9

106

Use --download-only:

sudo apt-get install --download-only pppoe

This will download pppoe and any dependencies you need, and place them in /var/cache/apt/archives. That way a subsequent apt-get install pppoe will be able to complete without any extra downloads.

5
  • 1
    Can you think of a way to specify the output directory for the downloaded package?
    – Shuzheng
    Commented Dec 19, 2019 at 11:37
  • 2
    I've considered apt-get download <package>, but it doesn't download dependencies.
    – Shuzheng
    Commented Dec 19, 2019 at 11:55
  • 2
    You should be able to change it by modifying Dir::Cache and Dir::Cache::archives, with the -o option. Commented Dec 19, 2019 at 17:36
  • 2
    Does not seem to work if the package is already installed
    – Alexey
    Commented Jun 26, 2020 at 12:53
  • 2
    @Alexey yes, see this answer for situations where the target package is already installed. Commented Jun 26, 2020 at 13:03
46

Use this command:

apt-get download pppoe

This command let you download the package into the current directory.

For accessing installed .deb files, you can look in this path:

/var/cache/apt/archives
1
  • 11
    This doesn’t download dependencies, it only downloads the packages named in the arguments. Commented Dec 2, 2017 at 15:09
10

To expand on Hamid's answer slightly, any of these three very similar commands will work if your only desire is to only download the specified package, and nothing else. (Your use case is not clearly stated, so it's unclear if that is what you want to do.) They all download the Debian binary package file corresponding to the specified binary Debian package to the current directory. Note that these commands will download only the binary package specified, and none of its dependencies. If you want the dependencies as well, use the answer provided by Stephen Kitt.

apt-get download ppoe

apt download ppoe

aptitude download ppoe

The first two command are part of the apt package, the third is part of the aptitude package. They are all functionally equivalent, as far as I know, though syntax and usage differences between apt and aptitude may cause you to prefer one of them under certain circumstances. And of course apt is a newer command than apt-get - it contains apt-get and apt-cache functionality while discarding some of the historical baggage.

Note also that if any of these commands find the file already in the current directory, they will not download it again. However, I'm not sure what criteria they use to check - or, in other words, how hard it is to fool them. A blank file doesn't work.

9

Newer versions can use

apt download pppoe

It will be downloaded into the current directory.

(For ubuntu-based distributions whose version >=18.04)

1
6

When working on one Ubuntu server that had no internet but accessible through the company intranet. Installing packages was challenging.

I created a script that will search the dependencies of a required package store them in a list, then go through the list to download other child dependencies because sometimes just one pass of dependency downloading was not enough. After it downloaded the dependencies it bundled them in a zip file that can be moved as a whole to the server. I called this script pkgdownload.

It can be found on my GitHub here

Here's an image of it at work: enter image description here

3
  • Good job! A nice additional feature would be the option to download recommends and suggests packages. See askubuntu.com/a/117646/6227 Commented Mar 24, 2019 at 4:57
  • 2
    Doesn't apt-offline already do this?
    – Urhixidur
    Commented Dec 12, 2019 at 16:26
  • 1
    apt-cache show apt-offline suggests that apt-offline is good only for updating packages, not installing new ones.
    – Max Murphy
    Commented Feb 5, 2022 at 9:43
3

The command to download with missing dependencies and in the current folder is:

sudo apt install --download-only pppoe -o Dir::Cache::archives=./

This will modify the archives folder only for this call.

Dir::Cache is the folder with apt update content files and is working to backup them too:

sudo apt update -o Dir::Cache=/another_folder. For this example with pppoe is enough to copy pkgcache.bin to /another_folder.

sudo apt install --download-only pppoe -o Dir::Cache::archives=./ -o Dir::Cache=/another_folder will read contents from /another_folder and download pppoe with dependencies in the current folder.

2

apt provides a source retrieval command - apt source.

$ apt source pppoe
Reading package lists... Done
Picking 'rp-pppoe' as source package instead of 'pppoe'
Need to get 239 kB of source archives.
Get:1 http://mirror.location.org/debian stretch/main rp-pppoe 3.12-1.1 (dsc) [1,708 B]
Get:2 http://mirror.location.org/debian stretch/main rp-pppoe 3.12-1.1 (tar) [224 kB]
Get:3 http://mirror.location.org/debian stretch/main rp-pppoe 3.12-1.1 (diff) [13.2 kB]
Fetched 239 kB in 0s (1,241 kB/s)    
dpkg-source: info: extracting rp-pppoe in rp-pppoe-3.12
dpkg-source: info: unpacking rp-pppoe_3.12.orig.tar.gz
dpkg-source: info: unpacking rp-pppoe_3.12-1.1.debian.tar.xz
dpkg-source: info: applying 01_auto_ifup.patch
dpkg-source: info: applying 02_change_mac_option.patch
dpkg-source: info: applying 03_man_pages.patch
dpkg-source: info: applying 04_ignore_broadcasted_pado_packets.patch
dpkg-source: info: applying 05_change_default_timeout.patch
dpkg-source: info: applying 06_typo_fixes.patch

For this to work, you need a source repository in your sources.list or sources.list.d directory (/etc/apt/sources.list or /etc/apt/sources.list.d/. Such a line would look something like (replace with suitable mirror and repository sections):

deb-src http://mirror.location.org/debian/ stretch main contrib non-free
1
  • 1
    It seems pretty clear that the poster was asking for a command to download a Debian binary package, not the Debian sources. So this is not an answer to the question. Commented Jan 24, 2021 at 7:19
1

You can download the package file into a specific directory with wget:

$ wget -O ~/Downloads/ppp_2.4.7-1+4_amd64.deb http://ftp.us.debian.org/debian/pool/main/p/ppp/ppp_2.4.7-1+4_amd64.deb
1

It works with me

sudo apt-get reinstall --download-only <your software>

for example

sudo apt-get reinstall --download-only ubuntu-restricted-extras

For accessing installed .deb files, you can look in this path:

/var/cache/apt/archives

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .