Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way to install a deb package directly from a URL, using a shell? Something like

dpkg -i http://domain.com/path/to/package.deb

(I know I could use wget and then dpkg, I'm just wondering if there's something that does it already)

share|improve this question

7 Answers 7

up vote 18 down vote accepted

Edit: I didn't see your previous statement about knowing you could wget so this is a bit awkward... I'll leave this here for anybody who wants to know how to do this. Additionally the previous version of my answer didn't work but this version (at the expense of being somewhat longer) does:

URL='http://path.to/my.deb'; FILE=`mktemp`; wget "$URL" -qO $FILE && sudo dpkg -i $FILE; rm $FILE

You just need to alter the URL at the beginning. This could be aliased or written as a bash function.

I realise there are technical and security issues surrounding this (you don't get automatic updates, can the source be trusted, etc), but on a purely can-I-do-it basis, this might work.

share|improve this answer

The quickest method is like this. Click to start installing shutter Install shutter.

URLs used for clicking on the name:


... and for the click on the icon:


And yes you need Ubuntu Software center to finish the installation of a .DEB. Otherwise you will have to execute the installation from Nautilus or command line.

Complete text used for this is for AskUbuntu only so you need to reformat this into an anchor:

[shutter](http://packages.ubuntu.com/shutter) [![Install shutter]

More info can be found on the apturl wiki page:

  1. 1 Package:

    a href="apt:package"

  2. Bundling several packages:

    a href="apt:package1,package2,package3"

  3. Enabling repositories:

    apturl apt:freevial?section=universe

So if the software is not in a default enabled repository you should add a 'section=' to it. Otherwise you can not use this method and need the user to download it and install themself.

share|improve this answer
Just a note: AptUrl doesn't work for software that's not on the users repository –  sergio91pt Jul 5 '11 at 11:11
+1 good call 123 –  Rinzwind Jul 5 '11 at 11:12
That's nice, thanks! Anyway I'm looking for something that would work from the command line, I edited the question. Sadly apturl expects a running X :/ –  Joril Jul 6 '11 at 9:12

Normally you would do this like

wget --quiet --output-document=- http://example.com/path/to/package.deb | dpkg --install -

or maybe

dpkg --install <(wget --quiet --output-document=- http://example.com/path/to/package.deb)

but dpkg uses mmap to access the file so neither works (you have to manually create and remove a temporary file). There is a bug report about this: #367297

share|improve this answer
Thanks for your contribution :) –  Joril Jul 31 '12 at 20:11

I actually have a script that does something similar:

Just copy and paste this script into ~/bin (create this folder if it doesn't exist):

# ~/bin/dpkg
for i in $@; do
        echo $i | grep http 2>&1 > /dev/null
        if [ $? == 0 ]; then
                URL="$URL $i"

#Remove beginning and trailing space
URL=$(echo $URL | sed -e 's/^ //g' -e 's/ $//g')

if [ ! -z $URL ]; then
        mkdir /tmp/debs
        cd /tmp/debs
        for i in $URL; do
                wget "$i"
        dpkg $PASSTODPKG /tmp/debs/*.deb
        dpkg $PASSTODPKG

Then add this to the last line in ~/.bashrc


The script is just a wrapper for dpkg. The line in the ~/.bashrc file tells bash that whenever you type dpkg, it will run ~/bin/dpkg (the script), rather than /usr/bin/dpkg.

The script will just pass the arguments to dpkg if there's no URL's given. The script also supports multiple URL's. Here are some examples that will work:

sudo dpkg -i http://www.example.com/file1.deb
sudo dpkg -i http://www.example.com/file1.deb http://www.example.com/file2.deb
sudo dpkg -i http://www.example.com/file1.deb existing.deb http://www.example.com/file2.deb
sudo dpkg -i existing.deb
share|improve this answer
Please let me know if there are any problems with the script. I not at my Ubuntu computer, so I wrote this off of my memory. –  Xiao-Long Chen Jul 5 '11 at 21:46
What a memory ! –  enzotib Jul 6 '11 at 15:27
@enzotib: haha! With the amount of reinstalls I do, my memory is more useful than my backups :) –  Xiao-Long Chen Jul 6 '11 at 15:34

dpkg >= 1.17.7

You may try with curl, e.g.:

curl -o- https://apt.puppetlabs.com/puppetlabs-release-precise.deb | dpkg --install 

or more bash oriented:

dpkg --install - <(curl -o- https://apt.puppetlabs.com/puppetlabs-release-precise.deb)

Or the same with wget, so replace curl -o- with: wget -q -O-, or with lynx: lynx --dump.

dpkg < 1.17.7

curl -O https://apt.puppetlabs.com/puppetlabs-release-precise.deb && sudo dpkg -i puppetlabs-release-precise.deb
share|improve this answer
using curl getting error: --install needs at least one package archive file argument –  Sazzad Tushar Khan May 27 at 9:34
using dpkg getting error: dpkg-deb: error: /dev/fd/63' is not a debian format archive` –  Sazzad Tushar Khan May 27 at 9:36
using last curl: dpkg: error processing archive puppetlabs-release-precise.deb (--install): –  Sazzad Tushar Khan May 27 at 9:41
Was trying to install wkhtmltopdf –  Sazzad Tushar Khan May 27 at 9:41

You can append it to /etc/bash.bashrc as follows (it's an upgrade from Chen's script):

'dpkg-url'() {


for package in "${urls[@]}"; do
    if [[ $package = *http* ]]; then 

    dpkg_url="$dpkg_url "$package""

# Remove beginning and trailing spaces #

url=$(echo "$url" | sed -e 's/^ //g' -e 's/ $//g')

if [[ ! -z "$url" ]]; then
    directory=$(mktemp -d);
        trap 'rm -rf "$directory"' EXIT

    cd "$directory" || exit
        for package in "$url"; do
            wget ""$package""
    dpkg $dpkg_url "$directory"/*.deb
    dpkg $dpkg_url

though i do not see why i get this error when calling it as follows:

dpkg-url -i http://downloads.sourceforge.net/ldview/ldview-4.2-beta1.x64.deb
dpkg: error: need an action option

Type dpkg --help for help about installing and deinstalling packages [*];
Use `dselect' or `aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;

Options marked [*] produce a lot of output - pipe it through `less' or `more' !
share|improve this answer

This one-liner based on an SO answer worked for me on Ubuntu 15.04 to identify the latest atom release on github for my environment (64-bit Ubuntu) and then install it:

sudo dpkg -i $(curl -w "%{filename_effective}" -LO $(curl -s https://api.github.com/repos/atom/atom/releases | grep browser_download_url | grep '64[.]deb' | head -n 1 | cut -d '"' -f 4))

If you do this in a tmp dir, the deb file will be cleaned up whenever you empty your tmp folder. Otherwise you can manually delete the deb package if you need the disk space.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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