openEuler安装openGauss

openEuler安装openGauss

概述

说明:

软件说明备注
宿主机CPUAMD Ryzen 7 8845H w/ Radeon 780M Graphics 3.80 GHz
宿主机系统Windows 11 家庭中文版,23H2
虚拟机VMware Workstation Pro 17.0 for Personal Use (Windows)博通免费版
虚拟机配置4C8G
虚拟机系统openEuler 22.03 LTS SP3,最小安装
数据库openGauss_5.0.2 极简版

VMware Workstation Pro 17.0 for Personal Use (Windows):https://support.broadcom.com/group/ecx/productdownloads?subfamily=VMware%20Workstation%20Pro

openEuler 22.03 LTS SP3:https://www.openeuler.org/zh/download

openGauss_5.0.2 极简版:https://opengauss.org/zh/download/

openGauss_5.0.2 极简安装版官方文档:https://docs-opengauss.osinfra.cn/zh/docs/5.0.0/docs/InstallationGuide/InstallationGuide.html

openEuler 22.03 LTS SP3 安装文档:https://docs.openeuler.org/zh/docs/22.03_LTS_SP3/docs/Installation/installation.html

安装前准备

1、获取安装包

登录opengauss社区下载,链接在前面

curl -O https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.2/x86_openEuler_2203/openGauss-5.0.2-openEuler-64bit.tar.bz2

2、官方文档提到的bzip2已安装,Python符合要求,不需要修改

但是没有 tar 工具,后续解压安装包需要,所以要安装。

yum install tar

3、安装依赖

所需软件建议版本
flex要求版本:2.5.31 以上
bison建议版本:2.7-4
ncurses-devel建议版本:5.9-13.20130511
glibc-devel建议版本:2.17-111
patch建议版本:2.7.1-10
readline-devel建议版本:7.0-13
libnsl建议版本 :2.28-36
libaio-devel建议版本:0.3以上
redhat-lsb-core建议版本:4.1

redhat-lsb-core 这个包在openeuler中没有,可以安装 openeuler-lsb

安装

yum install flex bison ncurses-devel glibc-devel patch readline-devel libnsl libaio-devel
yum install openeuler-lsb

4、设置主机名和设置hosts(之前没有设置的需要设置)

为了更好的使用系统和软件,设置主机名

hostnamectl set-hostname openeuler.example.com
echo "$(hostname -I) openeuler.example.com openeuler" >> /etc/hosts

# 检查是否生效
hostname
hostname -a 
hostname -f

5、关闭防火墙

测试环境为了方便关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service
# 查看是否关闭
systemctl status firewalld.service

5、关闭selinux

关闭selinux

sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
# 查看是否修改成功
grep "^SELINUX=" /etc/selinux/config 

setenforce 0 # 临时关闭
# 输入 getenforce 返回 Permissive 则是临时关闭状态,
# 重启后是 Disabled ,完全关闭状态。
getenforce
sestatus

6、创建具有免密sudo的普通用户opengauss

groupadd opengauss
useradd -g opengauss -d /opt/opengauss -m opengauss
echo opengauss | passwd --stdin opengauss
echo "opengauss ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

7、修改openfile,否则后续报错

cat << EOF >> /etc/security/limits.conf
# opengauss database user settings
opengauss soft nofile 1000000
opengauss hard nofile 1000000
EOF

# 检查是否生效,结果为: 1000000
su - opengauss -c "ulimit -n"

8、重启

reboot

安装opengauss

官方文档前提条件

  • 已完成用户组和普通用户的创建。
  • 所有服务器操作系统和网络均正常运行。
  • 普通用户必须有数据库包解压路径、安装路径的读、写和执行操作权限,并且安装路径必须为空。
  • 普通用户对下载的openGauss压缩包有执行权限。
  • 安装前请检查指定的openGauss端口是否被占用,如果被占用请更改端口或者停止当前使用端口进程。

1、上传安装包

这个可以使用工具上传,Windows scp,或者在linux上直接下载。

2、解压安装包

mkdir /opt/opengauss/opengauss
tar -jxf openGauss-5.0.2-openEuler-64bit.tar.bz2 -C /opt/opengauss/opengauss

3、安装数opengauss

把 password 修改成自己的密码,安装目录和这个安装包目录分离开来

cd /opt/opengauss/opengauss/simpleInstall/
sh install.sh -w "openGauss@123" # 不能使用简单密码,密码需要包含多种字符
source ~/.bashrc
  • -w:初始化数据库密码(gs_initdb指定),因安全需要,此项必须设置。
  • -p:指定openGauss端口号,如不指定,默认为5432。
  • -h|–help:打印使用说明。
  • 安装后,该数据库部署节点的名称为sgnode(gs_initdb指定)。
  • 安装后,数据库目录安装路径/opt/software/openGauss/data/single_node,其中/opt/software/openGauss为解压包路径,data/single_node为新创建的数据库节点目录。
  • 安装完成后,默认生成名称为postgres的数据库。第一次连接数据库时可以连接到此数据库。

4、查看进程是否正常

ps -ef | grep gaussdb
gs_ctl query -D /opt/opengauss/opengauss/data/single_node

输出如下:

[opengauss@openeuler ~]$ gs_ctl query -D /opt/opengauss/opengauss/data/single_node
[2024-05-22 18:29:54.031][8441][][gs_ctl]: gs_ctl query ,datadir is /opt/opengauss/opengauss/data/single_node
 HA state:
        local_role                     : Normal
        static_connections             : 0
        db_state                       : Normal
        detail_information             : Normal

 Senders info:
No information
 Receiver info:
No information

opengauss 的启动、停止、重启命令。

gs_ctl start|stop|restart -D $GAUSSHOME/data/single_node -Z single_node

连接opengauss

本地连接

gsql -D postgres

远程链接

需要修改文件: vim postgresql.conf

listen_addresses = '*'

修改文件:pg_hba.conf

echo "host all all 0.0.0.0/0 md5" >> /opt/opengauss/opengauss/data/single_node/pg_hba.conf

重启

gs_ctl restart -D $GAUSSHOME/data/single_node -Z single_node

连接

CREATE USER jack PASSWORD 'Admin@1234.';  
gsql -d postgres -U jack -p 5432 -h 192.168.244.130 -W "Admin@1234."

成功安装。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

之芫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值