How can I install a more modern version of GNU utils (coreutils) on Debian Linux with no admin rights?

I would like to install a more modern version of GNU utils (coreutils) on a debian linux system where I have no admin rights. Is there a way to do that?

The rationale is that I need a more modern version to the one installed in the system where I intend to run my analysis. I am trying to use "sort -R" or "shuf" to randomize lines in a big text file.


Solution 1:

You can't install them in the sense that they override the existing ones for all users of the system, but you can compile and install them in your home directory and configure your PATH such that they are ran instead of the system ones.

To do so, download the latest version of coreutils from the GNU web site. Then, extract the archive and cd into it, and run the following commands to compile and install it. Note the --prefix switch that lets you configure the directory you want it to install in.

./configure --prefix=/home/avilella/coreutils/
make
make install

Most Debian systems are configured to automatically add ~/bin to your PATH. If that's the case, you can copy the utilities to that directory. However, it may not be configured to run executables from that directory before searching system directories, or you may prefer to keep them in their own directory. In that case, you will need to edit your ~/.profile to search that directory before searching the system ones. To do so, add a line like this:

PATH="$HOME/coreutils/bin:$PATH"

If you'd prefer not to compile them, you could also extract them from a newer Debian package by using ar vx on the .deb file to output a data.tar.gz tarball with the package contents. But newer packages might require newer libraries not present on your system.