首页 > 其他分享 >【我和openGauss的故事】构建openGauss开发编译提交一体化环境

【我和openGauss的故事】构建openGauss开发编译提交一体化环境

时间:2023-08-12 18:34:25浏览次数:33  
标签:git server 编译 构建 PATH openGauss gitee root

大数据模型 [openGauss](javascript:void(0);) 2023-07-29 17:58 发表于四川

前文

本文适合对openGauss源代码有好奇心的爱好者,那么一个友好的openGauss源代码环境应该是怎么样的。openGauss的开发环境是如何设置的?openGauss的编译环境是如何构建的?如何向openGauss提交代码,笔者集合官方和几位博主实践提供友好的openGauss源代码阅读环境。在这个环境,你可以阅读、可以开发、可以调试、可以运行。你可以马上把它提交gitee,也可以选择向openGauss合并。

需要windows主机,linux服务器,gitee帐号各一个,你需要准备以下:

  • centos7.6作为linux服务器,即调试编译环境,
  • Visual Studio code 1.80安装在windows主机上,即开发阅读环境
  • 确认已注册gitee帐号,已经拥有gitee用户名和gitee密码

openGauss源代码阅读环境的思路如下,分为4步走。

  1. 用自己帐号gitee把源码openGauss相关的都fork到自己的仓库下面
  2. centos7.6服务器上运行clone,把自己的远端代码全部弄下来。centos7.6服务器安装调试工具,验证调试代码可编译可运行【此刻已经有openGauss安装包生成】
  3. windows主机安装vscode,安装 Remote -SSHRemote - Development插件。安装后可以友好阅读并修改远端centos7.6的gauss内核代码,修改后保持同步。
  4. centos7.6服务器设置git环境,保持与自己的gitee仓库同步,等待自己的gitee仓库与opengauss审核 并合入。

第一步,克隆官方openGauss环境

登陆gitee,把官方openGauss的代码fork过来, https://gitee.com/opengauss/openGauss-server

点击fork

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_git

弹出窗口

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_bash_02

这时可以看到自己的仓库,https://gitee.com/xxxxx/openGauss-server

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_bash_03

第二步,centos7.6打造编译开发环境

此处需要openGauss-server、openGauss-OM和openGauss-5.0.0-CentOS-64bit-all.tar.gz

mkdir /tmp/omm500
cd  /tmp/omm500git clone https://gitee.com/opengauss/openGauss-OM.git
git clone  https://gitee.com/angryart/openGauss-server 
wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz


tar -xvf openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz


注入环境变量
yum remove libaio-devel libaio -y
yum install -y git gmp  gmp-devel  mpfr  mpfr-devel  libmpc  libmpc-devel libaio libaio-devel flex bison ncurese-devel glibc-devel patch rehat-lsb-core readline-devel perl gcc gcc-c++

# 配置环境变量
echo "export CODE_BASE=/tmp/omm500/openGauss-server     # Path of the openGauss-server file " >> ~/.bashrc
echo "export BINARYLIBS=/tmp/omm500/openGauss-third_party_binarylibs_Centos7.6_x86_64    # Path of the binarylibs file " >> ~/.bashrc
echo "export GAUSSHOME=\$CODE_BASE/dest/ " >> ~/.bashrc
echo "export GCC_PATH=\$BINARYLIBS/buildtools/gcc7.3/ " >> ~/.bashrc
echo "export CC=\$GCC_PATH/gcc/bin/gcc " >> ~/.bashrc
echo "export CXX=\$GCC_PATH/gcc/bin/g++ " >> ~/.bashrc
echo "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 " >> ~/.bashrc
echo "export PATH=\$GAUSSHOME/bin:\$GCC_PATH/gcc/bin:\$PATH " >> ~/.bashrc
echo "export PGDATA=/opt/omm500/data" >> ~/.bashrc
echo "export PGPORT=5432" >> ~/.bashrc
echo "export PGDATABASE=postgres" >> ~/.bashrc


# 加载环境变量
source ~/.bashrc

# 进入源码目录
cd $CODE_BASE

# 编译server (这里就是openGauss提供的一键式编译脚本)
sh build.sh -m release -3rd $BINARYLIBS   -pkg

如果成功编译好,如下界面

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_centos_04

chmod +x build.sh 
这个是opengauss安装的工具
 ./build.sh -3rd $BINARYLIBS_PATH

成功后,会有两个文件输出

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_git_05

第三步,windows vs code安装扩展插件连上仓库

windows下面已经安装好vs code,网上找,直接下一步下一步进行安装,准备安装

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_centos_06

选择Remote-SSHRemote Development

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_centos_07

依下图123,对目标服务器进行连接。

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_bash_08

点击框中搜索相关openGauss的目录

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_centos_09

修改源码,openGauss的内核代码是gausskernel下面, src\gausskernel\storage\access\archive\archive_am.cpp,增多一段 “Just for a test”

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_git_10

centos7.6下面查看 src\gausskernel\storage\access\archive\archive_am.cpp ,发现文件的确已经发生变化。

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_bash_11

第四步,centos7.6服务器设置git环境

[root@server131 omm500]# git config  --global  user.name "xxxx"    gitee帐号名称
[root@server131 omm500]# git config  --global  user.email "[email protected]"   gitee邮箱
[root@server131 omm500]# ssh-keygen  -t rsa  -C  "[email protected]"    gitee帐号密码
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:RDYDta9IiPzK5eZCXu8bU0kOgQuhim9SwvSuZJmsCEI [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|  .. .oo*        |
| .. .  + +       |
|.. . .. +        |
|=..... = o       |
|+E+.. . S .      |
|o+=... o .       |
|+Oooo.+ .        |
|B+++. .o         |
|o.o+o.o.         |
+----[SHA256]-----+
[root@server131 openGauss-server]# git clone  https://gitee.com/angryart/openGauss-server
[root@server131 openGauss-server]# 
git  remote  add upstream  https://gitee.com/opengauss/openGauss-server
[root@server131 openGauss-server]# git  remote  set-url  --push upstream no_push

提交代码
[root@server131 openGauss-server]# git add .
[root@server131 openGauss-server]# git commit -m "message"
[root@server131 openGauss-server]# git  push  origin   master

最后检验自己的仓库,已经提交成功

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_centos_12

下面是自己的远端仓库与openGauss同步,需要提交pull request

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_git_13

这里要写清楚改了什么,源分支是你修改的源代码, 目标分支是 openGauss侧的的,如果官方同意,就会把你的代码合并到里面去。

【我和openGauss的故事】构建openGauss开发编译提交一体化环境_bash_14

标签:git,server,编译,构建,PATH,openGauss,gitee,root
From: https://blog.51cto.com/u_16191492/7060799

相关文章

  • 【我和openGauss的故事】体验openGauss 5.0极简版一主一备部署,延时回放和主备切换功能
    三人禾openGauss2023-07-2917:58发表于四川收录于合集#第六届openGauss技术文章征集初审合格文章62个概要openGauss的安装在官方文档的描述中,以企业生产环境为标准进行安装部署较为详细。但在个人基本的功能测试需求下,这样的安装操作显得有些复杂。极简版安装的使用主体主要针......
  • 【我和openGauss的故事】kettle连接openGauss 5.0.0 数据库
    IT烧麦[openGauss](javascript:void(0);)2023-07-2917:58发表于四川前言Kettle介绍(来源百度百科)Kettle最早是一个开源的ETL工具,全称为KDEExtraction,Transportation,TransformationandLoadingEnvironment。在2006年,Pentaho公司收购了Kettle项目,原Kettle项目发起人MattCa......
  • 【我和openGauss的故事】openGauss 3.1.1企业版主备集群升级至5.0.0操作指南
    尚雷openGauss2023-07-2917:58发表于四川收录于合集#第六届openGauss技术文章征集初审合格文章62个前言:继前几日测试部署openGauss5.0并写了[[Centos/RHEL7安装部署openGauss5.0企业版一主二备一级联操作指南]](http://mp.weixin.qq.com/s?__biz=MzIyMDE3ODk1Nw==&mid=2......
  • 【我和openGauss的故事】openGauss5.0企业版集群一主一备安装V1.0
    王zz[openGauss](javascript:void(0);)2023-07-2917:58发表于四川收录于合集#第六届openGauss技术文章征集初审合格文章62个一、基本环境文档说明:本方案只有主备数据同步,没有自动故障诊断、切换。安装方式:利用xml配置文件管理工具:om方式二、系统环境设置类型系统版本IP用户名/......
  • 【我和openGauss的故事】openGauss初体验
    T[openGauss](javascript:void(0);)2023-07-2917:58发表于四川收录于合集#第六届openGauss技术文章征集初审合格文章62个一:openGauss环境准备1.安装openGauss个人如果要使用openGauss数据库可以在本地进行安装,由于我们使用的大多是windows系统,而openGauss的安装只支持在Linux......
  • 【我和openGauss的故事】openGauss索引推荐功能测试
    _openGauss2023-07-2818:22发表于四川收录于合集#第六届openGauss技术文章征集初审合格文章62个一、单索引推荐单索引推荐功能,目前支持select查询,看官方介绍类似oracle中的sql_tunning_adviser,不过只是推荐创建索引。根据sql优化原理,猜测应该时根据选择来推荐索引。1、查看sql......
  • 【我和openGauss的故事】openGauss主备集群节点的添加与删除
    风一样自由openGauss2023-07-2917:58发表于四川一.环境准备已搭建openGauss一主两备集群(企业版5.0),环境如下:主机IP主机名节点类型10.100.10.92yf1主节点10.100.10.93yf2备节点10.100.10.94yf3备节点二.gs_dropnode删除集群备节点拟删除10.100.10.94节点。1.前提条件删除备......
  • openGauss数据库源码解析系列文章——安全管理源码解析(三)
    Gauss松鼠会[openGauss](javascript:void(0);)2023-07-2917:58发表于四川在上篇openGauss数据库源码解析系列文章——安全管理源码解析(一)我们围绕安全管理整体架构和代码概览、安全认证原理介绍和代码解析进行了简单介绍。本篇将继续角色管理、对象权限管理的学习,全文阅读需要3......
  • openGauss数据库源码解析系列文章——安全管理源码解析(四)
    四、对象权限管理权限管理是安全管理重要的一环,openGauss权限管理基于访问控制列表(accesscontrollist,ACL)实现。4.1权限管理1.访问控制列表访问控制列表是实现数据库对象权限管理的基础,每个对象都具有ACL,存储该对象的所有授权信息。当用户访问对象时,只有用户在对象的ACL中并且......
  • VS2019编译CloudCompare2.12.4
    参考:https://blog.csdn.net/pingfanderen5/article/details/1261800821.VisualStudio2019对应v142工具2.安装QT,qt5.14.2及以前的版本存在下载包,下载地址:http://download.qt.io/ ,但是5.14.2只能支持到VS2017。 所以采用在线安装的方式安装qt5.15.2版本 源码准......