源码包tarball
分类:linux基础 热度:

源码包tarball 
 
一、获得源码包途径
1. 官方网站,可以获得最新的软件包  例如Apache www.apache.org   Nginx www.nginx.org
2. www.google.com   ( pcre  cacti )
 
二、安装源码包
准备工作
1. 编译环境如gcc编译器、make,建议安装软件包组 开发工具 //yum grouplist
PS:或者单独安装 gcc,gcc-c++和make cmake 这样的编译工具,看软件需要的环境而定
2. 准备软件
pcre-8.10.tar.gz
nginx-1.2.0.tar.gz
 
部署Nginx
1. pcre: 支持正则表达式,地址重写rewrite
# tar xvf pcre-8.31.tar.gz //解压缩
# cd pcre-8.31
# ./configure --prefix=/usr/local/pcre-8.31
# make 
# make install
 
2. nginx
# useradd www
# tar xvf nginx-1.2.0.tar.gz
# cd nginx-1.2.0
# ./configure \
> --user=www \
> --group=www \
> --prefix=/usr/local/nginx-1.2.0 \
> --with-http_stub_status_module \
> --with-http_sub_module \
> --with-http_ssl_module \
> --with-pcre=/root/pcre-8.31 //此处不是安装路径,是解压的路径
# make
# make install
# /usr/local/nginx-1.2.0/sbin/nginx //启动nginx服务器
 
三、详解源码安装三步曲:
# ./configure --prefix=/usr/local/nginx-1.2.0
   a. 指定安装路径,例如--prefix=DIR
   b. 启用或禁用某项功能, 例如 --enable-ssl, --disable-filter --with-http_ssl_module
   c. 和其它软件关联,例如--with-pcre=/root/pcre-8.31
   d. 检查安装环境,例如是否有编译器gcc,是否满足软件的依赖需求
   最终生成:Makefile
# make clean //清理掉以前编译后产生的 *.o目标文件
# make //按Makefile文件编译,可以使用-j 2指定两颗CPU编译
# make install //安装
 
其它的二进制软件
==bin格式软件包==
jdk-6u27-linux-i586.bin
[root@tianyun software]# chmod a+x jdk-6u27-linux-i586.bin 
[root@tianyun software]# ./jdk-6u27-linux-i586.bin 
 
源码安装错误示例:
error1:
checking for PCRE JIT support ... found
checking for system md library ... not found
checking for system md5 library ... not found
checking for OpenSSL md5 crypto library ... not found
checking for sha1 in system md library ... not found
checking for OpenSSL sha1 crypto library ... not found
checking for zlib library ... not found
 
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
 
解决方案:
# yum -y install zlib-devel
error2:
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
 
解决方案:
# yum -y install openssl-devel
 
error3:
# ./configure --prefix=/usr/local/pcre-8.31
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/root/pcre-8.31':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
 
解决方案:
# LANG=C yum -y groupinstall "Development tools"
 
安装源码的技巧:
README
INSTALL
上一篇:软件包管理 下一篇:SHELL变量
猜你喜欢
各种观点
热门排行
精彩图文