openGauss编译安装过程

  1. 准备工作
  1. 源码编译安装
  • 解压源码包,开源第三方软件压缩包

    // 将下载的压缩包上传到/data目录后,解压
    # cd /data
    # tar -zxvf opengauss-openGauss-server-v2.0.0.tar.gz
    # tar -zxvf openGauss-third_party_binarylibs.tar.gz
    // 重命名开源第三方软件解压目录为binarylibs
    # mv openGauss-third_party_binarylibs binarylibs
    
  • 编译安装
    有两种编译方式:一键式脚本编译,手动编译
    i. 一键式脚本编译

    // 进入openGauss源码目录
    # cd /data/openGauss-server
    
    // 查看build.sh的相关参数
    # sh build.sh -h
    Usage: build.sh [OPTION]
    -h|--help                         show help information
    -m|--version_mode                 this values of paramenter is debug, release or memcheck, the default value is release
    -3rd|--binarylib_dir              the parent directory of binarylibs
    -pkg|--package                    (deprecated option)package the project,by default, only compile the project
    -wrap|--wrap_binaries             wrop up the project binaries. By default, only compile the project
    -nopt|--not_optimized             on kunpeng platform, like 1616 version, without LSE optimized
    
    // 使用build.sh进行编译, -m可指定三种版本:debug,release,memcheck, -3rd指定开源第三方软件的绝对路径, 如需编译安装包, 可加 -pkg 参数
    # sh build.sh -m debug -3rd /data/binarylibs
    

    使用脚本编译的过程中出现内存不足的情况,这里改成手动编译

    ii. 手动编译

    // 查看系统版本
    sh /data/openGauss-server/src/get_PlatForm_str.sh
    centos7.6_x86_64
    // 设置环境变量
    # cat ~/.bash_profile
    export CODE_BASE=/data/openGauss-server
    export BINARYLIBS=/data/binarylibs # 开源第三方软件路径
    export GAUSSHOME=$CODE_BASE/dest/ # 编译后的二进制文件存放路径
    export GCC_PATH=$BINARYLIBS/buildtools/centos7.6_x86_64/gcc7.3/  # centos7.6_x86_64是查询出来的系统版本
    export CC=$GCC_PATH/gcc/bin/gcc
    export CXX=$GCC_PATH/gcc/bin/g++
    export LD_LIBRARY_PATH=/usr/lib64/perl5:$GAUSSHOME/lib:$GCC_PATH/gcc/lib64:$GCC_PATH/isl/lib:$GCC_PATH/mpc/lib/:$GCC_PATH/mpfr/lib/:$GCC_PATH/gmp/lib/:$BINARYLIBS/dependency/centos7.6_x86_64/libobs/comm/lib/:$BINARYLIBS/platform/centos7.6_x86_64/Huawei_Secure_C/Dynamic_Lib/:$LD_LIBRARY_PATH
    export LIBRARY_PATH=$BINARYLIBS/platform/centos7.6_x86_64/Huawei_Secure_C/Dynamic_Lib/:$BINARYLIBS/dependency/centos7.6_x86_64/libobs/comm/lib/:$LIBRARY_PATH
    export PGDATABASE=postgres
    PATH=$GAUSSHOME/bin:$GCC_PATH/gcc/bin:$PATH:$HOME/bin
    export PATH
    // 生效环境变量
    # source ~/.bash_profile
     
    // 执行configure
    # cd /data/openGauss-server
    // 指定编译debug版本(release版本去掉--enable-debug, memcheck版本增加--enable-memory-check)
    # ./configure --gcc-version=7.3.0 CC=g++ CFLAGS='-O0' --prefix=$GAUSSHOME --3rd=$BINARYLIBS --enable-debug --enable-cassert --enable-thread-safety --without-readline --without-zlib
     
    // 编译安装
    # make -sj4
    # make install -sj4
    

    输出 openGauss installation complete. 则安装成功。
    openGauss安装路径:GAUSSHOME
    openGauss二进制文件路径:GAUSSHOME/bin




posted @ 2021-08-18 12:11  邱明成  阅读(1393)  评论(0编辑  收藏  举报