Centos7.6安装openGauss
Posted 字如其名
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7.6安装openGauss相关的知识,希望对你有一定的参考价值。
1查看系统版本
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
2关闭防火墙,sellinux
systemctl disable firewalld.service && systemctl stop firewalld.service
[root@localhost ~]# vi /etc/selinux/config
[root@localhost ~]# setenforce 0
3修改hostname
[root@localhost ~]# hostnamectl set-hostname carl
[root@localhost ~]# cat /etc/hostname
carl
4关闭交换分区
[root@localhost ~]#swapoff -a
5添加163源
cat > /etc/yum.repos.d/163.repo <<EOF
[163]
name=163
baseurl=http://mirrors.163.com/centos/7/os/x86_64/
gpgcheck=0
enabled=1
EOF
6配置DNS
cat > /etc/resolv.conf <<EOF
nameserver 114.114.114.114
nameserver 1.2.4.8
EOF
7安装依赖包
yum -y install wget python3* bzip2 libaio-devel flex bison ncurses-devel
8创建文件夹,下载软件并解压
mkdir -p /opt/software/openGauss && chmod 755 -R /opt/software && cd /opt/software/openGauss
wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/1.0.0/x86/openGauss-1.0.0-CentOS-64bit.tar.gz
tar -zxvf openGauss-1.0.0-CentOS-64bit.tar.gz
9添加临时环境变量
export LD_LIBRARY_PATH=/opt/software/openGauss/script/gspylib/clib:$LD_LIBRARY_PATH
10创建配置文件
cat > clusterconfig.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<!-- openGauss整体信息 -->
<CLUSTER>
<PARAM name="clusterName" value="dbCluster" />
<PARAM name="nodeNames" value="carl" />
<PARAM name="backIp1s" value="192.168.5.223"/>
<PARAM name="gaussdbAppPath" value="/opt/huawei/install/app" />
<PARAM name="gaussdbLogPath" value="/var/log/omm" />
<PARAM name="tmpMppdbPath" value="/opt/huawei/tmp" />
<PARAM name="gaussdbToolPath" value="/opt/huawei/install/om" />
<PARAM name="corePath" value="/opt/huawei/corefile" />
<PARAM name="clusterType" value="single-inst"/>
</CLUSTER>
<!-- 每台服务器上的节点部署信息 -->
<DEVICELIST>
<!-- node1上的节点部署信息 -->
<DEVICE sn="1000001">
<PARAM name="name" value="carl"/>
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<!-- 如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
<PARAM name="backIp1" value="192.168.5.223"/>
<PARAM name="sshIp1" value="192.168.5.223"/>
<!--dbnode-->
<PARAM name="dataNum" value="1"/>
<PARAM name="dataPortBase" value="26000"/>
<PARAM name="dataNode1" value="/opt/huawei/install/data/db1"/>
</DEVICE>
</DEVICELIST>
</ROOT>
EOF
11preinstall
cd /opt/software/openGauss/script
./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.xml
12切换用户安装openGauss
su - omm
gs_install -X /opt/software/openGauss/clusterconfig.xml
13登录数据库
[omm@carl ~]$ gsql -d postgres -p 26000
gsql ((openGauss 1.0.0 build 0bd0ce80) compiled at 2020-06-30 18:19:27 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
14首次登录需要更改用户密码
15创建用户表空间数据库
postgres=# create user carl identified by 'A@123456';
CREATE ROLE
postgres=# create tablespace carl owner carl relative location 'tbs' maxsize '100m';
CREATE TABLESPACE
postgres=# create database carl with owner=carl tablespace=carl;
CREATE DATABASE
postgres=# grant all on database carl to carl;
GRANT
postgres-#
16使用carl登录数据库
备注:虚拟机安装内存是个神坑。
以上是关于Centos7.6安装openGauss的主要内容,如果未能解决你的问题,请参考以下文章