openGauss数据库自动安装脚本,自动卸载脚本

news/2025/11/17 11:40:07/文章来源:https://www.cnblogs.com/wenxiao1-2-3-4/p/19231856

github项目已更新:

https://github.com/xiaowen1448/GaussInstaller

脚本支持openEuler 22.03 / openEuler 20.03,数据库版本openGauss 5.0到7.0 

远程ssh,执行克隆

[root@openGauss-server01 ~]# ls
anaconda-ks.cfg
[root@openGauss-server01 ~]# git clone  https://github.com/xiaowen1448/GaussInstaller
Cloning into 'GaussInstaller'...
remote: Enumerating objects: 58, done.
remote: Counting objects: 100% (58/58), done.
remote: Compressing objects: 100% (46/46), done.
remote: Total 58 (delta 21), reused 37 (delta 11), pack-reused 0 (from 0)
Receiving objects: 100% (58/58), 34.11 KiB | 229.00 KiB/s, done.
Resolving deltas: 100% (21/21), done.
[root@openGauss-server01 ~]# ls
anaconda-ks.cfg  GaussInstaller
[root@openGauss-server01 ~]# ls GaussInstaller/
install_opengauss.sh  README.md  uninstall_opengauss.sh  url.txt
[root@openGauss-server01 ~]# chmod +x GaussInstaller/*.*

 

执行GaussInstaller/install_opengauss.sh 脚本开始安装

 

[root@openGauss-server01 ~]# GaussInstaller/install_opengauss.sh
=========================================
openGauss 自动安装脚本
支持多版本和多架构自动选择
内置URL版本 - 无需外部配置文件
=========================================
支持的openGauss版本和架构:
=========================================
版本信息:
- 支持openGauss 5.0.0(LTS)-7.0.0-RC1,架构-x86_64, AArch64系统要求:
- 操作系统: openEuler 22.03 / openEuler 20.03
- 架构: x86_64 或 AArch64
- 内存: 建议8GB以上
- 磁盘: 建议50GB以上可用空间
=========================================
正在检测系统版本...
系统发行版信息: openEuler release 22.03 (LTS-SP4)
内核版本信息: Linux openGauss-server01 5.10.0-216.0.0.115.oe2203sp4.x86_64 #1 SMP Thu Jun 27 15:13:44 CST 2024 x86_64 x86_64 x86_64 GNU/Linux
✅ 检测到系统版本: openEuler 22.03
系统版本校验通过: openEuler 22.03
检测到系统架构: x86_64
=========================================
可用的openGauss版本:
=========================================
1. openGauss 7.0.0-RC2 (v7.0.0-RC2) - 最新候选发布版本,包含新特性
2. openGauss 7.0.0-RC1 (v7.0.0-RC1) - 最新候选发布版本,包含新特性
3. openGauss 6.0.2(LTS) (v6.0.2) - 最新长期支持版本,推荐生产环境使用 ⭐推荐
4. openGauss 6.0.0(LTS) (v6.0.0) - 稳定长期支持版本
5. openGauss 6.0.0-RC1 (v6.0.0-RC1) - 稳定长期支持版本
6. openGauss 5.0.3(LTS) (v5.0.3) - 稳定长期支持版本
7. openGauss 5.0.2(LTS) (v5.0.2) - 稳定长期支持版本
8. openGauss 5.0.1(LTS) (v5.0.1) - 稳定长期支持版本
9. openGauss 5.0.0(LTS) (v5.0.0) - 稳定长期支持版本
=========================================
系统架构: x86_64
系统版本: openEuler 22.03
支持的操作系统: openEuler 22.03 / openEuler 20.03
========================================
请选择要安装的版本 (输入数字 1-9): 1✅ 您选择了: openGauss 7.0.0-RC2 (v7.0.0-RC2)
架构: x86_64
系统版本: openEuler 22.03
特性: 稳定版本正在构建下载链接...
目标版本: 7.0.0-RC2
系统架构: x86_64
系统版本: openEuler 22.03
构建的下载链接: https://opengauss.obs.cn-south-1.myhuaweicloud.com/7.0.0-RC2/openEuler22.03/x86/openGauss-All-7.0.0-RC2-openEuler22.03-x86_64.tar.gz
=========================================
开始下载openGauss安装包...
下载链接: https://opengauss.obs.cn-south-1.myhuaweicloud.com/7.0.0-RC2/openEuler22.03/x86/openGauss-All-7.0.0-RC2-openEuler22.03-x86_64.tar.gz
文件名: openGauss-All-7.0.0-RC2-openEuler22.03-x86_64.tar.gz
=========================================
文件已存在,跳过下载: openGauss-All-7.0.0-RC2-openEuler22.03-x86_64.tar.gz
检查系统版本...
openGauss-server01
NAME="openEuler"
VERSION="22.03 (LTS-SP4)"
VERSION_ID="22.03"
PRETTY_NAME="openEuler 22.03 (LTS-SP4)"
=========================================
配置主机名...
当前主机名: openGauss-server01
✅ 主机名已经是 'openGauss-server01',无需更改
主机名配置状态:Static hostname: openGauss-server01Icon name: computer-vmMachine ID: 48ac7bff47644f2da57e5cfe600037a0
检测到本机IP地址: 192.168.119.135
=========================================
步骤1: 安装必要工具...
Last metadata expiration check: 0:15:28 ago on Mon 17 Nov 2025 11:12:25 AM CST.
Package tar-2:1.34-5.oe2203sp4.x86_64 is already installed.
Package expect-1:5.45.4-8.oe2203sp4.x86_64 is already installed.
Package libaio-devel-0.3.113-9.oe2203sp4.x86_64 is already installed.
Package readline-devel-8.1-3.oe2203sp4.x86_64 is already installed.
Package libedit-devel-3.1-31.oe2203sp4.x86_64 is already installed.
Package libxml2-devel-2.9.14-20.oe2203sp4.x86_64 is already installed.
Package lz4-devel-1.9.3-3.oe2203sp4.x86_64 is already installed.
Package numactl-devel-2.0.16-9.oe2203sp4.x86_64 is already installed.
Package unixODBC-devel-2.3.7-3.h1.oe2203sp4.x86_64 is already installed.
Package java-1.8.0-openjdk-devel-1:1.8.0.462.b08-3.oe2203sp4.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
步骤2: 创建安装目录...
步骤3: 切换到安装目录...
步骤4: 解压openGauss安装包...
正在检测OM包...
找到OM包: ./openGauss-OM-7.0.0-RC2-openEuler22.03-x86_64.tar.gz
解压OM包...
✅ OM包解压完成
步骤5: 创建集群配置文件...
✅ 集群配置文件创建完成
配置信息:
- 主机名: openGauss-server01
- IP地址: 192.168.119.135
- 数据库端口: 15400
- 选择版本: 7.0.0-RC2
- 系统架构: x86_64
- 系统版本: openEuler 22.03
- 下载链接: https://opengauss.obs.cn-south-1.myhuaweicloud.com/7.0.0-RC2/openEuler22.03/x86/openGauss-All-7.0.0-RC2-openEuler22.03-x86_64.tar.gz
步骤6: 设置目录权限...
步骤7: 执行预安装...
正在执行预安装,这可能需要几分钟时间...
将自动创建omm用户并设置密码为: Admin@2025spawn ./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
Please enter password for cluster user.
Password:
Please enter password for cluster user again.
Password:
Generate cluster user password files successfully.
Successfully created [omm] user on all nodes.
Preparing SSH service.
Successfully prepared SSH service.
Checking OS software.
Successfully check OS software.
Checking OS version.
Successfully checked OS version.
Checking cpu instructions.
Successfully checked cpu instructions.
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 openGauss-server01 -X /opt/software/openGauss/cluster_config.xml --skip-item-num=A11 --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.
预安装成功完成
预安装完成!=========================================
预安装已完成,omm用户已创建
用户名: omm
密码: Admin@2025开始执行数据库安装...
=========================================
正在切换到omm用户并执行数据库安装...
Last login: Mon Nov 17 11:29:37 CST 2025
spawn gs_install -X /opt/software/openGauss/cluster_config.xml
Parsing the configuration file.
Successfully checked gs_uninstall on every node.
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 /opt/huawei/install/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..
openGauss数据库安装完成!
=========================================
数据库版本信息:
gsql (openGauss 7.0.0-RC2 build e5fe3f9f) compiled at 2025-09-26 17:31:47 commit 0 last mr 8457数据库信息:
- 版本: 7.0.0-RC2
- 架构: x86_64
- 系统版本: openEuler 22.03
- 用户名: omm
- 用户密码: Admin@2025
- 数据库密码: Admin@2025
- 数据库端口: 15400
- 下载源: https://opengauss.obs.cn-south-1.myhuaweicloud.com/7.0.0-RC2/openEuler22.03/x86/openGauss-All-7.0.0-RC2-openEuler22.03-x86_64.tar.gz

常用命令:
1. 查看数据库状态: gs_om -t status
2. 连接数据库: gsql -d postgres -p 15400
3. 启动数据库: gs_om -t start
4. 停止数据库: gs_om -t stop
=========================================注意事项:
- 请确保系统已关闭防火墙和SELinux
- 请确保系统时间同步
- 如果遇到权限问题,请检查用户和组是否正确创建
- 默认数据库端口为15400
- omm用户密码为: Admin@2025安装脚本执行完成!
[root@openGauss-server01 ~]#

 

  

执行自动卸载脚本

[root@openGauss-server01 ~]# GaussInstaller/uninstall_opengauss.sh  --delete-opt
[INFO] === 高斯数据库卸载脚本 ===
[INFO] 开始时间: Mon Nov 17 11:31:57 AM CST 2025
[WARNING] ⚠️  注意:已启用删除 /opt 目录选项 ⚠️
[INFO] 验证用户 'omm' 存在
[INFO] 开始卸载高斯数据库...
[INFO] 找到gs_uninstall命令: /opt/huawei/install/om/script/gs_uninstall
[INFO] 执行gs_uninstall --delete-data...
Checking uninstallation.
Successfully checked uninstallation.
Stopping the cluster.
Successfully stopped the cluster.
Successfully deleted instances.
Uninstalling application.
Successfully uninstalled application.
No need to clear dss disk.
Successfully deleted log.
Uninstallation succeeded.
[INFO] 高斯数据库应用程序卸载成功
[INFO] 开始清理环境...
[INFO] 找到gs_postuninstall脚本: /opt/software/openGauss/script/gs_postuninstall
[INFO] 找到配置文件: /opt/software/openGauss/cluster_config.xml
[INFO] 执行gs_postuninstall清理环境...
Parsing the configuration file.
Successfully parsed the configuration file.
Check log file path.
Successfully checked log file path.
Checking unpreinstallation.
Successfully checked unpreinstallation.
check and clean cgroup
Successfully clean cgroup.
Deleting the instance's directory.
Successfully deleted the instance's directory.
Deleting the temporary directory.
Successfully deleted the temporary directory.
Deleting software packages and environmental variables of the local node.
Successfully deleted software packages and environmental variables of the local nodes.
Deleting local OS user.
Successfully deleted local OS user.
Deleting local node's logs.
Successfully deleted local node's logs.
Successfully cleaned environment.
clean over.
[ERROR] ==================================================
[ERROR] ⚠️  危险操作警告 ⚠️
[ERROR] ==================================================
[ERROR] 您正在尝试删除整个 /opt 目录!
[ERROR] 此操作将删除该目录下的所有文件和子目录!
[ERROR] 此操作无法撤销!
[ERROR] 请确保您理解此操作的后果!
[ERROR] ==================================================
您确定要删除整个 /opt 目录吗?(yes/no): yes
[INFO] 开始删除 /opt 目录...
[INFO] /opt 目录已成功删除
[INFO] 执行额外清理步骤...
[INFO] 发现/om目录,进行清理...
[INFO] 额外清理完成
[INFO] 环境清理完成
[INFO]
[INFO] === 卸载完成 ===
[INFO] 结束时间: Mon Nov 17 11:32:41 AM CST 2025
[INFO] 总执行时间: 44秒
[INFO] 高斯数据库已成功卸载,/opt目录已被删除
[INFO]
[INFO] 使用说明:
[INFO] 1. 如果需要删除 /opt 目录,请使用 GaussInstaller/uninstall_opengauss.sh --delete-opt
[INFO] 2. 如果需要备份配置文件,请使用 GaussInstaller/uninstall_opengauss.sh --backup
[INFO] 3. 如需帮助,请使用 GaussInstaller/uninstall_opengauss.sh --help
[root@openGauss-server01 ~]#

 

 

淘宝小店,欢迎你的光临,可定制你的需求

 

https://shop340822098.taobao.com/

 

image

 

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/967767.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

2025年镀锌管源头厂家权威推荐榜单:钢管镀锌/镀锌管材/镀锌圆管源头厂家精选

在基建投资稳步增长和工业升级的推动下,中国镀锌管市场正迎来提质增效的关键阶段,年产量突破千万吨,规模与品质并重成为行业核心竞争力 作为工业制造和建筑领域不可或缺的基础材料,镀锌管凭借其耐腐蚀、使用寿命长…

2025 最新数字人平台推荐!AI 数字人 / 虚拟数字人平台口碑排行榜:高性价比智能数字人制作与直播电商解决方案权威推荐

引言 在数字技术与实体经济深度融合的趋势下,AI 数字人已成为直播电商、智能客服、文旅服务等领域的核心赋能工具,市场需求持续爆发。据国际人工智能产业协会(IAII)最新测评数据显示,全球数字人行业合规厂商数量年…

上周热点回顾(11.10

热点随笔: 微软正式发布 .NET 10:三年 LTS 支持驱动性能革命与 AI 原生开发新纪元 (张善友) .NET 10性能突破:持续优化才是质变关键 (LdotJdot) 从 .NET Core1.0 到 .NET 10:.NET + C# 演进全…

Julie Pro V121: Bypass Immobilizer Emulate ESL/ELV for European/American Vehicle Repairs

Solving Immobilizer & ESL/ELV Headaches: The Julie Pro V121 Advantage Problem Identification: When Immobilizers and Steering Locks Become Roadblocks For European and American car owners and repair …

2025年比较好的无凸轮弹簧机厂家推荐及选择参考

2025年比较好的无凸轮弹簧机厂家推荐及选择参考行业背景与市场趋势随着制造业智能化转型的加速推进,无凸轮弹簧机作为弹簧制造领域的关键设备,正迎来前所未有的发展机遇。根据中国机械工业联合会最新发布的《2024-20…

2025年比较好的燃气报警器检测高评分推荐

2025年比较好的燃气报警器检测高评分推荐行业背景与市场趋势随着城市化进程加快和居民安全意识提升,燃气报警器作为家庭及工业场所的重要安全设备,市场需求持续增长。据《2024-2025年中国燃气报警器行业市场分析报告…

2025年知名的文旅景观亮化工程市场认可度榜

2025年知名的文旅景观亮化工程市场认可度榜行业背景与市场趋势随着文旅产业的蓬勃发展和城市夜间经济的崛起,景观亮化工程已成为提升城市形象、促进旅游消费的重要手段。根据中国照明电器协会最新发布的《2024-2025中…

2025年国内抗衰老设备与技术综合实力排行榜TOP10

摘要 随着人口老龄化加剧和健康意识提升,抗衰老行业正迎来爆发式增长。2025年全球抗衰老市场规模预计突破6000亿美元,中国成为全球增长最快的抗衰老市场之一。本文基于技术实力、临床数据、用户口碑等维度,对国内抗…

2025年绝热高效空冷器实力厂家权威推荐榜单:横流式闭式冷却塔设备/v型空冷器/闭式凉水塔源头厂家精选

在“双碳”目标持续推进的背景下,工业冷却设备能效标准不断提升,绝热高效空冷器市场迎来快速增长,年复合增长率预计达12.5%,技术创新与节能效果成为行业核心竞争力 随着国家节能环保政策的深入实施和工业装备升级需…

2025年质量好的非笼养草鸡蛋品质口碑榜

2025年质量好的非笼养草鸡蛋品质口碑榜行业背景与市场趋势随着消费者健康意识的不断提升和动物福利理念的普及,非笼养草鸡蛋市场近年来呈现爆发式增长。根据中国禽蛋行业协会最新发布的《2024-2025年中国蛋品行业发展…

2025年矿用设备设施安全检测检验公司权威推荐排行榜

摘要 随着矿山安全生产要求的不断提高,矿用设备设施安全检测检验行业在2025年迎来快速发展期。本文基于行业数据和技术实力分析,为您推荐本年度口碑最佳的5家检测检验服务商,并提供详细的对比分析表单供参考选择。 …

2025年电子防水透气膜源头厂家权威推荐:手机防水透气膜/路灯防水透气膜/家用电器防水透气膜实力企业精选

在电子设备防护领域,防水透气膜作为平衡设备内外压力的关键材料,其性能直接影响产品的可靠性与使用寿命。 根据市场研究数据显示,全球电子防水透气膜市场规模正以年均12% 的速度持续增长,其中e-PTFE(膨体聚四氟乙…

2025年比较好的带LED灯反弹骑马抽TOP实力厂家推荐榜

2025年比较好的带LED灯反弹骑马抽TOP实力厂家推荐榜行业背景与市场趋势随着家居智能化与个性化需求的不断提升,带LED灯的反弹骑马抽作为现代橱柜五金的核心配件,近年来呈现出快速增长的市场态势。据《2024年中国家居…

2025年评价高的注塑机冷却塔厂家推荐及选择参考

2025年评价高的注塑机冷却塔厂家推荐及选择参考行业背景与市场趋势随着全球制造业的持续发展,注塑机作为重要的生产设备,其配套的冷却系统也日益受到重视。冷却塔作为注塑机冷却系统的核心部件,其性能直接影响生产效…

算法竞赛模板Java版

前言 之前都是使用CPP打算法竞赛,现在使用Java。 为了避免Java繁琐的输入输出,准备了下面的初始模板。 大家有问题和建议可以多多交流 初始模板 import java.io.*; import java.util.*; import static java.lang.Mat…

2025年阜阳民事纠纷律师推荐几家:专业法律服务的明智选择

摘要 随着社会经济活动日益频繁,阜阳地区民事纠纷案件数量呈现逐年上升趋势。2025年民事法律服务行业正面临专业化、数字化转型升级,当事人对律师的专业能力、服务质量和办案效率提出了更高要求。本文基于市场调研和…

2025年知名的民事纠纷律师哪家好

摘要 随着我国法治建设的深入推进,民事纠纷律师行业在2025年迎来了新的发展机遇。阜阳地区民事纠纷案件数量逐年攀升,对专业律师的需求日益增长。本文基于权威数据分析和用户口碑评价,为您呈现2025年阜阳地区民事纠…

2025年热门的照明工程行业公信力榜

2025年热门的照明工程行业公信力榜:数据驱动的品牌价值评估行业背景与市场趋势随着全球城市化进程加速和"双碳"目标推进,中国照明工程行业正经历结构性变革。据中国照明电器协会统计,2024年行业规模突破6…

2025年山体边坡防护网厂商权威推荐榜单:主动边坡防护网/边坡防护网源头厂家精选

山体边坡防护网作为地质灾害防治的重要设施,在公路铁路边坡防护、矿山治理、基础设施建设等领域发挥着关键作用。随着我国对地质灾害防治投入的持续加大,边坡防护网市场规模呈现稳步增长态势。基于行业调研数据和技术…

2025年靠谱的负压消防风机厂家推荐及采购参考

2025年靠谱的负压消防风机厂家推荐及采购参考行业背景与市场趋势随着我国城市化进程加快和建筑安全标准不断提高,消防排烟设备行业迎来了快速发展期。据中国消防协会最新统计数据显示,2024年我国消防排烟设备市场规模…