---
title: openGauss 3.0版本源码编译安装指南-官方技术文章-鲲鹏社区
description: 本文将主要介绍在centos-8上从源码构建安装openGauss 3.0企业版的过程。
keywords: 版本源码编译,安装指南,官方技术文章,鲲鹏社区,BINARYLIBS,GAUSSHOME,CC,CXX
url: https://www.hikunpeng.com/developer/techArticles/20230914-8?envFlag=1
section: (其他)
---

# openGauss 3.0版本源码编译安装指南-官方技术文章-鲲鹏社区

URL: https://www.hikunpeng.com/developer/techArticles/20230914-8?envFlag=1
描述: 本文将主要介绍在centos-8上从源码构建安装openGauss 3.0企业版的过程。
关键词: 版本源码编译,安装指南,官方技术文章,鲲鹏社区,BINARYLIBS,GAUSSHOME,CC,CXX

官方技术文章 [了解详情](https://www.hikunpeng.com/zh/developer/techArticles)

openGauss 3.0版本源码编译安装指南

openGauss 3.0版本源码编译安装指南

实战经验

发表于 2022/06/20

0

openGauss 3.0版本自4月1日上线以来得到小伙伴们的广泛关注，本文将介绍在centos-8上从源码构建安装openGauss 3.0企业版的过程。

1、安装依赖包

```
yum install -y libaio-devel ncurses-devel pam-devel libffi-devel python3-devel libtool libtool-ltdl openssl-devel bison flex glibc-devel patch readline-devel lsb_release
```

2、添加openGauss用户

```
useradd openGauss
```

3、下载三方依赖包

（1）切换到openGauss用户

```
su - openGauss
```

（2）下载三方依赖包

```
wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.0.0/openGauss-third_party_binarylibs.tar.gz
```

（3）解压三方包并重命名

```
tar -zxf openGauss-third_party_binarylibs.tar.gz
mv openGauss-third_party_binarylibs binarylibs
```

4、下载openGauss-server源码

（1） 下载openGauss-server源码

```
git clone https://gitcode.com/opengauss/openGauss-third_party.git
```

（2）切换到3.0.0版本的tag

```
git checkout 3.0.0
```

5、在~/.bashrc中添加如下环境变量

```
export CODE_BASE=/home/openGauss/openGauss-server
export BINARYLIBS=/home/openGauss/binarylibs
export GAUSSHOME=/home/openGauss/install/
export GCC_PATH=$BINARYLIBS/buildtools/centos7.6_x86_64/gcc7.3/
export CC=$GCC_PATH/gcc/bin/gcc
export CXX=$GCC_PATH/gcc/bin/g++
export LD_LIBRARY_PATH=$GAUSSHOME/lib:$GCC_PATH/gcc/lib64:$GCC_PATH/isl/lib:$GCC_PATH/mpc/lib/:$GCC_PATH/mpfr/lib/:$GCC_PATH/gmp/lib/:$LD_LIBRARY_PATH
export PATH=$GAUSSHOME/bin:$GCC_PATH/gcc/bin:$PATH
```

6、执行命令source ~/.bashrc使环境变量生效

7、进入openGauss-server目录，执行以下命令，进行配置编译

```
./configure --gcc-version=7.3.0 CC=g++ CFLAGS='-O0' --prefix=$GAUSSHOME --3rd=$BINARYLIBS --enable-debug --enable-cassert --enable-thread-safety --with-readline --without-zlib
make -sj 8
```

8、执行make install安装openGauss数据库

9、创建数据目录，并初始化数据库

```
mkdir /home/openGauss/install/data
gs_initdb -D /home/openGauss/install/data/datanode1 --nodename=datanode1
```

10、初始化成功以后，显示如下

11、现在就可以启动数据库了，启动停止命令如下

```
gs_ctl start -D /home/openGauss/install/data/datanode1 -Z single_node -l /home/openGauss/gauss.log
gs_ctl stop -D /home/openGauss/install/data/datanode1
```

问题记录：

1、如果编译时报错，报python文件找不到，则可以安装python2，并将python2软连接为python

```
yum install python2
ln -s /usr/bin/python2 /usr/bin/python
```

2、gs_initdb初始化时报错如下，需要安装libnsl依赖

3、gs_initdb报错如下，需要修改配置文件/etc/profile，在最后增加的LANG设置，设置为locale -a能查到的值即可，比如en_US.utf8

```
export LANG=en_US.utf8
```

欢迎访问openGauss官方网站

openGauss开源社区官方网站：

https://opengauss.org/ [了解详情](https://opengauss.org)

openGauss组织仓库：

https://gitcode.com/opengauss [了解详情](https://gitcode.com/opengauss)

openGauss镜像仓库：

https://github.com/opengauss-mirror [了解详情](https://github.com/opengauss-mirror)
