【Entry 24】OpenGauss Quick Installation Method (docker)

Author of this article: DSLS

openGauss quick installation method ( [docker] )

Let go of the security group (optional)

Cloud servers require open ports for external connections. The settings are as follows:

Open port 22 for remote [SSH] connections. Open port 8887 for database connection.

If you have trouble, you can open all ports.

The 8887 port is not fixed and can be set arbitrarily, but it should not conflict with the occupied port. .

If it is a local [virtual machine] , the above settings are not required. By the way, if you want other devices on the same LAN (such as your roommate’s computer) to connect to your database, please turn off the Windows Firewall.

login server

Once you have remotely logged in to the server using SSH, you can begin the next steps.

Execute the command SSH account name@domain name or IP address to connect to the remote server, and enter the password to log in after connecting.

Such as SSH root@db.example.cn or SSH root@

If it is a local virtual machine, please power on and enter the password to log in.

turn off firewall

Run the systemctl stop firewalld.service command to stop the firewall.

Run the systemctl disable firewalld.service command to disable the firewall.

After reboot reboot.

Change source (optional) (time-consuming warning)

Change the domestic source to speed up the download speed of the package. Note the system version: CentOS 7

Execute the command: cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak backup.

Run the command wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo to replace Alibaba Source.

Run the command yum clean all to clear the cache.

Execute the command yum makecache to generate the cache.

Run the command yum -y update to update the yum source.

install dokcer

Execute the command yum -y install docker to install docker.

Run the command systemctl start docker to start the docker service.

Run the command systemctl enable docker to start docker. (optional)

docker acceleration (optional)

In order to pull images faster, you can configure an image acceleration server. The mirror acceleration address can be Baidu, temporarily you can use my acceleration address: https://8h88nptu.mirror.aliyuncs.com.

By the way: Aliyun mirror acquisition address: https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors, after logging in, select Mirror Accelerator on the left menu to see your exclusive address

To configure the mirror address, run the command vi /etc/docker/daemon.json to modify the configuration file. If the file does not exist, create it. Add content to it:

  1. {"registry-mirrors":["https://8h88nptu.mirror.aliyuncs.com"]}

The acceleration address is for reference only

Execute the commands systemctl daemon-reload and systemctl restart docker in sequence to restart docker.

Pull openGauss image and start

Execute docker run –name opengauss –privileged=true -d -e GS_PASSWORD=Enmo@123 -p 8887:5432 enmotech/opengauss:latest to pull the image and create a container.

Among them, opengauss is the container name, 8887:5432 is the mapping of port 5432 inside the container to port 8887 outside the container, and the default password is Enmo@123.

Then execute docker start opengauss to start the openGauss image.

Set up the openGauss image by docker update –restart=always opengauss to start with docker startup

So far openGauss installation is complete

database settings

Execute the command docker exec -it opengauss bash to enter the container.

Execute the command su – omm to switch to the omm account.

Execute the command gsql to enter the database.

Because the initial account omm is not allowed to be used when connecting externally, a new account is created.

Execute the statement CREATE USER testuser WITH PASSWORD ‘Enmo@123’; create an account named testuser with a password of Enmo@123.

Execute the statement GRANT ALL PRIVILEGES ON DATABASE omm testuser; give testuser the default database omm privilege.

Execute the statement GRANT ALL PRIVILEGES ON all tables in schema public TO testuser; grant all table permissions to testuser.

Complete the setup.

External connection

The open source software DBeaver is used here to connect to the database.

As shown in the figure below, right-click in the left area, create->connect.

Choose PostgreSQL.

Set the host address to your server/VM IP address and the port to 8887. The database is omm, and the username and password are the username and password just set. (testuser, Enmo@123)

Enter the SQL editor and enter the statement SELECT 1; to test usability.


Leave a Comment

Your email address will not be published. Required fields are marked *