opengauss-使用docker任意系统编译opengauss

使用docker任意系统编译opengauss

本人使用开发机器为ubuntu系统,不在官方推荐的编译系统内。但是不想为了开发opengauss重装系统。所以采用docker进行编译。

  1. 代码拉取

本人是在/home/yuyang/Documents/opengauss目录下进行操作。

先获取源代码:git clone https://gitee.com/opengauss/openGauss-server.git

直接下载编译好的依赖:https://opengauss.obs.cn-south-1.myhuaweicloud.com/latest/binarylibs/gcc10.3/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz

下载地址见:https://gitee.com/opengauss/openGauss-server#%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E5%92%8C%E8%BD%AF%E4%BB%B6%E4%BE%9D%E8%B5%96%E8%A6%81%E6%B1%82中列表

解压后,修改文件夹名称为binarylibs

yuyang@yuyang-MS-7D97:~/Documents/opengauss$ ls
binarylibs  openGauss-server  openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz
  1. 镜像拉取&启动

镜像拉取:

docker pull centos:centos7.6.1810

镜像启动:

docker run -itd -v /home/yuyang/Documents/opengauss:/sda --network host --name centos-test centos:centos7.6.1810 
  • 将工作目录/home/yuyang/Documents/opengauss映射到docker容器中的/sda
  • 使用host网络,需要拉取依赖
  1. 进入容器
docker exec -it centos-test bash
  1. 配置容器中镜像源

/etc/yum.repos.d/下的文件都清除,创建Centos-7.repo文件:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        https://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        https://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        https://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
        https://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        https://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
        https://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        https://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
        https://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
        https://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
        https://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  1. 安装依赖

官方表格中的依赖:

yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch lsb_release readline-devel

同时在编译中发现还需要安装:

yum install -y make witch python3 perl
  1. 编译

进入/sda/openGauss-server目录:

sh build.sh -m debug -3rd /sda/binarylibs 

编译完成

posted @ 2025-04-20 14:35  余为民同志  阅读(129)  评论(0)    收藏  举报