最详细CentOS7.6安装openGauss5.0.3教程
一、环境准备
1.1 主机信息
| 项目 | 内容 |
|---|---|
| 操作系统 | CentOS7.6 |
| IP | 192.168.4.201 |
| 主机名 | opgs201 |
| CPU | 8core |
| 内存 | 16GB |
| 磁盘1 | 100GB |
1.2 操作系统准备
创建一个虚拟机
安装操作系统,选择带GUI的安装

1.3 准备安装环境
安装python3
安装python3,因为这个新装的centos7.6是没有自带python3的,这里我建议安装python3.6就够
先挂载光盘iso
##挂载虚拟机的光盘
mount /dev/cdrom /mnt
#备份原来的yum文件
cd /etc/yum.repos.d
mkdir bk
mv *.repo bk/
##创建一个repo
echo "[EL]" >> /etc/yum.repos.d/linux7.repo
echo "name =LINUX7.DVD" >> /etc/yum.repos.d/linux7.repo
echo "baseurl=file:///mnt" >> /etc/yum.repos.d/linux7.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/linux7.repo
echo "enabled=1" >> /etc/yum.repos.d/linux7.repo
可以参考我的这篇文章,就是为了适配安装openGauss而安装python3的
https://www.cnblogs.com/su1999/p/18459499
检查软件依赖
安装好之后,安装下面openGauss需要的依赖包(有些在上面安装python3时安装了)
yum install -y lksctp*
yum install -y java-1.8.0-openjdk*
yum install -y psmisc
yum install -y bzip2
yum install -y libaio-devel
yum install -y flex bison ncurses-devel glibc-devel patch readline-devel redhat-lsb-core libnsl
配置hosts
echo "192.168.4.201 opgs201" >> /etc/hosts
关闭防火墙等配置
systemctl disable firewalld.service
systemctl stop firewalld.service
sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
cat /etc/selinux/config|grep SELINUX=
修改字符集参数
echo "export LANG=en_US.UTF-8" >> /etc/profile
source /etc/profile
设置root用户远程登录
这里可以使用脚本快速完成
sed -i '/PermitRootLogin/s/^/#/' /etc/ssh/sshd_config
sed -i '/Banner/s/^/#/' /etc/ssh/sshd_config
echo -e "\n" >> /etc/ssh/sshd_config
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
echo "Banner none " >> /etc/ssh/sshd_config
systemctl restart sshd.service
设置时区与时间
在生产环境可以使用NTP或者chrony来同步服务器的时间
rm -rf /etc/localtime
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
关闭swap(可选)
关闭swap可以提升性能
sed -i '/swap/s/^/#/' /etc/fstab
cat /etc/fstab
swapoff -a
修改系统内核参数
cat >> /etc/sysctl.conf << EOF
net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
net.ipv4.tcp_fin_timeout = 60
EOF
sysctl -p
关闭透明页
临时关闭透明页
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
写进开机文件,永久生效
cat >> /etc/rc.d/rc.local <<EOF
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
EOF
##生效
chmod +x /etc/rc.d/rc.local
修改启动级别
这一步是可选的
systemctl set-default multi-user.target
一次性全部配置
yum install -y lksctp*
yum install -y java-1.8.0-openjdk*
yum install -y psmisc
yum install -y bzip2
yum install -y libaio-devel
yum install -y flex bison ncurses-devel glibc-devel patch readline-devel redhat-lsb-core libnsl
echo "192.168.4.201 opgs201" >> /etc/hosts
systemctl disable firewalld.service
systemctl stop firewalld.service
sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
echo "export LANG=en_US.UTF-8" >> /etc/profile
source /etc/profile
sed -i '/PermitRootLogin/s/^/#/' /etc/ssh/sshd_config
sed -i '/Banner/s/^/#/' /etc/ssh/sshd_config
echo -e "\n" >> /etc/ssh/sshd_config
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
echo "Banner none " >> /etc/ssh/sshd_config
systemctl restart sshd.service
rm -rf /etc/localtime
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
sed -i '/swap/s/^/#/' /etc/fstab
swapoff -a
cat >> /etc/sysctl.conf << EOF
net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
net.ipv4.tcp_fin_timeout = 60
EOF
sysctl -p
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
cat >> /etc/rc.d/rc.local <<EOF
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
EOF
##生效
chmod +x /etc/rc.d/rc.local
systemctl set-default multi-user.target
echo -e "\n"
重启
reboot
二、安装openGauss5.0数据库
2.1 安装前准备
创建相关的目录与用户
这里先手动创建用户与组
groupadd dbgrp
useradd -g dbgrp omm
### 密码Gauss@1234 需要有一定的福再度
echo Gauss@1234 | passwd --stdin omm
创建目录
##放置软件包的目录
mkdir -p /opt/software/openGauss
chmod 755 -R /opt/software/openGauss
##openGauss数据库的目录,注意需要保持空目录,不然安装会错误
##
mkdir -p /openGauss/
chmod -R 755 /openGauss
chown -R omm:dbgrp /openGauss/
上传并解压安装包
把安装包上传到/opt/software/openGauss/目录下,解压
/opt/software/openGauss/
tar -zxvf openGauss-5.0.3-CentOS-64bit-all.tar.gz
tar -zxvf openGauss-5.0.3-CentOS-64bit-om.tar.gz
示例:
[root@opgs201 ~]# cd /opt/software/openGauss/
[root@opgs201 openGauss]# tar -zxvf openGauss-5.0.3-CentOS-64bit-all.tar.gz
openGauss-5.0.3-CentOS-64bit-cm.tar.gz
openGauss-5.0.3-CentOS-64bit-om.tar.gz
openGauss-5.0.3-CentOS-64bit.tar.bz2
openGauss-5.0.3-CentOS-64bit-cm.sha256
openGauss-5.0.3-CentOS-64bit-om.sha256
openGauss-5.0.3-CentOS-64bit.sha256
upgrade_sql.tar.gz
upgrade_sql.sha256
解压后有这些文件
[root@opgs201 soft]# ls -l
total 264712
-rw-r--r-- 1 root root 134969411 Oct 9 23:42 openGauss-5.0.3-CentOS-64bit-all.tar.gz
-rw-r--r-- 1 root root 105 Jul 31 21:15 openGauss-5.0.3-CentOS-64bit-cm.sha256
-rw-r--r-- 1 root root 22528084 Jul 31 21:15 openGauss-5.0.3-CentOS-64bit-cm.tar.gz
-rw-r--r-- 1 root root 65 Jul 31 21:14 openGauss-5.0.3-CentOS-64bit-om.sha256
-rw-r--r-- 1 root root 11973852 Jul 31 21:14 openGauss-5.0.3-CentOS-64bit-om.tar.gz
-rw-r--r-- 1 root root 65 Jul 31 21:15 openGauss-5.0.3-CentOS-64bit.sha256
-rw-r--r-- 1 root root 101064032 Jul 31 21:15 openGauss-5.0.3-CentOS-64bit.tar.bz2
-rw------- 1 root root 65 Jul 31 21:13 upgrade_sql.sha256
-rw------- 1 root root 502230 Jul 31 21:13 upgrade_sql.tar.gz
再解压里面的这个
[root@opgs201 openGauss]# tar -zxvf openGauss-5.0.3-CentOS-64bit-om.tar.gz
准备XML文件
我这个是单节点的,所以准备单节点的xml,这个文件配在哪里呢?
配在软件目录下
cd /opt/software/openGauss/
vi cluster_config.xml
或者直接cat
cat >> /opt/software/openGauss/cluster_config.xml << EOF
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CLUSTER>
<PARAM name="clusterName" value="dbCluster" />
<!-- 这里输入自己的主机名 -->
<PARAM name="nodeNames" value="opgs201" />
<!-- 数据库安装目录-->
<PARAM name="gaussdbAppPath" value="/openGauss/app" />
<!-- 日志目录-->
<PARAM name="gaussdbLogPath" value="/openGauss/log/omm" />
<!-- 临时文件目录-->
<PARAM name="tmpMppdbPath" value="/openGauss/tmp" />
<!-- 数据库工具目录-->
<PARAM name="gaussdbToolPath" value="/openGauss/om" />
<!-- 数据库core文件目录-->
<PARAM name="corePath" value="/openGauss/corefile" />
<!-- 节点IP,与数据库节点名称列表一一对应 -->
<PARAM name="backIp1s" value="192.168.4.201"/>
</CLUSTER>
<!-- 每台服务器上的节点部署信息 -->
<DEVICELIST>
<!-- 节点1上的部署信息 -->
<DEVICE sn="node1_hostname">
<!-- 节点1的主机名称 -->
<PARAM name="name" value="opgs201"/>
<!-- 节点1所在的AZ及AZ优先级 -->
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<!-- 节点1的IP,如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
<PARAM name="backIp1" value="192.168.4.201"/>
<PARAM name="sshIp1" value="192.168.4.201"/>
<!--dbnode-->
<PARAM name="dataNum" value="1"/>
<PARAM name="dataPortBase" value="15400"/>
<PARAM name="dataNode1" value="/openGauss/data/dn"/>
<PARAM name="dataNode1_syncNum" value="0"/>
</DEVICE>
</DEVICELIST>
</ROOT>
EOF
看看这个
2.2 安装openGauss数据库
执行preinstall
进入script目录
里面有很多脚本
[root@opgs201 soft]# cd script/
[root@opgs201 script]# ./gs
gs_backup gs_checkperf gs_expansion gs_postuninstall gs_sdr gs_uninstall
gs_check gs_collector gs_install gs_preinstall gs_ssh gs_upgradectl
gs_checkos gs_dropnode gs_om gspylib/ gs_sshexkey
[root@opgs201 script]# ls
base_diff gs_check gs_expansion gspylib gs_upgradectl os_platform ssh-agent
base_utils gs_checkos gs_install gs_sdr impl py_pstree.py ssh-copy-id
config gs_checkperf gs_om gs_ssh __init__.py scp ssh-keygen
domain_utils gs_collector gs_postuninstall gs_sshexkey killall ssh transfer.py
gs_backup gs_dropnode gs_preinstall gs_uninstall local ssh-add
执行其中的gs_preinstall检查脚本
[root@opgs201 script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml
Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Setting host ip env
Successfully set host ip env.
Are you sure you want to create the user[omm] (yes/no)? yes
Preparing SSH service.
Successfully prepared SSH service.
Checking OS software.
Successfully check os software.
Checking OS version.
Successfully checked OS version.
Creating cluster's path.
Successfully created cluster's path.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by "/opt/software/openGauss/script/gs_checkos -i A -h opgs201 --detail".
Set and check OS parameter completed.
Preparing CRON service.
Successfully prepared CRON service.
Setting user environmental variables.
Successfully set user environmental variables.
Setting the dynamic link library.
Successfully set the dynamic link library.
Setting Core file
Successfully set core path.
Setting pssh path
Successfully set pssh path.
Setting Cgroup.
Successfully set Cgroup.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.
[root@opgs201 script]#
使用omm用户执行安装
现在有了omm用户了,程序会写进一下环境变量
[root@opgs201 script]# su - omm
Last login: Sun Oct 13 08:45:28 CST 2024
[omm@opgs201 ~]$ cat .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
export GPHOME=/openGauss/om
export PATH=$GPHOME/script/gspylib/pssh/bin:$GPHOME/script:$PATH
export LD_LIBRARY_PATH=$GPHOME/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$GPHOME/lib
export GAUSSHOME=/openGauss/app
export PATH=$GAUSSHOME/bin:$PATH
export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH
export S3_CLIENT_CRT_FILE=$GAUSSHOME/lib/client.crt
export GAUSS_VERSION=5.0.3
export PGHOST=/openGauss/tmp
export GAUSSLOG=/openGauss/log/omm/omm
umask 077
export GAUSS_ENV=1
使用omm用户安装
[omm@opgs201 ~]$ gs_install -X /opt/software/openGauss/cluster_config.xml
Parsing the configuration file.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Successfully created the backup directory.
begin deploy..
Installing the cluster.
begin prepare Install Cluster..
Checking the installation environment on all nodes.
begin install Cluster..
Installing applications on all nodes.
Successfully installed APP.
begin init Instance..
encrypt cipher and rand files for database.
Please enter password for database:
Please repeat for database:
begin to create CA cert files
The sslcert will be generated in /openGauss/app/share/sslcert/om
NO cm_server instance, no need to create CA for CM.
Non-dss_ssl_enable, no need to create CA for DSS
Cluster installation is completed.
Configuring.
Deleting instances from all nodes.
Successfully deleted instances from all nodes.
Checking node configuration on all nodes.
Initializing instances on all nodes.
Updating instance configuration on all nodes.
Check consistence of memCheck and coresCheck on database nodes.
Configuring pg_hba on all nodes.
Configuration is completed.
The cluster status is Normal.
Successfully started cluster.
Successfully installed application.
end deploy..
2.3 安装后检查
echo "export PGDATABASE=postgres" >> ~/.bashrc、
echo "export PGDATA=/openGauss/data/dn" >> ~/.bashrc
echo "export PGPORT=15400" >> ~/.bashrc
echo "alias gsql='gsql -r'" >> ~/.bashrc
echo "alias dba='gsql -d postgres -p 15400'" >> ~/.bashrc
source ~/.bash_profile
执行gsql命令就能进去了
[omm@opgs201 ~]$ dba
gsql ((openGauss 5.0.3 build 89d144c2) compiled at 2024-07-31 20:59:31 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
openGauss=# select version();
version
---------------------------------------------------------------------------------------------------------------------------------------
---------------
(openGauss 5.0.3 build 89d144c2) compiled at 2024-07-31 20:59:31 commit 0 last mr on x86_64-unknown-linux-gnu, compiled by g++ (GCC)
7.3.0, 64-bit
(1 row)
2.4 数据库的简单管理
启停数据库
停止
[omm@opgs201 ~]$ gs_om -t stop
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
最详细CentOS7.6安装openGauss5.0.3教程的更多相关文章
- CentOS7离线安装MySQL8.0
CentOS7离线安装MySQL8.0 卸载软件 rpm -e --nodeps 要卸载的软件包 root@jacky zookeeper]# rpm -e --nodeps java-1.6.0-o ...
- CentOS7编译安装php7.1配置教程详解
这篇文章主要介绍CentOS7编译安装php7.1的过程和配置详解,亲测 ,需要的朋友可以参考. 1.首先安装依赖包: yum install libxml2 libxml2-devel openss ...
- 安装Redis5.0.8教程图解
文档:安装Redis5.0.8教程图解.note 链接:http://note.youdao.com/noteshare?id=737620a0441724783c3f8ef14ab8a453& ...
- centos7上安装zabbix4.0
zabbix4.0已经推出有一段时间了,针对之前版本做了很多优化配置,易用性得到提高,特别lts(long team support)长技术支持版本,官方说提供5年的稳定技术支持,在商业化运用上,是比 ...
- 在Centos7上安装wxPython4.0.4
在linux上安装wxPython4.0.4时需要gtk+2.0,在安装wxPython4.0.4遇到以下错误. linux上是用pip安装wxPython4.0.4的,执行命令如下: pip ins ...
- CentOS7中安装redis5.0
1. 环境介绍 CentOS7 (未安装Development Tools) 2. 下载Redis5.0-rc3 wget -O redis-5.0-rc3.tar.gz https://github ...
- centos7 二进制安装mysql-8.0.19
安装包下载地址:https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz 1.检 ...
- centOS7安装mysql8.0完美教程!!只要按照步骤,无脑操作,一次成功!
查看防火墙systemctl status firewalld重启防火墙systemctl start firewalld 1.mysql 首先关闭防火墙 systemctl stop firewal ...
- CentOS7.6安装MySQL8.0(图文详细篇)
目录 一.安装前准备 二.安装MySQL 三.设置远程登录 四.安装问题解决 五.设置MySQL开机自启 一.安装前准备 1.在官网下载MySQL安装包(注意下载的安装包类型) 2.查看是否安装ma ...
- 【Zabbix】在CentOS7上安装Zabbix3.0
Zabbix安装 首先说明一下,本文主要参考了[http://www.linuxidc.com/Linux/2016-11/137030.htm]和[http://www.cnblogs.com/XY ...
随机推荐
- 【Java-GUI】12 Swing07 JList
列表和下拉选择: package cn.dzz; import javax.swing.*; import javax.swing.border.EtchedBorder; import javax. ...
- Deep Learning —— 异步优化器 —— RMSpropAsync —— 异步RMSprop
看到了一个概念,叫做异步更新优化器,也就是使用异步的方式实现deep learning中的参数优化的method,这个概念比较新奇,虽然看到的异步更新神经网络的代码比较多,但是很少见到有人单独把异步优 ...
- Vue-购物车实战
computed 计算属性 正则 css部分 [v-cloak] { display : none ; } table{ border : lpx solid #e9e9e9 ; border- co ...
- 代码随想录Day11
150. 逆波兰表达式求值 给你一个字符串数组 tokens ,表示一个根据 逆波兰表示法 表示的算术表达式. 请你计算该表达式.返回一个表示表达式值的整数. 注意: 有效的算符为 '+'.'-'.' ...
- idea汉化包安装失败解决方法
idea安装中文插件时提示: Plugin "Chinese (Simplified) Language Pack / 中文语言包" was not installed: 查看自己 ...
- dubbo序列化问题(一)浮点数问题
转
dubbo是一个分布式服务框架,在国内比较常用,在开发过程中遇到一个浮点数反序列化问题. 问题描述,当参数是float类型的3.7,反序列化却得到了一个double类型的值:3.70000004768 ...
- 暑假Java自学进度总结06
一.今日所学: 1.for循环 for(初始化语句;条件判断语句;条件控制语句){ 循环体语句; } 执行流程: 1>执行初始化语句 2>执行条件判断语句,若为true则执行循环体语句,若 ...
- Java String 去掉特殊字符之前的内容方法
为了去除字符串中某个特殊字符之前(包括该特殊字符本身)的所有内容,我们可以使用Java中的String类的substring和indexOf方法.这里,我将给出一个完整的代码示例,该示例会找到字符串中 ...
- Python 潮流周刊#65:CSV 有点糟糕(摘要)
本周刊由 Python猫 出品,精心筛选国内外的 250+ 信息源,为你挑选最值得分享的文章.教程.开源项目.软件工具.播客和视频.热门话题等内容.愿景:帮助所有读者精进 Python 技术,并增长职 ...
- Vue 子组件修改父组件传递过来的值
实现效果:通过点击选中的按钮控制左边的树是否进行展示 子组件篇: <el-button v-if="isShowTree&hasTree" type="te ...