本文适用于openGauss1.1.0

环境:centos7.6_x86_64

一、官方参考

项目地址:

https://gitee.com/opengauss/openGauss-server

官方编译说明:

https://gitee.com/opengauss/openGauss-server#编译

二、步骤

假设文件路径全部在:/opt/openGauss/

准备文件

编译

以下编译debug版本:

snippet.bash
[yz@test ~]$ cd /opt/openGauss/openGauss-server
[yz@test openGauss-server]$ sh build.sh -m debug -3rd /opt/openGauss/binarylibs
ROOT_DIR : /opt/openGauss/openGauss-server
Everything is ready.
begin to make distclean
Begin configure, Please wait a few minutes...
End configure
Begin make compile database, Please wait a few minutes...
make compile sucessfully!

当看到“make compile sucessfully!”提示时,表示编译成功,如果编译失败,可以查看make_compile.log分析失败原因。

编译后,二进制文件在:

/opt/openGauss/openGauss-server/dest

初始化

snippet.bash
[yz@test ~]$ export LD_LIBRARY_PATH=/opt/openGauss/openGauss-server/dest/lib/:$LD_LIBRARY_PATH
[yz@test ~]$ cd /opt/openGauss/openGauss-server/dest/bin
[yz@test bin]$ ./gs_initdb -D /opt/openGauss/gauss_data/ --nodename=gauss
……
Success. You can now start the database server of single node using:
 
    ./gaussdb -D /opt/openGauss/gauss_data
or
    ./gs_ctl start -D /opt/openGauss/gauss_data -l logfile

启动与客户端连接

snippet.bash
[yz@test ~]$ cd /opt/openGauss/openGauss-server/dest/bin
[yz@test bin]$ ./gs_ctl start -D /opt/openGauss/gauss_data -l logfile
[yz@test bin]$ ./gsql postgres
gsql ((openGauss 1.0.1 build ) compiled at 2021-03-10 10:23:33 commit 0 last mr  debug)
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
 
postgres=# 

加载

加载方法参考PostgreSQL,但是要求数据文件必须放到数据目录下的pg_copydir子目录中,对应上述示例,即:

/opt/openGauss/gauss_data/gauss_data/pg_copydir/

三、问题

Redhat

openGauss目前仅支持以下操作系统:

尝试在其它系统上编译,请先修改:/opt/openGauss/openGauss-server/src/get_PlatForm_str.sh,绕过系统检查。