• 幕客老师召集小伙伴
  • 运维高手36项修炼
  • python自动化运维项目实战
  • nginx从入门到实战
  • 阿里云与Centos7实战

Redhat系统软件包管理-源码安装

知识点:
一、源码包tarball

二、源码包SRPM 

 

一、源码包tarball 

./configure(检测环境,生成Makefile)–>make(编译,根据Makefile)–>make install(将编译完成的数据放入每一个目录,根据Makefile) 
 
一、获得源码包途径
1. 官方网站,可以获得最新的软件包  例如Apache www.apache.org   Nginx www.nginx.org
2. www.google.com   ( pcre  cacti )
 
二、安装源码包
准备工作
1. 编译环境如gcc编译器、make,建议安装软件包组 开发工具 //yum grouplist
   yum groupinstall Additional Development -y
2. 准备软件
pcre-8.10.tar.gz
nginx-1.6.0.tar.gz
 
部署Nginx
1. pcre: 支持正则表达式,地址重写rewrite
# tar xvf pcre-8.35.tar.gz //解压缩
# cd pcre-8.35
# ./configure --prefix=/usr/local/pcre    //生成Makefile文件, --prefix安装目录位置。
# make 
# make install

 

2. nginx
# useradd www                  //新建立www用户# tar xvf nginx-1.6.0.tar.gz          //解压缩tar.gz的nginx包
# cd nginx-1.6.0
./configure \
--user=www \                            //用www用户运行nginx
--group=www \                          //用www组运行nginx
--prefix=/usr/local/nginx-1.6.0 \   //安装目录
--with-http_stub_status_module \ //Nginx安装附加的模块--with-http_sub_module \
--with-http_ssl_module \
--with-pcre=/usr/local/pcre  //需要依赖pcre安装库,此处不是安装路径,是解压的路径
# make
# make install
#/etc/init.d/iptables stop  //关闭防火墙
# /usr/local/nginx-1.6.0/sbin/nginx	//启动nginx服务器

 

三、详解源码安装三步曲:
# ./configure –prefix=/usr/local/nginx-1.6.0
   a. 指定安装路径,例如–prefix=DIR
   b. 启用或禁用某项功能, 例如 –enable-ssl, –disable-filter –with-http_ssl_module
   c. 和其它软件关联,例如–with-pcre=/root/pcre-8.35
   d. 检查安装环境,例如是否有编译器gcc,是否满足软件的依赖需求
   最终生成:Makefile
# make clean //清理掉以前编译后产生的 *.o目标文件
# make //按Makefile文件编译,可以使用-j 2指定两颗CPU编译
# make install //安装
 
 

二、源码包SRPM

 
 
其它的二进制软件
==bin格式软件包==
jdk-6u27-linux-i586.bin

 

[root@jeson software]# chmod a+x jdk-6u27-linux-i586.bin
[root@jeson 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.35
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.35′:
configure: error: no acceptable C compiler found in $PATH
See `config.log’ for more details
 
解决方案:
# LANG=C yum -y groupinstall “Development tools”
 
 
安装源码的技巧:
README
INSTALL

Redhat系统软件包管理-源码安装

Pingbacks已打开。

引用地址

暂无评论

发表评论