zoukankan      html  css  js  c++  java
  • FPM打包工具 可以把源码包制定为rpm包 是自动化部署的环节

    注意部FPM时的环境一定要跟生产环境的系统版本最好是保持一至,我第一次测试没通过,(我在CENTOS7和部属FPM打好的包在Centos6.x和安装,结果失败)

    1:安装 FPM打包工具的依赖包:

    [root@DB apps]# yum install gcc* rpm-build
    

     2:源码安装ruby

    https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.4.tar.bz2
    在安装Ruby之前先安装openssl源码

    修改Makefile:增加 CFLAG -fPIC,如:CFLAG= -fPIC -DOPENSSL

    如下:

        修改之前:
    CFLAG= -O
    DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_SSL2 -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST -DOPENSSL_NO_WEAK_SSL_CIPHERS
    修改之后
    CFLAG= -fPIC
    DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_SSL2 -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST -DOPENSSL_NO_WEAK_SSL_CIPHERS
    查看目录:
    [root@DB openssl-1.0.2j]# pwd
    /data/ok/openssl-1.0.2j
    [root@DB openssl-1.0.2j]# vim Makefile
    修改后就可以编译和安装了!!!
    
    [root@DB openssl-1.0.2j]# ./config --prefix=/data/apps/openssl-1.0.2j
    [root@DB openssl-1.0.2j]# make && make install
    增加openssl的lib目录到系统里并生效
    [root@DB openssl-1.0.2j]# echo '/data/apps/openssl-1.0.2j/lib/'>>/etc/ld.so.conf.d/server.conf
    [root@DB openssl-1.0.2j]# ldconfig
    

    增加openssl的bin目录到系统里并生效

    [root@DB openssl-1.0.2j]# echo 'export PATH=/data/apps/openssl-1.0.2j/bin/:${PATH}'>>/etc/profile
    [root@DB openssl-1.0.2j]# source /etc/profile
    

    接下来源码安装:RUBY

    [root@DB ruby-2.3.4]# ./configure --prefix=/data/apps/ruby-2.3.4 --with-openssl-dir=/data/apps/openssl-1.0.2j/ssl
    [root@DB ruby-2.3.4]# make && make install
    
    echo 'export PATH=/data/apps/ruby-2.3.4/bin/:${PATH}' >>/etc/profile
    source /etc/profile
    

    # 添加淘宝的Rubygems仓库,外国的源慢,移除原生的Ruby仓库

    [root@DB ~]# gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/
    source https://ruby.taobao.org/ already present in the cache
    https://rubygems.org/ removed from sources
    [root@DB ~]# gem sources list
    *** CURRENT SOURCES ***
    
    https://ruby.taobao.org/
    

     首先安装低版本的json,高版本的json需要ruby2.0以上,然后安装低版本的fpm,够用。

    [root@DB ~]# gem install json -v 1.8.3
    Fetching: json-1.8.3.gem (100%)
    Building native extensions.  This could take a while...
    Successfully installed json-1.8.3
    Parsing documentation for json-1.8.3
    Installing ri documentation for json-1.8.3
    Done installing documentation for json after 1 seconds
    1 gem installed
    [root@DB ~]# gem install fpm -v 1.3.3
    Fetching: ffi-1.9.18.gem (100%)
    Building native extensions.  This could take a while...
    Successfully installed ffi-1.9.18
    Fetching: clamp-0.6.5.gem (100%)
    Successfully installed clamp-0.6.5
    Fetching: childprocess-0.7.1.gem (100%)
    Successfully installed childprocess-0.7.1
    Fetching: cabin-0.9.0.gem (100%)
    Successfully installed cabin-0.9.0
    Fetching: backports-3.8.0.gem (100%)
    Successfully installed backports-3.8.0
    Fetching: arr-pm-0.0.10.gem (100%)
    Successfully installed arr-pm-0.0.10
    Fetching: fpm-1.3.3.gem (100%)
    Successfully installed fpm-1.3.3
    Parsing documentation for ffi-1.9.18
    Installing ri documentation for ffi-1.9.18
    Parsing documentation for clamp-0.6.5
    Installing ri documentation for clamp-0.6.5
    Parsing documentation for childprocess-0.7.1
    Installing ri documentation for childprocess-0.7.1
    Parsing documentation for cabin-0.9.0
    Installing ri documentation for cabin-0.9.0
    Parsing documentation for backports-3.8.0
    Installing ri documentation for backports-3.8.0
    Parsing documentation for arr-pm-0.0.10
    Installing ri documentation for arr-pm-0.0.10
    Parsing documentation for fpm-1.3.3
    Done installing documentation for ffi, clamp, childprocess, cabin, backports, arr-pm, fpm after 15 seconds
    7 gems installed
    
    # 上面的2步安装仅适合CentOS6系统,CentOS7系统一步搞定,即gem install fpm

    制做RPM包的流程是:

    先源码安装软件包,然后写脚本,然后通过FPM接合脚本完RPM包的制做:

    下面以TENGINE为例:

    在TENGINE以源码的方法安装成功后为前题:

    查看却本:

    [root@DB scripts]# cat tengine_rpm.sh
    #!/bin/bash
    useradd www -M -s /sbin/nologin
    ln -s /data/apps/tengine-2.1.0 /data/apps/tengine
    

    下面就开始制做RPM包了:

    [root@DB scripts]# fpm -s dir -t rpm -n tengine -v 2.1.0 -d 'gcc gcc-c++ autoconf automake' --post-install /data/scripts/tengine_rpm.sh -f /data/apps/tengine-2.1.0
    no value for epoch is set, defaulting to nil {:level=>:warn}
    no value for epoch is set, defaulting to nil {:level=>:warn}
    Created package {:path=>"tengine-2.1.0-1.x86_64.rpm"}
    

     查看生成的RPM包:

    [root@DB scripts]# ls
    tengine-2.1.0-1.x86_64.rpm  tengine_rpm.sh
    

    经过测试生成的RPM包可以成功安装!!!!

  • 相关阅读:
    设置VS&IE8控件调试
    VR模型优化技巧
    MFC的资源切换AFX_MANAGE_STATE (转载)
    3D图形学资源收集
    关于C++运算符重载
    Valve(维尔福软件公司) Half Life(半条命) CS(反恐精英)
    MySQL导入SQL文件及常用命令
    折磨了我3天的IIS服务器不能运行asp页面故障
    3721奇遇
    SMS2.0软件测量及出现的故障
  • 原文地址:https://www.cnblogs.com/bass6/p/7089841.html
Copyright © 2011-2022 走看看