Article Directory
1. openEuler operating system
- Mirror download address
https://www.openeuler.org/zh/downloadChoose a download
-
Installation
Follow the prompts to install. Pay attention to the selection when installing the server.安装服务器
If necessaryopenGauss数据库
, you can choose it. I chose it here for the experience. -
turn off firewall
systemctl stop firewalld.service
systemctl disable firewalld.service
- close selinux
modify file /etc/selinux/config
SELINUX=disabled
Perform setenforce 0
a temporary shutdown after modification, or find time to restart the service later.
- The su command switches the root user
Modify /etc/pam.d/su
the file and comment out the next two lines.
#auth sufficient pam_wheel.so trust use_uid
#auth required pam_wheel.so use_uid
2. openGauss database
2.1 The system comes with its own library
If you chose to install the openGauss database when you installed the operating system just now, you can use it directly here.
2.1.1 Allow all addresses to access the port
The configuration file here is actually postgres, and even the name has not been changed.
- Modify the configuration file
/var/lib/opengauss/data/postgresql.conf
listen_addresses = '*'
local_bind_address = '0.0.0.0'
password_encryption_type = 0
- modify
/var/lib/opengauss/data/pg_hba.conf
file
host all all 0.0.0.0/0 md5
- Restart the database
systemctl restart opengauss.service
- View Results
[root@localhost ~]# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:7655 0.0.0.0:* LISTEN 2224/gaussdb
tcp 0 0 0.0.0.0:7654 0.0.0.0:* LISTEN 2224/gaussdb
tcp6 0 0 :::7655 :::* LISTEN 2224/gaussdb
tcp6 0 0 :::7654 :::* LISTEN 2224/gaussdb
2.1.2 Create a remote login user
- switch to
opengauss
user
su - opengauss
- login database
gsql
sql can use the postgres sql command.
- Set a password for the initializing user
ALTER ROLE openGauss PASSWORD 'liubei@161';
- Create a remote login user
CREATE USER liubei WITH PASSWORD 'liubei@161';
- Grant the changed user admin privileges
ALTER USER liubei sysadmin;
- Then
openGauss
log in locally with the command
gsql -d postgres -W 'liubei@161'
- Commands to log in as
liubei
a user locally
gsql -d postgres -U liubei -W 'liubei@161'
- Remote login test
2.2 Install version 5.0
2.2.1 Download
- Download address: https://opengauss.org/zh/download/
Pay attention to the choice of architecture and operating system
- Copy to the corresponding server
2.2.2 Installation
- Create a normal user and change the compressed package owner to this user
The program prohibits the root user from installing
- switch to normal user
- Unzip the installation package
- The files in the installation package are as follows
[liubei@localhost openGauss-5.0.0]$ ll
总用量 40
drwxr-x--- 2 liubei liubei 4096 3月 29 03:46 bin
drwx------ 3 liubei liubei 4096 6月 20 19:07 data
drwxr-x--- 3 liubei liubei 4096 3月 29 03:46 etc
drwxr-x--- 3 liubei liubei 4096 3月 29 03:46 include
drwxr-x--- 4 liubei liubei 4096 3月 29 03:46 jre
drwxr-x--- 5 liubei liubei 4096 3月 29 03:46 lib
drwx------ 2 liubei liubei 4096 6月 20 19:07 logs
drwxr-x--- 5 liubei liubei 4096 3月 29 03:46 share
drwxr-x--- 2 liubei liubei 4096 6月 20 19:08 simpleInstall
-rw-r----- 1 liubei liubei 32 3月 29 03:46 version.cfg
- enter
simpleInstall
directory
[liubei@localhost openGauss-5.0.0]$ cd simpleInstall
[liubei@localhost simpleInstall]$ ll
总用量 64
-rw-r----- 1 liubei liubei 10827 3月 29 03:46 finance.sql
-rw-r----- 1 liubei liubei 13009 3月 29 03:46 install.sh
-rw-r--r-- 1 liubei liubei 4489 6月 20 19:08 load.log
-rw-r----- 1 liubei liubei 5056 3月 29 03:46 README.md
-rw-r----- 1 liubei liubei 19713 3月 29 03:46 school.sql
[liubei@localhost simpleInstall]$
- Execute the installation command
[liubei@localhost simpleInstall]$ sh install.sh -w liubei@161
The output is as follows:
[step 1]: check parameter
[step 2]: check install env and os setting
[step 3]: change_gausshome_owner
[step 4]: set environment variables
[step 6]: init datanode
The files belonging to this database system will be owned by user "liubei".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
creating directory /home/liubei/openGauss-5.0.0/data/single_node ... ok
creating subdirectories ... in ordinary occasionok
creating configuration files ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1024MB
Begin init undo subsystem meta.
[INIT UNDO] Init undo subsystem meta successfully.
creating template1 database in /home/liubei/openGauss-5.0.0/data/single_node/base/1 ... The core dump path is an invalid directory
2023-06-20 19:07:42.215 [unknown] [unknown] localhost 140505899286464 0[0:0#0] [BACKEND] WARNING: macAddr is 21076/3325712, sysidentifier is 1381236786/3205528920, randomNum is 1041071448
ok
initializing pg_authid ... ok
setting password ... ok
initializing dependencies ... ok
loading PL/pgSQL server-side language ... ok
creating system views ... ok
creating performance views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
initialize global configure for bucketmap length ... ok
creating information schema ... ok
loading foreign-data wrapper for distfs access ... ok
loading foreign-data wrapper for log access ... ok
loading hstore extension ... ok
loading foreign-data wrapper for MOT access ... ok
loading security plugin ... ok
update system tables ... ok
creating snapshots catalog ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
freezing database template0 ... ok
freezing database template1 ... ok
freezing database postgres ... ok
......
Success. You can now start the database server of single node using:
gaussdb -D /home/liubei/openGauss-5.0.0/data/single_node --single_node
or
gs_ctl start -D /home/liubei/openGauss-5.0.0/data/single_node -Z single_node -l logfile
[step 7]: start datanode
[2023-06-20 19:07:56.190][15116][][gs_ctl]: gs_ctl started,datadir is /home/liubei/openGauss-5.0.0/data/single_node
[2023-06-20 19:07:56.217][15116][][gs_ctl]: waiting for server to start...
.0 LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.
......
From the above output, we can know the start/stop command, and then switch to
liubei
user execution:gs_ctl start|stop|restart -D $GAUSSHOME/data/single_node -Z single_node
- open remote access
Press 2.1 系统自带库
to operate.
2.2.3 Testing
Press 2.1 系统自带库
to operate.