Installing coreutils on CentOS 5.7

As I had to work in a CentOS 5.7 VM recently, I wanted to take my entire development environment with me. Firstly, that meant setting up vim but it soon became clear that I needed to upgrade a few other packages too. dircolors was complaining that it didn’t support some of the flags I use. After a bit of googling, I realised I needed to upgrade coreutils.

For context, here’s the version currently installed:

$ ls --version
ls (GNU coreutils) 5.97

There’s a few prerequisites to install first:

$ sudo yum install gperf bison

Next, you’ll need a copy of coreutils. Annoyingly, CentOS 5.7 can’t extract the new tar.xz compression format so we’ll use the last available one with tar.gz format, coreutils-8.13.

$ wget http://ftp.gnu.org/gnu/coreutils/coreutils-8.13.tar.gz && tar xzvf coreutils-8.13.tar.gz && cd coreutils-8.13

Once we’ve downloaded & extracted the files and changed into that directory, it’s time to configure the packages.

$ ./configure

If this completes successfully, make the binaries and install them.

$ make && sudo make install

Once this completes, log out and log back in again and check the version of ls.

$ ls --version
ls (GNU coreutils) 8.13

All done. We’ve now got a relatively new version of coreutils installed.

Michael is a polyglot software engineer, committed to reducing complexity in systems and making them more predictable. Working with a variety of languages and tools, he shares his technical expertise to audiences all around the world at user groups and conferences. You can follow @mheap on Twitter

Thoughts on this post

[email protected] 2013-11-07

Hello,

How can i create the binaries and keep them in my ~/bin?
I am a simple user not an admin.
Thanks!

michael 2013-11-13

Edit ~/.bashrc and add the following line to the end:

export PATH=~/bin:$PATH

[email protected] 2013-11-13

I don’t have access to execute sudo commands at all.
So i cannot do “sudo yum install gperf bison”
or “make && sudo make install”

michael 2013-11-13

You could compile gperf and bison yourself and add them to your ~/bin, then use that to run `make`, then copy the built binaries into ~bin. That’s much more involved, though, so you’re on your own I’m afraid.

[email protected] 2013-11-13

Thanks for the help

Leave a comment?

Leave a Reply