腳本支持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-server01
       Icon name: computer-vm
      Machine 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@2025

spawn ./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 ~]#