How to upgrade coreutils to latest version (from source)

×

Error message

Deprecated function: Creation of dynamic property BotchaFormNone::$id is deprecated in BotchaFormNone->__construct() (line 214 of /home/kzn/domains/duntuk.com/public_html/sites/all/modules/contrib/botcha/controller/form/botcha.form.controller.inc).

Say you're on CentOS 5.x, and want to pimp out your bash prompt using the pretty awesome Solarized color scheme. Well, there's a nice .bashrc Solarized setup here: https://github.com/seebi/dircolors-solarized. To use all the features of dircolors.256dark version, you'll need GNU coreutils 8.5 or higher, otherwise you'll get errors like this:

dircolors: `/root/.dircolors':95: unrecognized keyword RESET
dircolors: `/root/.dircolors':99: unrecognized keyword MULTIHARDLINK
dircolors: `/root/.dircolors':108: unrecognized keyword CAPABILITY
dircolors: `/root/.dircolors':95: unrecognized keyword RESET
dircolors: `/root/.dircolors':99: unrecognized keyword MULTIHARDLINK
dircolors: `/root/.dircolors':108: unrecognized keyword CAPABILITY

Here's how to upgrade your coreutils without breaking anything.

The base of these instructions was derived from the excellent LinuxFromScratch.org--which basically shows you how to safely upgrade your coreutils.

Here we go....

Download the latest version from here: http://ftp.gnu.org/gnu/coreutils/

cd /usr/local/src
wget http://ftp.gnu.org/gnu/coreutils/coreutils-8.22.tar.xz
tar xfv coreutils-8.22.tar.xz
cd coreutils-8.22

This is key. We make sure to put everything in /usr/bin instead of /bin. -- i.e. so we don't run into compile problems if some of the coreutils are being used

FORCE_UNSAFE_CONFIGURE=1 ./configure \
            --prefix=/usr            \
            --libexecdir=/usr/lib    \
            --enable-no-install-program=kill,uptime

make
make install

Now we move what we installed in /usr/bin to /bin overwritting the old coreutils with new.

yes | mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo,head,sleep,nice,false,ln,ls,mkdir,mknod,mv,pwd,rm,rmdir,stty,sync,true,uname,test,[} /bin
yes | mv -v /usr/bin/chroot /usr/sbin
yes | mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8
sed -i s/\"1\"/\"8\"/1 /usr/share/man/man8/chroot.8

And...... that should do it... Though you may want to reboot the server after--as I noticed that "service restart SERVICENAME" didn't work until.
Example:

service restart httpd
restart: unrecognized service

 

Notes:

  • Skipped running any of the (optional) tests as shown in LinuxFromScratch.org--if you're the type of person that does make test then there's an excellent step by step for that.
  • Also, I didn't bother with the coreutils-8.22-i18n-3.patch mentioned there, since it's for "internationalization-related bugs"; plus it says something about some people experiencing "many bugs" after install... yeah; pass.
Tags: Linux coreutils centos Administration DirectAdmin