openEuler下安装openguess6.0.5(极简版,原始方式安装)

环境:
OS:openEuler 22
openGauss:6.0.5

1.下载安装介质
下载地址
https://opengauss.org/zh/download.html
我这里下载的是
openGauss-All-6.0.5-openEuler22.03-x86_64.tar.gz

 

2.将下载安装包上传到服务器 /soft/opengauss 目录下

[root@localhost opengauss]# ls -1
openGauss-All-6.0.5-openEuler22.03-x86_64.tar.gz

[root@localhost opengauss]# yum install tar
[root@localhost opengauss]# tar -xvf openGauss-All-6.0.5-openEuler22.03-x86_64.tar.gz
[root@localhost opengauss]# ls -1
openGauss-All-6.0.5-openEuler22.03-x86_64.tar.gz
openGauss-CM-6.0.5-openEuler22.03-x86_64.sha256
openGauss-CM-6.0.5-openEuler22.03-x86_64.tar.gz
openGauss-OM-6.0.5-openEuler22.03-x86_64.sha256
openGauss-OM-6.0.5-openEuler22.03-x86_64.tar.gz
openGauss-Server-6.0.5-openEuler22.03-x86_64.sha256
openGauss-Server-6.0.5-openEuler22.03-x86_64.tar.bz2
upgrade_sql.sha256
upgrade_sql.tar.gz

 


我们采用极简版安装,只需要如下安装包即可
openGauss-Server-6.0.5-openEuler22.03-x86_64.tar.bz2

 

3.安装依赖包
yum install libaio-devel
yum install flex
yum install bison
yum install ncurses-devel
yum install glibc-devel
yum install patch
yum install redhat-lsb-core--xx
yum install readline-devel

 

4.关闭防火墙
systemctl stop firewalld
禁止开机自启
systemctl disable firewalld

 

5.创建相关目录,用户,组
root账号下操作
[root@host134 ~]#groupadd dbgrp -g 2000
[root@host134 ~]#useradd omm -g 2000 -u 2000
[root@host134 ~]#echo "oracle" | passwd --stdin omm
[root@host134 ~]#mkdir -p /opt/opengauss/software ##软件安装目录
[root@host134 ~]#mkdir -p /opt/opengauss/data ##数据目录
[root@host134 ~]#mkdir -p /opt/opengauss/log ##这个目录是opengauss软件的日志目录,数据库的日志目录还是存在../data/pg_log目录
[root@host134 ~]#chown -R omm:dbgrp /opt/opengauss

 

6.解压二进制文件
[omm@host134 opengauss]# cd /soft/opengauss
[omm@host134 opengauss]# tar -jxf openGauss-Server-6.0.5-openEuler22.03-x86_64.tar.bz2 -C /opt/opengauss/software/

[root@host134 ~]#chown -R omm:dbgrp /opt/opengauss

 


7.设置用户omm环境变量
su - omm
cd ~
vi .bashrc
添加如下内容
export GAUSSHOME=/opt/opengauss/software
export GAUSSLOG=/opt/opengauss/log
export PATH=$GAUSSHOME/bin:$PATH
export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH
退出后重新登录

 

8.初始化数据库
su - omm
[omm@localhost ~]$ cd /opt/opengauss/software/bin
[omm@localhost ~]$./gs_initdb --pgdata=/opt/opengauss/data --nodename=slnngk --encoding=UTF-8 --locale=en_US.UTF-8

参数说明:
--nodename=NODENAME name of single node initialized
单机模式,随便取一个合法短名即可

 

9.修改初始化参数
pg_hba.conf文件

vi /opt/opengauss/data/pg_hba.conf

host all all 0.0.0.0/0 md5

 

postgresql.conf文件
vi /opt/opengauss/data/postgresql.conf

port=5432
max_connections = 4000
listen_addresses = '*'
password_encryption_type = 0

 

10.启动数据库

[omm@localhost data]$ cd /opt/opengauss/software/bin
[omm@localhost data]$./gs_ctl start -D /opt/opengauss/data
[2026-07-01 15:40:16.625][3265][][gs_ctl]: gs_ctl started,datadir is /opt/opengauss/data 
[2026-07-01 15:40:16.640][3265][][gs_ctl]: waiting for server to start...
.0 LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.

0 LOG:  [Alarm Module]Host Name: localhost.localdomain 

0 LOG:  [Alarm Module]Host IP: localhost.localdomain. Copy hostname directly in case of taking 10s to use 'gethostbyname' when /etc/hosts does not contain <HOST IP>

0 LOG:  [Alarm Module]Get ENV GS_CLUSTER_NAME failed!

0 LOG:  [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 57

0 WARNING:  failed to open feature control file, please check whether it exists: FileName=gaussdb.version, Errno=2, Errmessage=No such file or directory.
0 WARNING:  failed to parse feature control file: gaussdb.version.
0 WARNING:  Failed to load the product control file, so gaussdb cannot distinguish product version.
The core dump path is an invalid directory
2026-07-01 15:40:16.677 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] LOG:  when starting as multi_standby mode, we couldn't support data replicaton.
2026-07-01 15:40:16.677 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] LOG:  base_page_saved_interval is 400, ori is 400.
2026-07-01 15:40:16.683 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] LOG:  loaded library "security_plugin"
2026-07-01 15:40:16.684 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2026-07-01 15:40:16.684 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2026-07-01 15:40:16.685 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] LOG:  InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2026-07-01 15:40:16.685 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for backend threads is: 220 MB
2026-07-01 15:40:16.685 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for WAL buffers is: 128 MB
2026-07-01 15:40:16.685 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] LOG:  Set max backend reserve memory is: 348 MB, max dynamic memory is: 8120 MB
2026-07-01 15:40:16.685 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] LOG:  shared memory 3307 Mbytes, memory context 8468 Mbytes, max process memory 12288 Mbytes
2026-07-01 15:40:16.736 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [CACHE] LOG:  set data cache  size(402653184)
2026-07-01 15:40:16.773 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [SEGMENT_PAGE] LOG:  Segment-page constants: DF_MAP_SIZE: 8156, DF_MAP_BIT_CNT: 65248, DF_MAP_GROUP_EXTENTS: 4175872, IPBLOCK_SIZE: 8168, EXTENTS_PER_IPBLOCK: 1021, IPBLOCK_GROUP_SIZE: 4090, BMT_HEADER_LEVEL0_TOTAL_PAGES: 8323072, BktMapEntryNumberPerBlock: 2038, BktMapBlockNumber: 25, BktBitMaxMapCnt: 512
2026-07-01 15:40:16.784 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] LOG:  gaussdb: fsync file "/opt/opengauss/data/gaussdb.state.temp" success
2026-07-01 15:40:16.784 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] LOG:  create gaussdb state file success: db state(STARTING_STATE), server mode(Normal), connection index(1)
2026-07-01 15:40:16.784 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] LOG:  max_safe_fds = 976, usable_fds = 1000, already_open = 14
The core dump path is an invalid directory
2026-07-01 15:40:16.787 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] LOG:  the configure file /opt/opengauss/software/etc/gscgroup_omm.cfg doesn't exist or the size of configure file has changed. Please create it by root user!
2026-07-01 15:40:16.787 [unknown] [unknown] localhost 140421519297536 0[0:0#0]  0 [BACKEND] LOG:  Failed to parse cgroup config file.

[2026-07-01 15:40:17.647][3265][][gs_ctl]:  done
[2026-07-01 15:40:17.647][3265][][gs_ctl]: server started (/opt/opengauss/data)

 

11.登陆

cd /opt/opengauss/software/bin
[omm@localhost bin]$ ./gsql -d postgres -p 5432
gsql ((openGauss 6.0.5 build 5ba692ab) compiled at 2026-05-07 12:36:04 commit 0 last mr 9228 )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

修改密码
openGauss=# \du
ERROR:  Please use "ALTER ROLE "omm" PASSWORD 'password';" to set the password of the user before other operations!
openGauss=# ALTER USER omm WITH PASSWORD 'Gauss@123456';
NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.
ALTER ROLE

 

12.查看状态

[omm@localhost bin]$ gs_ctl query -D /opt/opengauss/data
[2026-07-01 15:13:26.167][2851][][gs_ctl]: gs_ctl query ,datadir is /opt/opengauss/data 
 HA state:           
        local_role                     : Normal
        static_connections             : 0
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
No information 
 Receiver info:      
No information 

 

12.创建数据库和用户用户

gsql -d postgres -p 5432

openGauss=# create database db_test with encoding 'utf8' template = template0;
CREATE DATABASE

openGauss=# create user hxl password 'Gauss@123456';
NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.
CREATE ROLE

openGauss=# grant all privileges to hxl;

 

13.使用开发用户登陆

[omm@host134 data]$ gsql -U hxl -d db_test -h 127.0.0.1 -p 5432
Password for user hxl:
这里输入密码
db_test=> create table public.tb_test(id number,name varchar(32));
ERROR: permission denied for schema public
DETAIL: N/A


若是没有授予grant all privileges to hxl 权限就会报这个错误

 

14.停掉数据库

[omm@localhost data]$ cd /opt/opengauss/software/bin
[omm@localhost data]$./gs_ctl stop -D /opt/opengauss/data

 

15.客户端连接

image

 

 

posted @ 2026-07-01 15:58  slnngk  阅读(1)  评论(0)    收藏  举报