This question already has an answer here:

I would like to install a bunch of packages (glogg, libprotobuf7, libleveldb1, libsnappy1, libhdf5-7) on an Ubuntu system on which I do not have root privileges. (I understand that this can be achieved by forcing the downloading and installation to take place on my home directory for example).

I would like to do this as fast as possible, e.g using apt (rather than manually searching the web for a link address to the package, then wget-ing it, then opening the tarball, then reading the INSTALL file to install correctly etc).

Is there a way to do this?

How can I install a package without root access? has a 1st answer that assumes that we have the .deb file already downloaded. This is not my case (and if you know of a way to get it quickly without scouring the web, I'd love to know).

marked as duplicate by Eric Carvalho, bain, user.dz, nux, Warren Hill Jul 15 '14 at 12:25

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.

  • For the record, aptitude and apt-get are two different frontends. – saiarcot895 Jul 8 '14 at 16:47
  • The deb packages that are downloaded for installation don't contain INSTALL files, and are meant to be read by dpkg to be parsed and installed. Also, note that the packages contain two files: data.tar.xz, which contain the files to be installed relative to /, and control.tar.xz, which contain metadata about the package (package name, dependencies, installed size, etc.) and any configuration scripts. – saiarcot895 Jul 8 '14 at 16:51
  • what are you trying to install – Find Me In The Woods Jul 8 '14 at 16:52
  • 2
    You can download the package by using apt-get download <package_name> without root access and follow the answer in that question – M.Tarun Jul 8 '14 at 17:08
  • I've modified the proposed duplicate to make it one by adding how to get the .deb from the repositories. – Warren Hill Jul 15 '14 at 12:25

I guess the following would work to install the package to a directory: ~/local/

Download the package as package.deb using :

apt-get download <package_name>

Then run

dpkg --install package.deb --instdir=~/local

As mentioned in one of the comments, use apt-get just to download, then dpkg -i to install.

mkdir $HOME/.local
apt-get download <package_name>
dpkg -i --force-not-root --root=$HOME/.local <package_name.deb>

Note: what's nice is that apt-get automatically picks the package that fits your Ubuntu distribution and your architecture.

  • 1
    aptitude download <package_name> will also work. – Radu Rădeanu Jul 8 '14 at 17:17

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