解压 tar.bz2 时候出错的解决方法 tar (child): lbzip2: Cannot exec: No such file or directory

0x00 起因

最近新装的 centos7 mini 安装的,因为要源码安装 mysql8, 所以需要升级自己的 gcc 到 5.3,下载 gcc 的源码,解压时候出错了。
[root@localhost gcc]# tar xf gcc-5.3.0.tar.bz2
tar (child): lbzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

当时我就懵逼了,tar 有问题?还算了 MD5 码哪哪都没错,才想起来 mini 安装的。

0x01 解决

安装 bzip2 的支持就好了

yum -y install bzip2

或者还可以编译安装,下载地址 http://www.bzip.org/downloads.html

tar zxvf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6/
#为编译做准备,创建libbz2.so动态链接库(这一步很重要,安装python的时候如果没有这一步,python安装不上bz2模块):
make -f Makefile-libbz2_so
make && make install

本文参考文章 https://blog.csdn.net/u012949658/article/details/55001179

上一篇
下一篇