本文基于openEuler-22.03-LTS-SP4底包,使用rpm安装方式构建opengauss 2.1.0 单机轻量版数据库容器。
一、openEuler-22.03-LTS-SP4底包
1、下载镜像
下载链接
sha256:ffe6c97428d6e684519dd670c18d6681861bdc17719b0387c6e11a65e37a771f openEuler-docker.x86_64.tar.xz
[root@localhost opengauss-2.1.0-oe2203sp3]# wget https://mirrors.huaweicloud.com/openeuler/openEuler-22.03-LTS-SP3/docker_img/x86_64/openEuler-docker.x86_64.tar.xz
--2024-01-11 09:39:05-- https://mirrors.huaweicloud.com/openeuler/openEuler-22.03-LTS-SP3/docker_img/x86_64/openEuler-docker.x86_64.tar.xz
正在解析主机 mirrors.huaweicloud.com (mirrors.huaweicloud.com)... 124.70.125.167, 124.70.125.153
正在连接 mirrors.huaweicloud.com (mirrors.huaweicloud.com)|124.70.125.167|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:46341592 (44M) [application/octet-stream]
正在保存至: “openEuler-docker.x86_64.tar.xz”
openEuler-docker.x86_64.tar. 100%[==============================================>] 44.19M 3.09MB/s 用时 14s
2024-01-11 09:39:20 (3.10 MB/s) - 已保存 “openEuler-docker.x86_64.tar.xz” [46341592/46341592])
[root@localhost opengauss-2.1.0-oe2203sp3]# sha256sum openEuler-docker.x86_64.tar.xz
ffe6c97428d6e684519dd670c18d6681861bdc17719b0387c6e11a65e37a771f openEuler-docker.x86_64.tar.xz
2、导入镜像
[root@localhost opengauss-2.1.0-oe2203sp3]# docker load -i openEuler-docker.x86_64.tar.xz
eb07c1d8d1a9: Loading layer [==================================================>] 196.6MB/196.6MB
Loaded image: openeuler-22.03-lts-sp3:latest
[root@localhost opengauss-2.1.0-oe2203sp3]# docker images|grep 22
openeuler-22.03-lts-sp3 latest 7b4b6722a80d 8 days ago 189MB
二、容器制作
- 在openEuler 22.03 LTS 版本的操作系统上yum方式安装仅支持openGauss轻量版。
- RPM方式安装的仅为单机版数据库实例,升级时候只能替换二进制,不支持灰度升级。
- 默认安装实例监听127.0.0.1:7654地址和端口。如果需要进行远程连接,需要手动修改postgresql.conf文件中的listen_address。
- 安装数据库默认创建用户openGauss,卸载数据库后不删除该用户。
1、启动容器
[root@localhost opengauss-2.1.0-oe2203sp3]# docker run -itd --restart=always --name opengauss --privileged -p 7654:7654 -v /etc/localtime:/etc/localtime:ro openeuler-22.03-lts-sp3:latest /bin/bash
22bab46d8b1d52080f6ec29881a12e20e79d4355b5f8416349661c376f1dcd71
2、进入容器
[root@localhost opengauss-2.1.0-oe2203sp3]# docker exec -it opengauss /bin/bash
Welcome to 5.10.0-60.18.0.50.oe2203.x86_64
System information as of time: Thu Jan 11 09:49:40 CST 2024
System load: 0.02
Processes: 6
Memory used: 13.2%
Swap used: 3.1%
Usage On: 75%
Users online: 0
[root@22bab46d8b1d /]
3、YUM安装opengauss
[root@22bab46d8b1d /]# yum install opengauss
OS 848 kB/s | 3.4 MB 00:04
everything 8.0 MB/s | 17 MB 00:02
EPOL 4.3 MB/s | 4.7 MB 00:01
debuginfo 3.6 MB/s | 4.0 MB 00:01
source 1.8 MB/s | 1.8 MB 00:01
update 328 B/s | 257 B 00:00
update-source 342 B/s | 257 B 00:00
Dependencies resolved.
====================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================
Installing:
opengauss x86_64 2.1.0-9.oe2203sp3 OS 14 M
Installing dependencies:
DCF x86_64 1.0.0-5.oe2203sp3 OS 285 k
acl x86_64 2.3.1-2.oe2203sp3
...
Installed:
DCF-1.0.0-5.oe2203sp3.x86_64
acl-2.3.1-2.oe2203sp3.x86_64
alsa-lib-1.2.5.1-3.oe2203sp3.x86_64
atk-2.38.0-1.oe2203sp3.x86_64
avahi-libs-0.8-18.oe2203sp3.x86_64
binutils-2.37-24.oe2203sp3.x86_64
boost-1.78.0-17.oe2203sp3.x86_64
boost-atomic-1.78.0-17.oe2203sp3.x86_64
boost-chrono-1.78.0-17.oe2203sp3.x86_64
boost-container-1.78.0-17.oe2203sp3.x86_64
boost-context-1.78.0-17.oe2203sp3.x86_64
boost-contract-1.78.0-17.oe2203sp3.x86_64
boost-coroutine-1.78.0-17.oe2203sp3.x86_64
boost-date-time-1.78.0-17.oe2203sp3.x86_64
boost-devel-1.78.0-17.oe2203sp3.x86_64
boost-fiber-1.78.0-17.oe2203sp3.x86_64
boost-filesystem-1.78.0-17.oe2203sp3.x86_64
boost-graph-1.78.0-17.oe2203sp3.x86_64
boost-iostreams-1.78.0-17.oe2203sp3.x86_64
boost-json-1.78.0-17.oe2203sp3.x86_64
boost-locale-1.78.0-17.oe2203sp3.x86_64
boost-log-1.78.0-17.oe2203sp3.x86_64
boost-math-1.78.0-17.oe2203sp3.x86_64
boost-nowide-1.78.0-17.oe2203sp3.x86_64
boost-program-options-1.78.0-17.oe2203sp3.x86_64
boost-python3-1.78.0-17.oe2203sp3.x86_64
boost-random-1.78.0-17.oe2203sp3.x86_64
boost-regex-1.78.0-17.oe2203sp3.x86_64