linux的centos 怎么安装bzip2

1.yum安装,不多说

查看:

[root@biluos1 R-3.4.0]# yum list |grep bzip2*
bzip2.x86_64                                1.0.5-7.el6_0                @anaconda-CentOS-201410241409.x86_64/6.6
bzip2-devel.x86_64                          1.0.5-7.el6_0                @base  
bzip2-libs.x86_64                           1.0.5-7.el6_0                @anaconda-CentOS-201410241409.x86_64/6.6
bzip2-devel.i686                            1.0.5-7.el6_0                base   
bzip2-libs.i686                             1.0.5-7.el6_0                base   
lbzip2.x86_64                               2.5-2.el6                    epel   
lbzip2-utils.x86_64                         1.0-1.el6                    epel   
libzip.i686                                 0.9-3.1.el6                  base   
libzip.x86_64                               0.9-3.1.el6                  base   
libzip-devel.i686                           0.9-3.1.el6                  base   
libzip-devel.x86_64                         0.9-3.1.el6                  base   
pbzip2.x86_64                               1.1.12-1.el6                 epel   
You have new mail in /var/spool/mail/root
[root@biluos1 R-3.4.0]# 

可以看到版本是1.0.5版本的

查询安装包

[root@biluos1 R-3.4.0]# yum search bzip2
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * epel: mirrors.tongji.edu.cn
 * extras: mirrors.163.com
 * updates: mirrors.163.com
======================================================= N/S Matched: bzip2 ========================================================
bzip2-devel.i686 : Header files developing apps which will use bzip2
bzip2-devel.x86_64 : Header files developing apps which will use bzip2
bzip2-libs.i686 : Libraries for applications using bzip2
bzip2-libs.x86_64 : Libraries for applications using bzip2
lbzip2.x86_64 : Fast, multi-threaded bzip2 utility
lbzip2-utils.x86_64 : Utilities for working with bzip2 compressed files
pbzip2.x86_64 : Parallel implementation of bzip2
perl-Compress-Raw-Bzip2.x86_64 : Low-Level Interface to bzip2 compression library
perl-IO-Compress-Bzip2.x86_64 : Perl interface to allow reading and writing of bzip2 data
bzip2.x86_64 : A file compression utility
python2-bz2file.noarch : Read and write bzip2-compressed files

  Name and summary matches only, use "search all" for everything.
[root@biluos1 R-3.4.0]# 

看不出来版本

安装

[root@biluos1 R-3.4.0]# yum -y install bzip2-libs.x86_64
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * epel: mirrors.tongji.edu.cn
 * extras: mirrors.163.com
 * updates: mirrors.163.com
Package bzip2-libs-1.0.5-7.el6_0.x86_64 already installed and latest version
Nothing to do
[root@biluos1 R-3.4.0]# 

版本无法更新

查看http://www.bzip.org/downloads.html,发现有版本为1.0.6

2 源码安装

下载bzip2 下载地址:http://www.bzip.org/downloads.html
我下载的是bzip2-1.0.6.tar
1>格式是*.tar.gz 解压文件

[root@biluos1 software]# tar -zxvf bzip2-1.0.6.tar.gz -C /opt/moudles/Bzip2/

2 > 进入bzip2-1.0.6目录

目录视文件存放路径而定

[root@biluos1 Bzip2]# cd bzip2-1.0.6/
[root@biluos1 bzip2-1.0.6]# pwd
/opt/moudles/Bzip2/bzip2-1.0.6
[root@biluos1 bzip2-1.0.6]# 

3 > make -f Makefile-libbz2_so //-f 标志是使bzip2 根据另一个Makefile来编译,就是Makefile-libbz2_so文件,创建一个动态的libbz.so库文件,然后把bzip2工具连接到这个库上

[root@biluos1 bzip2-1.0.6]# make -f  Makefile-libbz2_so
gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c blocksort.c
gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c huffman.c
gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c crctable.c
gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c randtable.c
gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c compress.c
gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c decompress.c
gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c bzlib.c
gcc -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 blocksort.o huffman.o crctable.o randtable.o compress.o decompress.o bzlib.o
gcc -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -o bzip2-shared bzip2.c libbz2.so.1.0.6
rm -f libbz2.so.1.0
ln -s libbz2.so.1.0.6 libbz2.so.1.0
You have new mail in /var/spool/mail/root
[root@biluos1 bzip2-1.0.6]# 

注:装python的时候如果没有这一步,python安装不上bz2模块

4>make && make install 此命令执行成功,就安装完了

[root@biluos1 bzip2-1.0.6]# make && make install 
rm -f libbz2.a
ar cq libbz2.a blocksort.o huffman.o crctable.o randtable.o compress.o decompress.o bzlib.o
ranlib libbz2.a
gcc -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c bzip2.c
gcc -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64  -o bzip2 bzip2.o -L. -lbz2
gcc -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -c bzip2recover.c
gcc -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64  -o bzip2recover bzip2recover.o

Doing 6 tests (3 compress, 3 uncompress) ...
If there's a problem, things might stop at this point.

./bzip2 -1  < sample1.ref > sample1.rb2
./bzip2 -2  < sample2.ref > sample2.rb2
./bzip2 -3  < sample3.ref > sample3.rb2
./bzip2 -d  < sample1.bz2 > sample1.tst
./bzip2 -d  < sample2.bz2 > sample2.tst
./bzip2 -ds < sample3.bz2 > sample3.tst
cmp sample1.bz2 sample1.rb2 
cmp sample2.bz2 sample2.rb2
cmp sample3.bz2 sample3.rb2
cmp sample1.tst sample1.ref
cmp sample2.tst sample2.ref
cmp sample3.tst sample3.ref

If you got this far and the 'cmp's didn't complain, it looks
like you're in business.  

To install in /usr/local/bin, /usr/local/lib, /usr/local/man and 
/usr/local/include, type

   make install

To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type 

   make install PREFIX=/xxx/yyy

If you are (justifiably) paranoid and want to see what 'make install'
is going to do, you can first do

   make -n install                      or
   make -n install PREFIX=/xxx/yyy      respectively.

The -n instructs make to show the commands it would execute, but
not actually execute them.

Instructions for use are in the preformatted manual page, in the file
bzip2.txt.  For more detailed documentation, read the full manual.  
It is available in Postscript form (manual.ps), PDF form (manual.pdf),
and HTML form (manual.html).

You can also do "bzip2 --help" to see some helpful information. 
"bzip2 -L" displays the software license.

if ( test ! -d /usr/local/bin ) ; then mkdir -p /usr/local/bin ; fi
if ( test ! -d /usr/local/lib ) ; then mkdir -p /usr/local/lib ; fi
if ( test ! -d /usr/local/man ) ; then mkdir -p /usr/local/man ; fi
if ( test ! -d /usr/local/man/man1 ) ; then mkdir -p /usr/local/man/man1 ; fi
if ( test ! -d /usr/local/include ) ; then mkdir -p /usr/local/include ; fi
cp -f bzip2 /usr/local/bin/bzip2
cp -f bzip2 /usr/local/bin/bunzip2
cp -f bzip2 /usr/local/bin/bzcat
cp -f bzip2recover /usr/local/bin/bzip2recover
chmod a+x /usr/local/bin/bzip2
chmod a+x /usr/local/bin/bunzip2
chmod a+x /usr/local/bin/bzcat
chmod a+x /usr/local/bin/bzip2recover
cp -f bzip2.1 /usr/local/man/man1
chmod a+r /usr/local/man/man1/bzip2.1
cp -f bzlib.h /usr/local/include
chmod a+r /usr/local/include/bzlib.h
cp -f libbz2.a /usr/local/lib
chmod a+r /usr/local/lib/libbz2.a
cp -f bzgrep /usr/local/bin/bzgrep
ln -s -f /usr/local/bin/bzgrep /usr/local/bin/bzegrep
ln -s -f /usr/local/bin/bzgrep /usr/local/bin/bzfgrep
chmod a+x /usr/local/bin/bzgrep
cp -f bzmore /usr/local/bin/bzmore
ln -s -f /usr/local/bin/bzmore /usr/local/bin/bzless
chmod a+x /usr/local/bin/bzmore
cp -f bzdiff /usr/local/bin/bzdiff
ln -s -f /usr/local/bin/bzdiff /usr/local/bin/bzcmp
chmod a+x /usr/local/bin/bzdiff
cp -f bzgrep.1 bzmore.1 bzdiff.1 /usr/local/man/man1
chmod a+r /usr/local/man/man1/bzgrep.1
chmod a+r /usr/local/man/man1/bzmore.1
chmod a+r /usr/local/man/man1/bzdiff.1
echo ".so man1/bzgrep.1" > /usr/local/man/man1/bzegrep.1
echo ".so man1/bzgrep.1" > /usr/local/man/man1/bzfgrep.1
echo ".so man1/bzmore.1" > /usr/local/man/man1/bzless.1
echo ".so man1/bzdiff.1" > /usr/local/man/man1/bzcmp.1
[root@biluos1 bzip2-1.0.6]# 

注:如果要重新安装bzip2,要先执行:rm -vf /usr/bin/bz* 命令,不然make install 命令会失败

查看

linux的centos 怎么安装bzip2_第1张图片

不知道为啥最后还是1.0.5版本

你可能感兴趣的:(系统-linux)