How to upgrade coreutils to latest version without breaking anything.(from

很蛋疼的问题, 联想x6的机器太挑系统, 今天换了个rhel6.5似乎略稳定, 在更换了centos的源以后, 发现自带的yum软件包还是太老, sort命令还是不支持parallel选项, 没办法只有build from source这条路走了, 以下是过程

The base of these instructions was derived from the excellent (link is external)--which basically shows you how to safely upgrade your coreutils.

Here we go....

Download the latest version from here: (link is external)

cd /usr/local/src
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

            --prefix=/usr            \
            --libexecdir=/usr/lib    \
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

装完后发现其实 sort 还是原来的sort 新的在/usr/bin下面, 没办法, 只好人肉改下调用sort命令的路径了