1,将脚本和opengauss软件包放到同一个目录下(不要放到/root下面,建议放到/opt/soft下面目录权限要有755),不需要进行解压缩,安装包下载地址如下:
软件包 | openGauss
2.规划好gs的数据目录,提前创建好目录,例如放到/data/guassdb/data下面,你只需要提前创建好/data就行了
3.将操作系统镜像ISO挂载到/os下面
下面就是执行安装脚本就行了:
#!/usr/bin/bashexport LANG=en_US##check current dir
CURRENT_DIR=$(pwd)if [ CDIR=${CURRENT_DIR:0:5} == '/root' ]
thenecho "Error: current dir can\'t be /root!"exit
fi#check db packageDB_PKG=`ls $CURRENT_DIR/openGauss-*-64bit-all.tar.gz |wc -l`
if [ $DB_PKG -lt 1 ]
thenecho "Error: Current Dir can\'t find package: openGauss-xx-64bit-all.tar.gz"echo "You need put this scripts to openGauss package directory!!!"exit
fi###check iso mount pointif [ -d /os/Packages ]
thenif [ `du -sm /os |awk '{print $1}'` -lt 3000 ]thenecho "Error:You Need mount ISO to /os"exitfi
elseecho "Error:You Need mount ISO to /os"exit
fi
clearecho "--------------------------------------------------------------------------------"
echo "--------------- ----------------"
echo "--------------- Welcome to Single openGauss install ----------------"
echo "--------------- --by Brent 20240601 ----------------"
echo "--------------------------------------------------------------------------------"echo "Please Enter HOSTNAME:"
read HOSTNAME
echo "Please Enter Local IP :"
read IP
echo "Please Enter OpenGauss Setup Dir[/opt/huawei]:"
read SETUP_DIR
echo "Please Enter OpenGauss Data Dir[/data/opengauss/data]:"
read DATA_DIR
echo "Please Enter OpenGauss ClusterName:"
read CLUSTER_NAME
echo "Please Enter OpenGauss Listen Port[15400]:"
read PORT
echo "Please Enter OpenGauss CharSet[UTF8]:"
read CHARSETif [ -z $SETUP_DIR ]
thenSETUP_DIR='/opt/huawei'
fiif [ -z $CHARSET ]
thenCHARSET=UTF-8
fiif [ -z $DATA_DIR ]
thenDATA_DIR=/data/opengauss/data
fiif [ -z $PORT ]
thenPORT=15400
fiKERNEL=`uname -r`
KERNEL_S=${KERNEL:0:1}echo "################################################################################################"
echo "###################