【openGauss】Ubuntu 三条命令装好 opengauss

本文档详细介绍了如何在Ubuntu上通过三条命令快速安装curl、Docker并部署OpenGauss数据库。首先安装curl,然后下载并安装Docker,设置阿里云镜像源。接着拉取并运行OpenGauss镜像,最后通过gsql命令进入数据库。整个过程简单明了,适合初学者参考。

转载

Ubuntu 三条命令装好 opengauss

遇到更新问题:Ubuntu update error “ waiting for unattended-upgr to exit ”

前期准备:安装curl

  • 安装curl
sudo apt install curl

提示信息及截图

ubuntu@ubuntu:~$ sudo apt install curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libfprint-2-tod1 libllvm10
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  curl
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 161 kB of archives.
After this operation, 411 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 curl amd64 7.68.0-1ubuntu2.5 [161 kB]
Fetched 161 kB in 4s (41.0 kB/s)
Selecting previously unselected package curl.
(Reading database ... 181642 files and directories currently installed.)
Preparing to unpack .../curl_7.68.0-1ubuntu2.5_amd64.deb ...
Unpacking curl (7.68.0-1ubuntu2.5) ...
Setting up curl (7.68.0-1ubuntu2.5) ...
Processing triggers for man-db (2.9.1-1) ...

在这里插入图片描述

0x00 安装docker

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

提示信息及截图

ubuntu@ubuntu:~$ curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
# Executing docker install script, commit: 7cae5f8b0decc17d6571f9f52eb840fbc13b2737
+ sudo -E sh -c 'apt-get update -qq >/dev/null'
+ sudo -E sh -c 'DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null'
+ sudo -E sh -c 'curl -fsSL "https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg" | apt-key add -qq - >/dev/null'
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sudo -E sh -c 'echo "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal stable" > /etc/apt/sources.list.d/docker.list'
+ sudo -E sh -c 'apt-get update -qq >/dev/null'
+ '[' -n '' ']'
+ sudo -E sh -c 'apt-get install -y -qq --no-install-recommends docker-ce >/dev/null'
+ '[' -n 1 ']'
+ sudo -E sh -c 'DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce-rootless-extras >/dev/null'
+ sudo -E sh -c 'docker version'
Client: Docker Engine - Community
 Version:           20.10.6
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        370c289
 Built:             Fri Apr  9 22:47:17 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.6
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8728dd2
  Built:            Fri Apr  9 22:45:28 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

================================================================================

To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:

    dockerd-rootless-setuptool.sh install

Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.


To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/

WARNING: Access to the remote API on a privileged Docker daemon is equivalent
         to root access on the host. Refer to the 'Docker daemon attack surface'
         documentation for details: https://docs.docker.com/go/attack-surface/

================================================================================

在这里插入图片描述
在这里插入图片描述

0x01 运行 opengauss 镜像

sudo docker run --name opengauss --privileged=true -d -p 5432:5432 -e GS_PASSWORD=Enmo@123 enmotech/opengauss:latest

这里的 GS_PASSWORD 代表的是数据库密码,注意这里的密码,华为要求必须要8位复杂密码,不然启动会失败,网速比较拉的建议多等几分钟。

提示信息及截图

在这里插入图片描述

ubuntu@ubuntu:~$ sudo docker run --name opengauss --privileged=true -d -p 5432:5432 -e GS_PASSWORD=Enmo@123 enmotech/opengauss:latest
Unable to find image 'enmotech/opengauss:latest' locally
latest: Pulling from enmotech/opengauss
6e0aa5e7af40: Pull complete 
d47239a868b3: Pull complete 
49cbb10cca85: Pull complete 
d6910639727e: Pull complete 
198b89a693b5: Pull complete 
e97f5f63ff90: Pull complete 
85c98af23d7b: Pull complete 
ce1ff23cf5d4: Pull complete 
28bf38101eae: Pull complete 
7a1421755be2: Pull complete 
8cb2b20a1623: Pull complete 
Digest: sha256:9cded343895dd1bae48e46d30cf1ba63e388f7381e9f9bc21394a7143e0925c3
Status: Downloaded newer image for enmotech/opengauss:latest
bd5c72113066504f92511cf0aec334a148c7caacd326a44bd7f26fec6dd2e6d5

0x02 进入容器即可

等待3分钟数据库启动后(电脑比较拉的建议多等几分钟),运行该命令

sudo docker exec -it opengauss bash

0x03 使用 gsql

gsql

提示信息及截图

ubuntu@ubuntu:~$ sudo docker exec -it opengauss bash
omm@bd5c72113066:/$ gsql
gsql ((openGauss 2.0.0 build 78689da9) compiled at 2021-03-31 21:04:03 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

至此,我们进入到了openGauss数据库中。
在这里插入图片描述

转载出处

文章作者: VaalaCat
文章链接: https://docs.vaala.cloud/s/WGXcFNb-7
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 VaalaCat!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值