服務(wù)器版本:Centos7.6 || 7.9
數(shù)據(jù)庫(kù)版本:openGauss-5.0.0-CentOS-64bit.tar.bz2?極簡(jiǎn)版
目錄
- 修改系統(tǒng)參數(shù)
- 安裝環(huán)境
- 安裝openGauss數(shù)據(jù)庫(kù)
- 配置連接數(shù)據(jù)庫(kù)
- 使用navicat連接數(shù)據(jù)庫(kù)
修改系統(tǒng)參數(shù)
##修改?/etc/selinux/config 文件中的“SELINUX”值為“disabled”。
vi? /etc/selinux/config
SELINUX=disabled
關(guān)閉防火墻
##檢查防火墻是否關(guān)閉
systemctl status firewalld
##關(guān)閉防火墻
systemctl disable firewalld.service
systemctl stop firewalld.service
##設(shè)置字符集參數(shù)? 沒(méi)有則添加
vi /etc/profile
export LANG=en_US.UTF-8
##關(guān)閉HISTORY記錄
vi?/etc/profile
##設(shè)置HISTSIZE值為0。例如,系統(tǒng)中HISTSIZE默認(rèn)值為1000,將其修改為0
HISTSIZE=0
##執(zhí)行命令,使配置立即生效
source /etc/profile
##設(shè)置時(shí)區(qū)和時(shí)間
date
##使用如下命令將各數(shù)據(jù)庫(kù)節(jié)點(diǎn)/usr/share/zoneinfo/目錄下的時(shí)區(qū)文件拷貝為/etc/localtime文件
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
##(可選)關(guān)閉swap交換內(nèi)存
swapoff -a
##關(guān)閉RemoveIPC
##1.修改/etc/systemd/logind.conf文件中的“RemoveIPC”值為“no”。
vim ?/etc/systemd/logind.conf
RemoveIPC=no
##2.修改/usr/lib/systemd/system/systemd-logind.service文件中的“RemoveIPC”值為“no”。
## 使用VIM打開(kāi)systemd-logind.service文件。(注:如果這個(gè)文件中沒(méi)有這個(gè)參數(shù)就寫(xiě)進(jìn)去然后保存)vi /usr/lib/systemd/system/systemd-logind.service
RemoveIPC=no
##重新加載配置參數(shù)。
systemctl daemon-reload
systemctl restart systemd-logind
##檢查修改是否生效。loginctl show-session | grep RemoveIPC
systemctl show systemd-logind | grep RemoveIPC
安裝環(huán)境
##安裝編譯Python3源文件所需的編譯環(huán)境
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
##安裝bzip2
yum install -y bzip2
##安裝gcc
yum install -y gcc
#安裝依賴(lài)zlib、zlib-devel
yum install zlib
yum install zlib-devel
##安裝python3
##下載地址:https://www.python.org/downloads/release/python-3615/
##或者h(yuǎn)ttps://www.python.org/downloads/source/
##把下載的python壓縮包放到服務(wù)器 解壓
tar -zxvf Python-3.6.15.tgz
##進(jìn)入Python3 源文件文件夾
cd Python-3.6.15/
##運(yùn)行安裝
./configure --prefix=/usr/local/python3 --enable-shared
make && make install
##如果出現(xiàn)報(bào)錯(cuò):
configure: error: in `/usr/local/src/pythonSoft/Python-3.6.15':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
##是因?yàn)楸緳C(jī)缺少gcc編譯環(huán)境
##安裝gcc
yum install -y gcc
# 如果出現(xiàn)can't decompress data; zlib not available這個(gè)錯(cuò)誤,則需要安裝相關(guān)庫(kù)
#安裝依賴(lài)zlib、zlib-devel
yum install zlib
yum install zlib-devel
##添加python3的軟鏈接
ln -s /usr/local/python3/bin/python3.6 /usr/bin/python
##如果出現(xiàn)ln: 無(wú)法創(chuàng)建符號(hào)鏈接"/usr/bin/python": 文件已存在:
rm /usr/bin/python
#測(cè)試是否安裝成功了
python -V
##如果出現(xiàn):error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory
##原因是centos系統(tǒng)默認(rèn)加載/usr/lib,/lib下面庫(kù)文件,python默認(rèn)安裝到非此類(lèi)文件夾。
##解決辦法將python3安裝目錄的lib目錄下的文件libpython3.6m.so.1.0復(fù)制到/usr/lib/目錄下
cp /usr/local/python3/lib/libpython3.6m.so.1.0 /usr/lib/
##將目錄/usr/lib/添加到/etc/ld.so.conf.d/目錄下的python3.6.conf文件中
echo "/usr/lib" > /etc/ld.so.conf.d/python3.6.conf
##運(yùn)行命令
ldconfig
##再運(yùn)行 python 或python -V,發(fā)現(xiàn)沒(méi)有上述錯(cuò)誤了
安裝openGauss數(shù)據(jù)庫(kù)
? ? ? ? 使用root用戶(hù)
- 創(chuàng)建安裝目錄? ?mkdir -p /opt/software/openGauss
- 賦予權(quán)限? ? ? ? ? chmod 777 -R /opt/software
chmod -R 777 文件夾
參數(shù)-R是遞歸的意思
777表示開(kāi)放所有權(quán)限
如果給所有人添加可執(zhí)行權(quán)限:chmod a+x 文件名;
如果給文件所有者添加可執(zhí)行權(quán)限:chmod u+x 文件名;
?- # 創(chuàng)建組
groupadd dbgroup
# 向組中添加普通用戶(hù)
useradd -g dbgroup omm
# 設(shè)置用戶(hù)omm的密碼為 gauss_123
passwd omm
切換到普通用戶(hù):
su omm
?- 上傳數(shù)據(jù)庫(kù)安裝包到服務(wù)器,下載地址:openGauss軟件包
解壓到 /opt/software/openGauss 目錄
tar -jxf openGauss-5.0.0-CentOS-64bit.tar.bz2 -C /opt/software/openGauss
?- 進(jìn)入解壓目錄
cd /opt/software/openGauss/simpleInstall
# 執(zhí)行安裝腳本并制定數(shù)據(jù)庫(kù)初始密碼
sh install.sh ?-w Gauss@123
執(zhí)行時(shí),如果出現(xiàn)報(bào)錯(cuò)“the maximum number of SEMMNI is not correct, the current SEMMNI is xxx. Please check it.”,請(qǐng)使用有root權(quán)限的用戶(hù)執(zhí)行如下命令。
sysctl -w kernel.sem="250 85000 250 330"?
?安裝執(zhí)行完成后,使用ps和gs_ctl查看進(jìn)程是否正常。
ps ux | grep gaussdb
gs_ctl query -D /opt/software/openGauss/data/single_node
至此數(shù)據(jù)庫(kù)安裝完畢!
配置連接數(shù)據(jù)庫(kù)
- 第一次連接先修改數(shù)據(jù)庫(kù)連接方式和密碼校驗(yàn)方式
vi /opt/software/openGauss/data/single_node/pg_hba.conf
最后面加上:
host all all 0.0.0.0/0 ? md5
參考官方文檔:設(shè)置密碼安全策略
? - 修改密碼校驗(yàn)方式:
vi /opt/software/openGauss/data/single_node/postgresql.conf
##修改參數(shù):
listen_addresses = '*'
password_encryption_type = 0
? - #啟動(dòng)命令
gs_ctl restart -D $GAUSSHOME/data/single_node -Z single_node
gs_ctl start -D $GAUSSHOME/data/single_node -Z single_node
gs_ctl stop -D $GAUSSHOME/data/single_node -Z single_node
? - 數(shù)據(jù)庫(kù)安裝完成后,默認(rèn)生成名稱(chēng)為postgres的數(shù)據(jù)庫(kù)。第一次連接數(shù)據(jù)庫(kù)時(shí)可以連接到此數(shù)據(jù)庫(kù)。
##執(zhí)行如下命令連接數(shù)據(jù)庫(kù)。
gsql -d postgres -p 5432
其中postgres為需要連接的數(shù)據(jù)庫(kù)名稱(chēng),5432為數(shù)據(jù)庫(kù)默認(rèn)的端口號(hào)
? - #創(chuàng)建數(shù)據(jù)庫(kù)用戶(hù)
CREATE USER testuser WITH PASSWORD "Test_pwd";
#如下命令為設(shè)置用戶(hù)為系統(tǒng)管理員權(quán)限
GRANT ALL PRIVILEGES TO testuser;
#創(chuàng)建數(shù)據(jù)庫(kù)。
CREATE DATABASE testDb OWNER testuser;
? - #退出
\q
如下圖操作:
?使用navicat連接數(shù)據(jù)庫(kù) ?
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-491083.html
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-491083.html
到了這里,關(guān)于openGauss數(shù)據(jù)庫(kù)安裝,配置連接 完整版Centos7的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!