• linux软件管理之源码包管理


    源码包管理tarball


    ====================================================================================
    tarball安装
    src.rpm安装

    tarball安装


    1. 获得源码包途径
    . 官方网站,可以获得最新的软件包 例如Apache www.apache.org Nginx www.nginx.org
    . www.google.com ( pcre cacti )

    2. 安装源码包
    准备工作
    1. 编译环境如gcc编译器、make,可以安装软件包组 开发工具
    2. 准备软件
    nginx-1.8.1.tar.gz

    部署Nginx
    pcre: 支持正则表达式,地址重写rewrite
    # yum -y install gcc make zlib-devel pcre pcre-devel openssl-devel

    nginx
    # useradd www
    # tar xvf nginx-1.8.1.tar.gz
    # cd nginx-1.8.1
    # ./configure
    > --user=www
    > --group=www
    > --prefix=/usr/local/nginx
    > --with-http_stub_status_module
    > --with-http_sub_module
    > --with-http_ssl_module
    > --with-pcre
    # make
    # make install
    # /usr/local/nginx/sbin/nginx //启动nginx服务器

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


    源码包SRPM


    # yum -y remove mysql-server
    # netstat -tnlp |grep 3306
    # yum -y install rpm-build
    # rpm -ivh mysql-community-5.7.12-1.el6.src.rpm
    # cd ~/rpmbuild/SPECS
    # rpmbuild -ba mysql.spec

    [root@localhost SPECS]# yum -y install cmake28 libaio-devel ncurses-devel numactl-devel

    file://C:UsersanliuAppDataLocalTempct_tmp/1.png

    file://C:UsersanliuAppDataLocalTempct_tmp/2.png
    [root@localhost SPECS]# yum -y install gcc-c++



    源码安装错误示例:
    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"
    # yum -y install gcc make


    安装源码的技巧:
    README
    INSTALL






  • 相关阅读:
    YYControls
    JMS基础教程
    .NET牛人应该知道些什么?
    我(zhangxz)的博客园
    Java多线程 sycronize - wait -notify - notifyall
    .NET牛人应该知道些什么_答案(本答复不是标准答案,敬请兄弟们补充更正)
    HDU OJ 动态规划46题解析
    HDU OJ分类
    JS生成二维码
    C# 往Datatable中添加新行的步骤
  • 原文地址:https://www.cnblogs.com/anttech/p/10612374.html
Copyright © 2020-2023  润新知