Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use a virtual machine to install and deploy an openGauss database on VirtualBox+openEuler

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to use a virtual machine to install and deploy openGauss database on VirtualBox+openEuler. I believe most people don't know much about it, so share this article for your reference. I hope you can learn a lot after reading this article. Let's learn about it together.

1. Step 1 of downloading and installing virtual machine VirtualBox goes to the official website download page.

Web site: https://www.virtualbox.org/wiki/Downloads

Click "window Host" to download the windows version of VirtualBox.

After the download is complete in step 2, double-click the execution file to install.

Download, the file name is: VirtualBox-6.1.14-140239-Win.exe, double-click this executive file to install, the installation process storage address can be set according to their own ideas, all other options can default, directly press the next step on the line, the final installation is successful.

The details are as follows:

2. Step 1 of downloading the openEuler-20.03-LTS image file goes to the download page of Huawei Open Source Mirror Station.

Web site: https://mirrors.huaweicloud.com/openeuler/openEuler-20.03-LTS/ISO/x86_64/, as follows:

Step 2 Click "openEuler-20.03-LTS-x86_64-dvd.iso" to download the corresponding ISO image file.

The name of the downloaded file is as follows:

3. Install openEuler-20.03-LTS operating system under VirtualBox. Step 1: create a new virtual computer.

Open the VirtualBox software.

Click "New" on the manager of VirtualBox, as follows:

On this page, fill in the appropriate name (e.g. openEuler), file storage address (e.g. d:\ vmwork), operating system type (e.g. Linux), version (e.g. Other Linux), and then click next.

With the default settings, click create directly.

With the default settings, click "next" directly.

With the default settings, click "next" directly.

Change the hard disk size to 10G (10G represents the maximum limit size that can be reached after the hard disk is automatically expanded, which can be adjusted according to your own situation in actual use), and then click "create".

Step 2 set up the virtual computer and install it.

Click "Settings" on the Manager of VirtualBox, as follows:

Click "system" on the settings page to set up the system. In the boot sequence, move the "optical drive" and "hard disk" to the first and second boot, and uncheck the "floppy drive", as follows:

In the processor, CPU is set to 2, as follows:

Click the "Save" setting, select the CD and click the load button after assigning the CD-ROM drive to load the previously downloaded openEuler-20.03-LTS-x86_64-dvd.iso file into the CD-ROM drive as follows:

Click the "Network" setting, where two network cards are used. In the connection mode of Nic 1, select "Host-Only network only", which is mainly used to connect the local computer to the virtual computer, as follows:

Nic 2 setting, check "enable Network connection", and "connection method selection" drop-down select "Network address Translation (NAT)", which is mainly used for virtual computers to connect with the Internet, as follows:

Finally, click the "OK" button to complete the settings. The page is as follows:

Click the start button to start the system installation.

After confirming that the ISO content in the CD-ROM drive is correct, click start.

Launch the installation of the first interface, directly press the "Enter" key will enter the self-test interface.

On this page, click "install location" to partition first, as follows:

Select Custom, and then click finish.

Drop down and select "Standard Partition", and then click "Click here to create them automatically".

Click "finish" to proceed to the next step of setup.

Click "accept changes" to complete the partition settings, followed by network and hostname settings.

On the installation information summary page, click "Network and Hostname" to set the network and hostname as follows:

Set up two network cards respectively, such as Ethernet (enpOs3) network card, first click the button next to "close" to open the network card.

Then set the hostname (e.g. db1), and click "apply (A)", and then click "configure".

Note: when setting the host name, you must pay attention to it. If multiple students install it according to this document in the same network segment, please set the host name to be different as far as possible.

On the configuration page, select General, then check "automatically link to this network when available", and then click "Save".

Parameter the setting step of the first network card is to set the second network card. Open the network card first, and then configure it, as shown below:

Click Save.

Click finish to end the setting of the network and hostname.

On the installation information summary page, click "Software selection" to set up the software installation, as follows:

Select "Virtualized Host" on this page, and check "remote Management of Linux", "Development tools", "Security tools", "system Management tools" on the right. Then click finish.

At the end of the setting, click "start installation", as follows:

Click "ROOT password" to set the password for the ROOT user (e.g. openGauss@123).

Click "create user", and create a new user here (for example, user test, password openGauss@123), as follows:

During the system installation, the following interface appears after waiting for a few minutes:

This interface indicates that the system installation is complete, and then click "restart", but at this point you want to adjust the system to boot from the hard drive.

Close the VM running window first, as follows:

Then set up to boot from the hard disk, as follows:

After restarting, you are required to enter a user name and password. Log in with a root user here. The password, such as openGauss@123, is as follows:

Step 3 confirm the network

On the Linux operating system, use ifconfig to check whether both NICs are started properly, as follows:

[root@db1] # ifconfigenp0s3: flags=4163 mtu 1500 inet 192.168.56.123 netmask 255.255.255.0 broadcast 192.168.56.255 inet6 fe80::ac2f:dc4f:edfe:1d57 prefixlen 64 scopeid 0x20 ether 08:00:27:0f:78:e3 txqueuelen 1000 (Ethernet) RX packets 519 bytes 48509 (47.3 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 178bytes 52937 (51.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0enp0s8: flags=4163 mtu 1500 inet 10.0.3.15 netmask 255.255.255.0 broadcast 10.0.3.255 inet6 fe80::bedc:2040:4b9:23ed prefixlen 64 scopeid 0x20 ether 08:00:27:45:8d:f0 txqueuelen 1000 (Ethernet) RX packets 72 bytes 10702 (10.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 124 bytes 0 (11664 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 … .. virbr0: flags=4099 mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52V 5400V 05VO txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Confirm whether you can access the Internet through ping baidu.com, as follows:

[root@db1] # ping baidu.comPING baidu.com (39.156.69.79) 56 (84) bytes of data.64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=1 ttl=47 time=48.1 ms64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=2 ttl=47 time=46.5 ms64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=3 ttl=47 time=49.2 ms

Use the ctrl+c key combination to end the output.

4. Operating system environment preparation

For ease of operation, you can use SSH tools (such as PuTTY, etc.) to connect to the virtual machine from the local computer by configuring the IP address of the enp0s3 network card (e.g. 192.168.56.123), and use the ROOT user to log in.

Step 1 turn off the firewall

Execute the following two commands to turn off the firewall

Systemctl stop firewalld.service

Systemctl disable firewalld.service, as follows:

[root@db1 ~] # cat > > / etc/profile/etc/profile/etc/profile / dev/null.

CPUNO= `cat / proc/cpuinfo | grep processor | wc-l`export GOMP_CPU_AFFINITY=0-$ [CPUNO-1] # sysctl-w vm.min_free_kbytes=112640 & > / dev/nullsysctl-w vm.dirty_ratio=60 & > / dev/nullsysctl-w kernel.sched_autogroup_enabled=0 & > / dev/null

Click "ESC" to exit INSERT mode. Enter ": wq" and enter enter to save and exit.

Step 5 prepare the yum environment.

Back up the original yum configuration file.

[root@db1 ~] # mv / etc/yum.repos.d/openEuler_x86_64.repo / etc/yum.repos.d/openEuler_x86_ 64.repo.bak [root @ db1 ~] #

Download the repo file for the available source:

Curl-o / etc/yum.repos.d/openEuler_x86_64.repo https://mirrors.huaweicloud.com/repository/conf/openeuler_x86_64.repo

[root@db1 ~] # curl-o / etc/yum.repos.d/openEuler_x86_64.repo https://mirrors.huaweicloud.com/repository/conf/openeuler_x86_64.repo% Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed100 8860886 00 3661 0 -::--:--:- -: 3676

Check to see if the repo file content is correct.

[root@db1 ~] # cat / etc/yum.repos.d/openEuler_x86_ 64.repo [openEuler-source] name=openEuler-sourcebaseurl= https://mirrors.huaweicloud.com/openeuler/openEuler-20.03-LTS/source/enabled=1gpgcheck=1gpgkey=https://mirrors.huaweicloud.com/openeuler/openEuler-20.03-LTS/source/RPM-GPG-KEY-openEuler[openEuler-os]name=openEuler-osbaseurl=https://mirrors.huaweicloud.com/openeuler/openEuler-20.03-LTS/OS/x86_64/enabled=1gpgcheck=1gpgkey=https://mirrors .huaweicloud.com / openeuler/openEuler-20.03-LTS/OS/x86_64/RPM-GPG-KEY-openEuler [openEuler-everything] name=openEuler-everythingbaseurl= https://mirrors.huaweicloud.com/openeuler/openEuler-20.03-LTS/everything/x86_64/enabled=1gpgcheck=1gpgkey=https://mirrors.huaweicloud.com/openeuler/openEuler-20.03-LTS/everything/x86_64/RPM-GPG-KEY-openEuler[openEuler-EPOL]name=openEuler-epolbaseurl=https://mirrors.huaweicloud.com/openeuler/openEuler-20.03-LTS / EPOL/x86_64/enabled=1gpgcheck= 0 [root @ db1 ~] # step 6yum installs the relevant package.

Execute the following command to install the required packages

Yum install libaio*-y

Yum install libnsl*-y

As follows:

[root@db1] # yum install libaio*-yLast metadata expiration check: 0:00:44 ago on Thu 15 Oct 2020 10:38:26 AM CST.Package libaio-0.3.111-5.oe1.x86_64 is already installed.Dependencies resolved. . [root@db1] # yum install libnsl*-yLast metadata expiration check: 0:00:24 ago on Thu 07 Jan 2021 10:17:38 AM CST.Package libnsl2-1.2.0-4.oe1.x86_64 is already installed.Dependencies resolved. . Step 7 sets the default Python version to 3.x. [root@db1 ~] # cd / usr/bin [root@db1 bin] # mv python python.bak [root@db1 bin] # ln-s python3 / usr/bin/python [root@db1 bin] # python-VPython 3.6.8 step 8 create a database installation directory. [root@db1 ~] # mkdir-p / opt/software/openGauss [root@db1 ~] # cd / opt/software/openGauss [root@db1 openGauss] # 5. Install openGauss database step 1 to create a XML configuration file for database installation. [root@db1 openGauss] # vi clusterconfig.xml

Add the following to the clusterconfig.xml file.

Note: the content of the red mark needs to be modified according to your actual IP and host name. If there is garbled code in Chinese, you can delete these lines.

Step 2 download the database installation package to the installation package directory using wget

Change to the installation directory:

[root@ecs-c9bf bin] # cd / opt/software/openGauss

Use wget to download the installation package:

[root@ecs-c9bf openGauss] # wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/1.1.0/x86_openEuler/openGauss-1.1.0-openEuler-64bit-all.tar.gz

Note: https://opengauss.obs.cn-south-1.myhuaweicloud.com/1.1.0/x86_openEuler/openGauss-1.1.0-openEuler-64bit-all.tar.gz is the download URL of the database installation package, and you do not need to wrap it when entering it.

The successful download is shown as follows:

……

2020-09-14 13:57:23 (9.33 MB/s)-'openGauss-1.1.0-openEuler-64bit-all.tar.gz' saved [58468915]

Step 3 in the directory where the installation package is located, extract the installation package. [root@ecs-c9bf openGauss] # cd / opt/software/openGauss

Extract the installation package:

Extract the openGauss-1.1.0-openEuler-64bit-all.tar.gz package first.

[root@ecs-c9bf openGauss] # tar-zxvf openGauss-1.1.0-openEuler-64bit-all.tar.gz

Then extract the openGauss-1.1.0-openEuler-64bit-om.tar.gz package first.

[root@ecs-c9bf openGauss] # tar-zxvf openGauss-1.1.0-openEuler-64bit-om.tar.gz

After decompression as follows, use the ls command to view it as follows:

[root@ecs-c9bf openGauss] # lsclusterconfig.xml openGauss-Package-bak_392c0438.tar.gzlib scriptopenGauss-1.1.0-openEuler-64bit-all.tar.gz simpleInstallopenGauss-1.1.0-openEuler-64bit-om.sha256 upgrade_sql.sha256openGauss-1.1.0-openEuler-64bit-om.tar.gz upgrade_sql.tar.gzopenGauss-1 .1.0-openEuler-64bit.sha256 version.cfgopenGauss-1.1.0-openEuler-64bit.tar.bz2

After the installation package is unzipped, the script subdirectory is automatically generated under the / opt/software/openGauss path, and various OM tool scripts such as gs_preinstall are generated under the script directory.

Change permissions.

[root@db1 openGauss] # chmod 755-R / opt/software [root@db1 openGauss] # step 4 execute the initialization script. [root@db1 openGauss] # cd / opt/software/openGauss/script [root@db1 script] # python gs_preinstall-U omm-G dbgrp-X / opt/software/openGauss/clusterconfig.xmlParsing the configuration file.Successfully parsed the configuration file.Installing the tools on the local node.Are you sure you want to create trust for root (yes/no)? YesPlease enter password for root.Password: Creating SSH trust for the root permission user.Checking network information. .. Are you sure you want to create the user [omm] and create trust for it (yes/no)? YesPlease enter password for cluster user.Password: Please enter password for cluster user again.Password: Successfully created [omm] user on all nodes.Preparing SSH service.Successfully prepared SSH service. .. Successfully set finish flag.Preinstallation succeeded.

During this period, you need to enter the password of the operating system root user (such as password: openGauss@123) and create the operating system omm user and set the password (such as password: openGauss@123).

When the Preinstallation succeeded content is returned, initialization is complete.

Step 5 initialize the database

Restart the virtual machine with init 6 (mainly to free up some memory resources).

[root@db1 script] # init 6Connection closing...Socket close.Connection closed by foreign host.Disconnected from remote host (ONE) at 10:51:59.Type `help' to learn how to use Xshell prompt.

After a period of time, after the virtual machine is restarted, use SSH tools (such as PuTTY, etc.) to connect to the virtual machine from the local computer by configuring the IP address of the enp0s3 network card (e.g. 192.168.56.123), and log in using the ROOT user, and then do the following.

Update the permissions first.

[root@db1 script] # chmod 755-R / opt/software [root@db1 openGauss] #

The database is then initialized using the omm user.

Note: the corresponding shared memory size is set according to the actual memory size of the user. If this parameter is set, an error will be reported when the database is started. The total memory size of the virtual machine in this experiment is 2G.

Gs_install-X / opt/software/openGauss/clusterconfig.xml-- gsinit-parameter= "- encoding=UTF8"-- dn-guc= "max_process_memory=2GB"-- dn-guc= "shared_buffers=128MB"-- dn-guc= "bulk_write_ring_size=128MB"-- dn-guc= "cstore_buffers=16MB"

The details are as follows:

[root@db1 openGauss] # su-ommLast login: Thu Sep 10 15:26:21 CST 2020 on pts/0 [omm@db1 ~] $cd / opt/software/openGauss/script [omm@db1 script] $gs_install-X / opt/software/openGauss/clusterconfig.xml-gsinit-parameter= "- encoding=UTF8"-dn-guc= "max_process_memory=2GB"-dn-guc= "shared_buffers=128MB"-dn-guc= "bulk_write_ring_size=128MB"-dn-guc= " Cstore_buffers=16MB "Parsing the configuration file.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 filesThe sslcert will be generated in / opt/gaussdb/app/share/sslcert/omCluster installation is completed .Configuring .Successfully started cluster.Successfully installed application.end deploy..

Note: do not enter the omm user password incorrectly (such as password: openGauss@123).

Step 6 clean up the software installation package. [omm@db1 openGauss] $exitlogout [root@db1 /] # cd / root [root@db1 script] # cd / opt/software/openGauss/ [root@db1 openGauss] # lltotal 288M Murray. 1 omm dbgrp 1.4K Jan 7 10:32 clusterconfig.xmldrwx-. 15 root root 4.0K Jan 7 10:31 lib-r-. 1 root root 95M Dec 31 20:59 openGauss-1.1.0-openEuler-64bit-all.tar.gz-r-. 1 root root 65 Dec 31 20:40 openGauss-1.1.0-openEuler-64bit-om.sha256-r-. 1 root root 13M Dec 31 20:40 openGauss-1.1.0-openEuler-64bit-om.tar.gz-r-. 1 root root 65 Dec 31 20:39 openGauss-1.1.0-openEuler-64bit.sha256-r-. 1 root root 84M Dec 31 20:39 openGauss-1.1.0-openEuler-64bit.tar.bz2-r-. 1 root root 96M Jan 7 10:32 openGauss-Package-bak_392c0438.tar.gzdrwx-. 6 root root 4.0K Dec 31 20:40 scriptdrwxr-xr-x. 2 root root 4.0K Dec 31 20:40 simpleInstall-r-. 1 root root 65 Dec 31 20:39 upgrade_sql.sha256-r-. 1 root root 132K Dec 31 20:39 upgrade_sql.tar.gz-r-. 1 root root 32 Dec 31 20:38 version.cfg-rwxr-xr-x. 1 root root 32 Oct 14 02:12 version.cfg [root@db1 openGauss] # rm-rf openGauss-1.1.0-openEuler-64bit-all.tar.gz [root@db1 openGauss] # rm-rf openGauss-1.1.0-openEuler-64bit-om.tar.gz

The database installation is complete.

These are all the contents of the article "how to use a virtual machine to install and deploy an openGauss database on VirtualBox+openEuler". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report