How can I install a package without root access?
Solution 1:
Apt doesn't support it directly, but there are ways to do it.
One is to use schroot
to create a non-root chroot. This is a somewhat involved process, but one you should be able find community help for as many developers set up chroot environments for compiling code.
The second way I know of is to install from a .deb package. You may be able to download this from a web site or if it's in the Ubuntu repositories you can download with.
apt-get download package
Replace package
with the name of the package
Once you have your deb file call dpkg
directly from the command line. The following example will install package.deb into your home directory.
dpkg -i package.deb --force-not-root --root=$HOME
The disadvantage to using dpkg like this is that error messages are likely to be cryptic; dpkg doesn't automatically resolve dependencies or create the directory structure it expects.
Finally, you could use the apt-get source
command to fetch the source of the package and configure it to install locally. Usually this looks something like:
apt-get source package
cd package
./configure --prefix=$HOME
make
make install
The disadvantage to this approach is that you need the development environment available for this approach to work at all, and you might find yourself compiling dozens of packages in order to resolve all the dependencies.
EDIT:
As dpkg -i
doesn't work (see comments), I suggest this alternative:
dpkg -x package.deb dir
This will extract the .deb package to dir. Then you can export the PATH where the binary is. As long as all dependencies of the binary are installed, it should run as normal.
Solution 2:
I assume you want to install jedit. First you have to find the package and download it. I just take the deb file from some mirror and open a console/terminal:
-
mkdir /tmp/jedit && cd /tmp/jedit
-- Makes a new diretory intmp
and changes into it. -
wget http://mirrors.kernel.org/ubuntu/pool/universe/j/jedit/jedit_4.3.1.dfsg-0ubuntu1_all.deb
-- Download package -
ar x jedit_4.3.1.dfsg-0ubuntu1_all.deb
or, easy to type,ar x *.deb
-- this extracts the file contents -
tar xvzf data.tar.gz
-- the filedata.tar.gz
has all the stuff which you need for executing the software -
usr/bin/jedit
opens the editor - done :-)
You can move the files to some point in your home directory and execute them from there.
Solution 3:
I wrote a program called JuNest which basically allows to have a really tiny Linux distribution (containing just the package manager) inside your $HOME/.junest directory.
It allows you to have your custom system inside the home directory accessible via proot and, therefore, you can install any packages without root privileges. It will run properly under all the major Linux distributions, the only limitation is that JuNest can run on Linux kernel with minimum recommended version 2.6.32.
For instance, after installing JuNest, to install jedit:
$>junest -f
(junest)$> pacman -S jedit
(junest)> jedit