Install without root linux

Installing software on Linux without root privileges

At my workplace I have a regular user account on RedHat and Suse machines. I don’t have root privileges. How can I install software that I download from the internet (from sources or binaries)? For example, now I want to install the Geany IDE for my own use. I tried to download sources and compile, and I tried to install the RPM, but non of of these works because it requires the root.

Do you require root because of destination permissions (don’t have access to /etc, /bin, /sbin etc) or because rpm/gcc has restricted permissions?

7 Answers 7

You can install software into your own home directory. If you’re comfortable compiling from source, and the package uses automake, then you can use the following option on configure:

or whatever. Similarly, rpm has a prefix option as well. However, this only works if the rpm was built to be relocatable.

I use JuJu which basically allows to have a really tiny linux distribution (containing just the package manager) inside your $HOME/.juju directory.

It allows 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 to all the major linux distributions, the only limitation is that JuJu can run on linux kernel with minimum reccomended version 2.6.32.

For instance, after installed JuJu to install pip just type the following:

$>juju -f (juju)$> pacman -S python-pip (juju)> pip 

Источник

How can I install a package without root access?

I have no root access on this machine. I would like to know if there is a way I can download Ubuntu packages and install them as non-root? Probably in my ~/bin or ~/usr/share or something like that? Would that work?

You could use portable apps for linux: no installing , no root necessary. Find it at appimage.org. Even Linus Torvalds likes it. That’s odd, cause Linus never likes anything.

A combination of dpk -x and mv worked for me. Or, if even dpk is not available, ar and piping/combining with tar worked for me on very restricted systems, see here

4 Answers 4

Apt doesn’t support it directly, but there are ways to do it:

.deb Approach

apt-get download package_name # replace `package_name` with the name of the package. dpkg -x package.deb dir 

If the deb isn’t in the Ubuntu repositories, apt-get package_name won’t work, but you may be able to download it from a web site.

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.

schroot Approach

Another approach 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.

Читайте также:  Расшифровка handshake kali linux

apt-get source Approach

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.

Historical Approach

It used to be possible to install package.deb with dpkg into one’s 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.

Folks, —force-not-root —root=$HOME , or variations thereof will not work. Debian binary packages are not designed to be installed in the home directory, period. Or, to put this another way,. «The following example will install package.deb into your home directory.». No, it won’t.

dpkg -x is what worked for me.

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:

  1. mkdir /tmp/jedit && cd /tmp/jedit — Makes a new diretory in tmp and changes into it.
  2. wget http://mirrors.kernel.org/ubuntu/pool/universe/j/jedit/jedit_4.3.1.dfsg-0ubuntu1_all.deb — Download package
  3. ar x jedit_4.3.1.dfsg-0ubuntu1_all.deb or, easy to type, ar x *.deb — this extracts the file contents
  4. tar xvzf data.tar.gz — the file data.tar.gz has all the stuff which you need for executing the software
  5. usr/bin/jedit opens the editor
  6. done 🙂

You can move the files to some point in your home directory and execute them from there.

Note that pre- and post-install scripts don’t get run; also you’ll need to resolve any dependencies or paths yourself. But on a default install this is sufficient for a lot of desktop applications.

you can also download the package without searching for it, just do apt-get download (see other answer)

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 

The question was if we could install Ubuntu package. With junest, we will only be able install ArchLinux package and NOT an Ubuntu package. For e.g. if the same package is not available for ArchLinux, then this won’t help. That said, thanks for Junest.

Читайте также:  Linux connect to sftp

I find the accepted answer lacks a concrete example. This is a full working example:

# - opam (snap, no sudo) # ref: https://askubuntu.com/questions/339/how-can-i-install-a-package-without-root-access apt-get download opam #apt-get download opam_1.2.2-4_amd64 #ls | less mkdir -p ~/.local dpkg -x opam_1.2.2-4_amd64.deb ~/.local/bin export PATH="$HOME/.local/bin:$PATH" echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc.user tr ':' '\n'  

in particular you need to be careful because apt-get download might now give you the .deb fine with the exact name you expect.

Note this one usually also works:

# - install the bin then put it in path and restart your bash mkdir ~/.rbenv cd ~/.rbenv git clone https://github.com/rbenv/rbenv.git . export PATH="$HOME/.rbenv/bin:$PATH" echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc # exec $SHELL #bash rbenv -v 

Источник

Install gcc on linux with no root privilege

I have access to computer in a public library and I want to try out some C++ and maybe other code. Problem is that there is no g++ installed and I can't install it using packages because I have no root access. Is there a "smart" way to make a full environment for programming in a home folder? I have gcc installed (I can compile C code). Also, I have a home folder that is consistent. I don't know where to find precompiled g++, I found only source but I don't know what to do with it. I tried to ask them to install this but it didn't work 🙂

4 Answers 4

If you want to install it as a local user

GNU GSRC provides an easy way to do so

After configuration, simply specify the following commands:

cd gsrc make -C pkg/gnu/gcc make -C pkg/gnu/gcc install 

The second step could also be changed to speed up for an N-core system:

make -C pkg/gnu/gcc MAKE_ARGS_PARALLEL="-jN" 

I do recommend a stable release (like 2013.07) instead of the trunk, download from: ftp.gnu.org/gnu/gsrc

You can run the configure script with the --prefix parameter: ../gcc-4.5.0/configure --prefix=/home/foo/bar . Since it is very likely that the c++ standard library is different then the one on your system, you have to set export LD_LIBRARY_PATH=/home/foo/bar/lib before you can start a program compiled by this compiler.

I tried ./configure --prefix=. but it gives me: configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."

It seems that you are trying to do the build inside the source tree. This is unsupported by the gcc maintainers, they want the build to be in a directory next to the gcc sources. Also, which packages did you unpack? You need both the gcc-core and gcc-g++ to generate the c++ compiler (or the complete[=largest] package). The missing install-sh is in the gcc-core package.

You actually need to do this before building GCC if you are using your own versions of GMP, MPC, MPFR and ISL because GCC uses those shared libraries.

Once, a long time ago (1992 or so), I went through something similar to this when I bought a SCO system with no development environment. Bootstrapping it up to having a full development environment was a gigantic pain, and not at all easy. Having library header files or gcc on a system would make your job a whole lot easier.

It depends a lot on just how obnoxious the library has been about what kinds of things are installed. If there is no gcc there, your job becomes a bit harder. If there are no header files for glibc there, your job is a LOT harder.

Also, do you get an account on the system so you have a home folder that's consistent from login to login?

If you have no gcc there, you need to find a pre-compiled binary of gcc/g++ and install it somewhere. If you have no header files there, you need to find copies of those and put them on the system.

There is no 'standard' way of installing gcc in your home folder though. All of the solutions are going to have some manner of hand-rolling involved.

Have you asked the librarians if they can change what's installed because you want to learn a bit of programming and only have access to their computers to do it with? That might well be the easiest solution.

From your comment it seems that you do have gcc and if you can compile C code, you have the library header files. So now it's a matter of actually compiling your own version of g++ . You could probably find a way to entice the package manager on the system into installing a binary package somewhere other than in a system folder. I think this solution is less fun than compiling your own, and I think there may also be possible subtle problems as that installed package may be expecting to find things in particular places and not finding them there.

First thing to do is to make sure you've downloaded the right source for the gcc package. The place to find that is the GNU United States mirror page. You want to find the gcc-4.5.0.tar.bz2 or gcc-4.5.0.tar.gz file on the mirror site you choose. It will likely be in a gcc directory, and a gcc-4.5.0 sub-folder.

After you have that downloaded, you should untar it. In general you shouldn't build gcc in the folder you untar it into. So create another sibling folder that you actually want to build it in labeled gcc-build . Then the command you want is ../gcc-4.5.0/configure --prefix=$HOME/.local --enable-languages='c c++' .

gcc does require some other packages be installed in order to be able to compile itself. You can use the same --prefix line for these packages to install them in the same place. The gcc website has a list of pre-requisite packages.

$HOME/.local is sort of the standard accepted place for per-user installs of things.

Источник

Оцените статью
Adblock
detector