Sunday, January 23, 2022

How To Install Docker On CentOS 8/Rocky Linux 8

URL: https://phoenixnap.com/kb/how-to-install-docker-on-centos-8

1. Use DNF to add and enable the official Docker CE repository. Type the following command in your terminal window
------------------------------------------------------------------------------------------------------------------
[root@thermalite ~]# dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo                                                                                                    tion
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo

2. Check all relevant repolist details.
---------------------------------------
[root@thermalite ~]# dnf repolist -v
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, kpatch, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
DNF version: 4.4.2
cachedir: /var/cache/dnf
Repository packages-microsoft-com-prod is listed more than once in the configuration
Repository packages-microsoft-com-prod is listed more than once in the configuration
Docker CE Stable - x86_64                                                                                                                                       131 kB/s |  14 kB     00:00
Last metadata expiration check: 0:00:01 ago on Sun 13 Jun 2021 08:31:12 AM EDT.
Repo-id            : appstream
Repo-name          : CentOS Linux 8 - AppStream
Repo-revision      : 8.4.2105
Repo-distro-tags      : [cpe:/o:centos:centos:8]:  , 8, C, O, S, e, n, t
Repo-updated       : Tue 08 Jun 2021 12:04:59 PM EDT
Repo-pkgs          : 6,133
Repo-available-pkgs: 5,254
Repo-size          : 8.8 G
Repo-mirrors       : http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock
Repo-baseurl       : http://mirrors.xmission.com/centos/8.4.2105/AppStream/x86_64/os/ (9 more)
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:11 AM EDT)
Repo-filename      : /etc/yum.repos.d/CentOS-Linux-AppStream.repo

Repo-id            : baseos
Repo-name          : CentOS Linux 8 - BaseOS
Repo-revision      : 8.4.2105
Repo-distro-tags      : [cpe:/o:centos:centos:8]:  , 8, C, O, S, e, n, t
Repo-updated       : Tue 08 Jun 2021 12:04:44 PM EDT
Repo-pkgs          : 1,745
Repo-available-pkgs: 1,743
Repo-size          : 1.2 G
Repo-mirrors       : http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=BaseOS&infra=stock
Repo-baseurl       : http://mirror.arizona.edu/centos/8.4.2105/BaseOS/x86_64/os/ (9 more)
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:11 AM EDT)
Repo-filename      : /etc/yum.repos.d/CentOS-Linux-BaseOS.repo

Repo-id            : docker-ce-stable
Repo-name          : Docker CE Stable - x86_64
Repo-revision      : 1622662057
Repo-updated       : Wed 02 Jun 2021 03:27:37 PM EDT
Repo-pkgs          : 38
Repo-available-pkgs: 38
Repo-size          : 937 M
Repo-baseurl       : https://download.docker.com/linux/centos/8/x86_64/stable
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 08:31:12 AM EDT)
Repo-filename      : /etc/yum.repos.d/docker-ce.repo

Repo-id            : epel
Repo-name          : Extra Packages for Enterprise Linux 8 - x86_64
Repo-revision      : 1623461479
Repo-updated       : Fri 11 Jun 2021 09:31:50 PM EDT
Repo-pkgs          : 7,440
Repo-available-pkgs: 7,437
Repo-size          : 11 G
Repo-metalink      : https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=stock&content=centos
  Updated          : Sun 13 Jun 2021 04:29:12 AM EDT
Repo-baseurl       : https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/ (48 more)
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:12 AM EDT)
Repo-filename      : /etc/yum.repos.d/epel.repo

Repo-id            : epel-modular
Repo-name          : Extra Packages for Enterprise Linux Modular 8 - x86_64
Repo-revision      : 1623287700
Repo-updated       : Wed 09 Jun 2021 09:15:14 PM EDT
Repo-pkgs          : 182
Repo-available-pkgs: 0
Repo-size          : 536 M
Repo-metalink      : https://mirrors.fedoraproject.org/metalink?repo=epel-modular-8&arch=x86_64&infra=stock&content=centos
  Updated          : Sun 13 Jun 2021 04:29:12 AM EDT
Repo-baseurl       : http://epel.mirror.constant.com/8/Modular/x86_64/ (50 more)
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:12 AM EDT)
Repo-filename      : /etc/yum.repos.d/epel-modular.repo

Repo-id            : extras
Repo-name          : CentOS Linux 8 - Extras
Repo-revision      : 1618497802
Repo-updated       : Thu 15 Apr 2021 10:42:53 AM EDT
Repo-pkgs          : 34
Repo-available-pkgs: 34
Repo-size          : 385 k
Repo-mirrors       : http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=extras&infra=stock
Repo-baseurl       : http://sjc.edge.kernel.org/centos/8.4.2105/extras/x86_64/os/ (9 more)
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:11 AM EDT)
Repo-filename      : /etc/yum.repos.d/CentOS-Linux-Extras.repo

Repo-id            : google-chrome
Repo-name          : google-chrome
Repo-revision      : 1623354504
Repo-updated       : Thu 10 Jun 2021 03:48:24 PM EDT
Repo-pkgs          : 3
Repo-available-pkgs: 3
Repo-size          : 237 M
Repo-baseurl       : http://dl.google.com/linux/chrome/rpm/stable/x86_64
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:12 AM EDT)
Repo-filename      : /etc/yum.repos.d/google-chrome.repo

Repo-id            : jenkins
Repo-name          : Jenkins-stable
Repo-revision      : 1622703353
Repo-updated       : Thu 03 Jun 2021 02:55:54 AM EDT
Repo-pkgs          : 121
Repo-available-pkgs: 121
Repo-size          : 7.3 G
Repo-baseurl       : http://pkg.jenkins.io/redhat-stable
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:12 AM EDT)
Repo-filename      : /etc/yum.repos.d/jenkins.repo

Repo-id            : packages-microsoft-com-mssql-server-2019
Repo-name          : packages-microsoft-com-mssql-server-2019
Repo-revision      : 1623361364
Repo-updated       : Thu 10 Jun 2021 05:42:44 PM EDT
Repo-pkgs          : 115
Repo-available-pkgs: 115
Repo-size          : 16 G
Repo-baseurl       : https://packages.microsoft.com/rhel/8/mssql-server-2019/
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:13 AM EDT)
Repo-filename      : /etc/yum.repos.d/mssql-server-2019.repo

Repo-id            : packages-microsoft-com-prod
Repo-name          : packages-microsoft-com-prod
Repo-revision      : 1623344677
Repo-updated       : Thu 10 Jun 2021 01:04:37 PM EDT
Repo-pkgs          : 304
Repo-available-pkgs: 304
Repo-size          : 8.8 G
Repo-baseurl       : https://packages.microsoft.com/centos/8/prod
Repo-expire        : 172,800 second(s) (last: Sun 13 Jun 2021 04:29:12 AM EDT)
Repo-filename      : /etc/yum.repos.d/microsoft-prod.repo
Total packages: 16,115

3. To list all the available docker-ce packages, type:
------------------------------------------------------
[root@thermalite ~]# dnf list docker-ce --showduplicates | sort -r
Repository packages-microsoft-com-prod is listed more than once in the configuration
Repository packages-microsoft-com-prod is listed more than once in the configuration
Last metadata expiration check: 0:00:11 ago on Sun 13 Jun 2021 08:31:12 AM EDT.
docker-ce.x86_64                3:20.10.7-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.6-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.5-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.4-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.3-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.2-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.1-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.0-3.el8                 docker-ce-stable
docker-ce.x86_64                3:19.03.15-3.el8                docker-ce-stable
docker-ce.x86_64                3:19.03.14-3.el8                docker-ce-stable
docker-ce.x86_64                3:19.03.13-3.el8                docker-ce-stable
Available Packages

4. install docker
------------------------------------------------------
[root@thermalite ~]# dnf install docker-ce --nobest
Repository packages-microsoft-com-prod is listed more than once in the configuration
Repository packages-microsoft-com-prod is listed more than once in the configuration
Last metadata expiration check: 0:00:46 ago on Sun 13 Jun 2021 08:31:12 AM EDT.
Dependencies resolved.
================================================================================================================================================================================================
 Package                                          Architecture                  Version                                                           Repository                               Size
================================================================================================================================================================================================
Installing:
 docker-ce                                        x86_64                        3:20.10.7-3.el8                                                   docker-ce-stable                         27 M
Installing dependencies:
 container-selinux                                noarch                        2:2.158.0-1.module_el8.4.0+781+acf4c33b                           appstream                                51 k
 containerd.io                                    x86_64                        1.4.6-3.1.el8                                                     docker-ce-stable                         34 M
 docker-ce-cli                                    x86_64                        1:20.10.7-3.el8                                                   docker-ce-stable                         33 M
 docker-ce-rootless-extras                        x86_64                        20.10.7-3.el8                                                     docker-ce-stable                        9.2 M
 docker-scan-plugin                               x86_64                        0.8.0-3.el8                                                       docker-ce-stable                        4.2 M
 fuse-overlayfs                                   x86_64                        1.4.0-2.module_el8.4.0+673+eabfc99d                               appstream                                72 k
 fuse3                                            x86_64                        3.2.1-12.el8                                                      baseos                                   50 k
 fuse3-libs                                       x86_64                        3.2.1-12.el8                                                      baseos                                   94 k
 libcgroup                                        x86_64                        0.41-19.el8                                                       baseos                                   70 k
 libslirp                                         x86_64                        4.3.1-1.module_el8.4.0+575+63b40ad7                               appstream                                69 k
 slirp4netns                                      x86_64                        1.1.8-1.module_el8.4.0+641+6116a774                               appstream                                51 k
Enabling module streams:
 container-tools                                                                rhel8

Transaction Summary
================================================================================================================================================================================================
Install  12 Packages

Total download size: 107 M
Installed size: 439 M
Is this ok [y/N]: y
Downloading Packages:
(1/12): fuse-overlayfs-1.4.0-2.module_el8.4.0+673+eabfc99d.x86_64.rpm                                                                                           735 kB/s |  72 kB     00:00
(2/12): libslirp-4.3.1-1.module_el8.4.0+575+63b40ad7.x86_64.rpm                                                                                                 668 kB/s |  69 kB     00:00
(3/12): container-selinux-2.158.0-1.module_el8.4.0+781+acf4c33b.noarch.rpm                                                                                      481 kB/s |  51 kB     00:00
(4/12): slirp4netns-1.1.8-1.module_el8.4.0+641+6116a774.x86_64.rpm                                                                                              2.4 MB/s |  51 kB     00:00
(5/12): fuse3-3.2.1-12.el8.x86_64.rpm                                                                                                                           205 kB/s |  50 kB     00:00
(6/12): libcgroup-0.41-19.el8.x86_64.rpm                                                                                                                        295 kB/s |  70 kB     00:00
(7/12): fuse3-libs-3.2.1-12.el8.x86_64.rpm                                                                                                                      367 kB/s |  94 kB     00:00
(8/12): docker-ce-20.10.7-3.el8.x86_64.rpm                                                                                                                       27 MB/s |  27 MB     00:00
(9/12): docker-ce-cli-20.10.7-3.el8.x86_64.rpm                                                                                                                   31 MB/s |  33 MB     00:01
(10/12): containerd.io-1.4.6-3.1.el8.x86_64.rpm                                                                                                                  28 MB/s |  34 MB     00:01
(11/12): docker-scan-plugin-0.8.0-3.el8.x86_64.rpm                                                                                                               26 MB/s | 4.2 MB     00:00
(12/12): docker-ce-rootless-extras-20.10.7-3.el8.x86_64.rpm                                                                                                      26 MB/s | 9.2 MB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                            51 MB/s | 107 MB     00:02
warning: /var/cache/dnf/docker-ce-stable-fa9dc42ab4cec2f4/packages/containerd.io-1.4.6-3.1.el8.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Docker CE Stable - x86_64                                                                                                                                        40 kB/s | 1.6 kB     00:00
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) "
 Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
 From       : https://download.docker.com/linux/centos/gpg
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                        1/1
  Installing       : docker-scan-plugin-0.8.0-3.el8.x86_64                                                                                                                                 1/12
  Running scriptlet: docker-scan-plugin-0.8.0-3.el8.x86_64                                                                                                                                 1/12
  Installing       : docker-ce-cli-1:20.10.7-3.el8.x86_64                                                                                                                                  2/12
  Running scriptlet: docker-ce-cli-1:20.10.7-3.el8.x86_64                                                                                                                                  2/12
  Running scriptlet: container-selinux-2:2.158.0-1.module_el8.4.0+781+acf4c33b.noarch                                                                                                      3/12
  Installing       : container-selinux-2:2.158.0-1.module_el8.4.0+781+acf4c33b.noarch                                                                                                      3/12
  Running scriptlet: container-selinux-2:2.158.0-1.module_el8.4.0+781+acf4c33b.noarch                                                                                                      3/12
  Installing       : containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                    4/12
  Running scriptlet: containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                    4/12
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                                                                                          5/12
  Installing       : libcgroup-0.41-19.el8.x86_64                                                                                                                                          5/12
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                                                                                          5/12
  Installing       : fuse3-libs-3.2.1-12.el8.x86_64                                                                                                                                        6/12
  Running scriptlet: fuse3-libs-3.2.1-12.el8.x86_64                                                                                                                                        6/12
  Installing       : fuse3-3.2.1-12.el8.x86_64                                                                                                                                             7/12
  Installing       : fuse-overlayfs-1.4.0-2.module_el8.4.0+673+eabfc99d.x86_64                                                                                                             8/12
  Running scriptlet: fuse-overlayfs-1.4.0-2.module_el8.4.0+673+eabfc99d.x86_64                                                                                                             8/12
  Installing       : libslirp-4.3.1-1.module_el8.4.0+575+63b40ad7.x86_64                                                                                                                   9/12
  Installing       : slirp4netns-1.1.8-1.module_el8.4.0+641+6116a774.x86_64                                                                                                               10/12
  Installing       : docker-ce-rootless-extras-20.10.7-3.el8.x86_64                                                                                                                       11/12
  Running scriptlet: docker-ce-rootless-extras-20.10.7-3.el8.x86_64                                                                                                                       11/12
  Installing       : docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                     12/12
  Running scriptlet: docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                     12/12
  Running scriptlet: container-selinux-2:2.158.0-1.module_el8.4.0+781+acf4c33b.noarch                                                                                                     12/12
  Running scriptlet: docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                     12/12
  Verifying        : container-selinux-2:2.158.0-1.module_el8.4.0+781+acf4c33b.noarch                                                                                                      1/12
  Verifying        : fuse-overlayfs-1.4.0-2.module_el8.4.0+673+eabfc99d.x86_64                                                                                                             2/12
  Verifying        : libslirp-4.3.1-1.module_el8.4.0+575+63b40ad7.x86_64                                                                                                                   3/12
  Verifying        : slirp4netns-1.1.8-1.module_el8.4.0+641+6116a774.x86_64                                                                                                                4/12
  Verifying        : fuse3-3.2.1-12.el8.x86_64                                                                                                                                             5/12
  Verifying        : fuse3-libs-3.2.1-12.el8.x86_64                                                                                                                                        6/12
  Verifying        : libcgroup-0.41-19.el8.x86_64                                                                                                                                          7/12
  Verifying        : containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                    8/12
  Verifying        : docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                      9/12
  Verifying        : docker-ce-cli-1:20.10.7-3.el8.x86_64                                                                                                                                 10/12
  Verifying        : docker-ce-rootless-extras-20.10.7-3.el8.x86_64                                                                                                                       11/12
  Verifying        : docker-scan-plugin-0.8.0-3.el8.x86_64                                                                                                                                12/12

Installed:
  container-selinux-2:2.158.0-1.module_el8.4.0+781+acf4c33b.noarch       containerd.io-1.4.6-3.1.el8.x86_64                        docker-ce-3:20.10.7-3.el8.x86_64
  docker-ce-cli-1:20.10.7-3.el8.x86_64                                   docker-ce-rootless-extras-20.10.7-3.el8.x86_64            docker-scan-plugin-0.8.0-3.el8.x86_64
  fuse-overlayfs-1.4.0-2.module_el8.4.0+673+eabfc99d.x86_64              fuse3-3.2.1-12.el8.x86_64                                 fuse3-libs-3.2.1-12.el8.x86_64
  libcgroup-0.41-19.el8.x86_64                                           libslirp-4.3.1-1.module_el8.4.0+575+63b40ad7.x86_64       slirp4netns-1.1.8-1.module_el8.4.0+641+6116a774.x86_64

Complete!
[root@thermalite ~]#

5. install containerd.io Package Manually
------------------------------------------------------------------------
[root@thermalite ~]# dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.10-3.2.el7.x86_64.rpm
Repository packages-microsoft-com-prod is listed more than once in the configuration
Repository packages-microsoft-com-prod is listed more than once in the configuration
Last metadata expiration check: 0:08:07 ago on Sun 13 Jun 2021 08:33:07 AM EDT.
containerd.io-1.2.10-3.2.el7.x86_64.rpm                                                                                                                          74 MB/s |  23 MB     00:00
Dependencies resolved.
================================================================================================================================================================================================
 Package                                       Architecture                           Version                                            Repository                                        Size
================================================================================================================================================================================================
Downgrading:
 containerd.io                                 x86_64                                 1.2.10-3.2.el7                                     @commandline                                      23 M
 docker-ce                                     x86_64                                 3:19.03.15-3.el8                                   docker-ce-stable                                  24 M

Transaction Summary
================================================================================================================================================================================================
Downgrade  2 Packages

Total size: 47 M
Total download size: 24 M
Is this ok [y/N]: y
Downloading Packages:
docker-ce-19.03.15-3.el8.x86_64.rpm                                                                                                                              58 MB/s |  24 MB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                            58 MB/s |  24 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                        1/1
  Running scriptlet: containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    1/1
  Downgrading      : containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    1/4
  Running scriptlet: containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    1/4
  Downgrading      : docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      2/4
  Running scriptlet: docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      2/4
  Running scriptlet: docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       3/4
  Cleanup          : docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       3/4
  Running scriptlet: docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       3/4
  Running scriptlet: containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     4/4
  Cleanup          : containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     4/4
  Running scriptlet: containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     4/4
  Verifying        : docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      1/4
  Verifying        : docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       2/4
  Verifying        : containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    3/4
  Verifying        : containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     4/4

Downgraded:
  containerd.io-1.2.10-3.2.el7.x86_64                                                             docker-ce-3:19.03.15-3.el8.x86_64

Complete!

[root@thermalite ~]#

6. Now we can proceed to install the latest version of docker-ce with a simple command
---------------------------------------------------------------------------------------
[root@thermalite ~]# dnf install docker-ce -y
Repository packages-microsoft-com-prod is listed more than once in the configuration
Repository packages-microsoft-com-prod is listed more than once in the configuration
Last metadata expiration check: 0:09:03 ago on Sun 13 Jun 2021 08:33:07 AM EDT.
Package docker-ce-3:19.03.15-3.el8.x86_64 is already installed.
Dependencies resolved.
================================================================================================================================================================================================
 Package                                       Architecture                           Version                                            Repository                                        Size
================================================================================================================================================================================================
Upgrading:
 containerd.io                                 x86_64                                 1.4.6-3.1.el8                                      docker-ce-stable                                  34 M
 docker-ce                                     x86_64                                 3:20.10.7-3.el8                                    docker-ce-stable                                  27 M

Transaction Summary
================================================================================================================================================================================================
Upgrade  2 Packages

Total download size: 60 M
Downloading Packages:
(1/2): docker-ce-20.10.7-3.el8.x86_64.rpm                                                                                                                        48 MB/s |  27 MB     00:00
(2/2): containerd.io-1.4.6-3.1.el8.x86_64.rpm                                                                                                                    40 MB/s |  34 MB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                            72 MB/s |  60 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                        1/1
  Running scriptlet: containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     1/1
  Upgrading        : containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     1/4
  Running scriptlet: containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     1/4
  Upgrading        : docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       2/4
  Running scriptlet: docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       2/4
  Running scriptlet: docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      3/4
  Cleanup          : docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      3/4
  Running scriptlet: docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      3/4
  Running scriptlet: containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    4/4
  Cleanup          : containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    4/4
  Running scriptlet: containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    4/4
  Verifying        : containerd.io-1.4.6-3.1.el8.x86_64                                                                                                                                     1/4
  Verifying        : containerd.io-1.2.10-3.2.el7.x86_64                                                                                                                                    2/4
  Verifying        : docker-ce-3:20.10.7-3.el8.x86_64                                                                                                                                       3/4
  Verifying        : docker-ce-3:19.03.15-3.el8.x86_64                                                                                                                                      4/4

Upgraded:
  containerd.io-1.4.6-3.1.el8.x86_64                                                              docker-ce-3:20.10.7-3.el8.x86_64

Complete!

[root@thermalite ~]#

7.Start and Test Docker, Enable Docker
---------------------------------------
[root@thermalite ~]# systemctl enable --now docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.

8. Next, use this short command to confirm that Docker is active and running:
-----------------------------------------------------------------------------
[root@thermalite ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2021-06-13 08:43:10 EDT; 9s ago
     Docs: https://docs.docker.com
 Main PID: 24248 (dockerd)
    Tasks: 12
   Memory: 47.8M
   CGroup: /system.slice/docker.service
           └─24248 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Jun 13 08:43:09 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:09.443251237-04:00" level=warning msg="Your kernel does not support cgroup blkio weight"
Jun 13 08:43:09 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:09.443276846-04:00" level=warning msg="Your kernel does not support cgroup blkio weight_device"
Jun 13 08:43:09 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:09.443418994-04:00" level=info msg="Loading containers: start."
Jun 13 08:43:10 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:10.408960141-04:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon>
Jun 13 08:43:10 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:10.523460635-04:00" level=info msg="Firewalld: interface docker0 already part of docker zone, returning"
Jun 13 08:43:10 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:10.694621276-04:00" level=info msg="Loading containers: done."
Jun 13 08:43:10 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:10.802528833-04:00" level=info msg="Docker daemon" commit=b0f5bc3 graphdriver(s)=overlay2 version=20.10.7
Jun 13 08:43:10 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:10.802629176-04:00" level=info msg="Daemon has completed initialization"
Jun 13 08:43:10 thermalite.localdomain systemd[1]: Started Docker Application Container Engine.
Jun 13 08:43:10 thermalite.localdomain dockerd[24248]: time="2021-06-13T08:43:10.960984827-04:00" level=info msg="API listen on /var/run/docker.sock"
[root@thermalite ~]#

9. Login as ordinary user, and add your user to the docker group with the following command:
---------------------------------------------------------------
[malex@thermalite ~]$ sudo usermod -aG docker $USER
[sudo] password for malex:
[malex@thermalite ~]$  id $USER
uid=1002(malex) gid=1002(malex) groups=1002(malex),970(docker)
[malex@thermalite ~]$

10. check docker installation
-----------------------------
[malex@thermalite ~]$ rpm -qa | grep docker
docker-scan-plugin-0.8.0-3.el8.x86_64
docker-ce-cli-20.10.7-3.el8.x86_64
docker-ce-20.10.7-3.el8.x86_64
docker-ce-rootless-extras-20.10.7-3.el8.x86_64

11. check docker version
-----------------------------
[malex@thermalite ~]$ docker --version
Docker version 20.10.7, build f0df350

12. test docker pull
-----------------------------
[malex@thermalite ~]$ docker pull alpine
Using default tag: latest
latest: Pulling from library/alpine
540db60ca938: Pull complete
Digest: sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f
Status: Downloaded newer image for alpine:latest
docker.io/library/alpine:latest

13. list docker image
-----------------------------
[malex@thermalite ~]$ sudo docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
alpine       latest    6dbb9cc54074   8 weeks ago   5.61MB

14. test run docker image
-----------------------------
[malex@thermalite ~]$ sudo docker run -it --rm alpine /bin/sh
/ # apk update
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
v3.13.5-194-g1274644b64 [https://dl-cdn.alpinelinux.org/alpine/v3.13/main]
v3.13.5-187-g1477654ee3 [https://dl-cdn.alpinelinux.org/alpine/v3.13/community]
OK: 13890 distinct packages available
/ # exit

Install Docker Compose

15. download docker-compose
-----------------------------
[root@thermalite ~]# curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   633  100   633    0     0   4137      0 --:--:-- --:--:-- --:--:--  4110
100 16.2M  100 16.2M    0     0  21.8M      0 --:--:-- --:--:-- --:--:-- 21.8M

16. set docker-compose to runnable
---------------------------------------------------
[root@thermalite ~]# chmod +x /usr/local/bin/docker-compose

17. check version
---------------------------------------------------
[root@thermalite ~]# docker-compose --version
docker-compose version 1.25.0, build 0a186604

18. execute several test runs
---------------------------------------------------
[malex@thermalite ~]$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:9f6ad537c5132bcce57f7a0a20e317228d382c3cd61edae14650eec68b2b345c
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/


[malex@thermalite ~]$  docker run -it ubuntu bash
root@67b24aca2432:/# exit
exit

[malex@thermalite ~]$ 

How to Setup Docker Credentials Store for AWSCLI

[root@thermalite ~]# dnf install rng-tools -y

[malex@thermalite Kubernetes-NodeJs]$ rngd -r /dev/urandom

[root@thermalite ~]# dnf install pass -y

[malex@thermalite Kubernetes-NodeJs]$ gpg --full-generate-key
gpg (GnuPG) 2.2.19; Copyright (C) 2019 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gpg: directory '/home/malex/.gnupg' created
gpg: keybox '/home/malex/.gnupg/pubring.kbx' created
Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
  (14) Existing key from card
Your selection?
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (3072)
Requested keysize is 3072 bits
Please specify how long the key should be valid.
         0 = key does not expire
        = key expires in n days
      w = key expires in n weeks
      m = key expires in n months
      y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: juan dela cruz
Email address: jdelacruz@gmail.com
Comment: docker-credentials
You selected this USER-ID:
    "juan dela cruz (docker-credentials) "

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: /home/malex/.gnupg/trustdb.gpg: trustdb created
gpg: key 347578674476 marked as ultimately trusted
gpg: directory '/home/malex/.gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/home/malex/.gnupg/openpgp-revocs.d/7ZGCE6EE4582676E02ZB69DC76C4CAZCD5645057.rev'
public and secret key created and signed.

pub   rsa3072 2022-01-23 [SC]
      00T1B2AC8885D969DF5573FFC570FE4B588303C4
uid                      "juan dela cruz (docker-credentials) "
sub   rsa3072 2022-01-23 [E]

[347578674476@thermalite Kubernetes-NodeJs]$ mkdir ~/bin

[347578674476@thermalite Kubernetes-NodeJs]$ cd ~/bin

[347578674476@thermalite Kubernetes-NodeJs]$ echo 'export PATH=$PATH:~/bin' >> ~/.bashrc

[347578674476@thermalite Kubernetes-NodeJs]$ wget https://github.com/docker/docker-credential-helpers/releases/download/v0.6.3/docker-credential-pass-v0.6.3-amd64.tar.gz
--2022-01-23 00:27:44--  https://github.com/docker/docker-credential-helpers/releases/download/v0.6.3/docker-credential-pass-v0.6.3-amd64.tar.gz
Resolving github.com (github.com)... 140.82.113.3
Connecting to github.com (github.com)|140.82.113.3|:443... connected.
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1486371 (1.4M) [application/octet-stream]
Saving to: ‘docker-credential-pass-v0.6.3-amd64.tar.gz’

docker-credential-pass-v0 100%[===================================>]   1.42M  --.-KB/s    in 0.04s

2022-01-23 00:27:45 (38.8 MB/s) - ‘docker-credential-pass-v0.6.3-amd64.tar.gz’ saved [1486371/1486371]

[347578674476@thermalite Kubernetes-NodeJs]$ tar xvzf docker-credential-pass-v0.6.3-amd64.tar.gz
docker-credential-pass

[root@thermalite ~]# chmod a+x docker-credential-pass

[root@thermalite ~]# cp docker-credential-pass /usr/local/bin

[347578674476@thermalite Kubernetes-NodeJs]$ mkdir ~/.docker

[347578674476@thermalite Kubernetes-NodeJs]$ gpg --list-secret-keys
/home/347578674476/.gnupg/pubring.kbx
------------------------------
sec   rsa2048 2022-01-23 [SC]
      00T1B2AC8885D969DF5573FFC570FE4B588303C4
uid           [ultimate] "juan dela cruz (docker-credentials) "
ssb   rsa2048 2022-01-23 [E]


[347578674476@thermalite Kubernetes-NodeJs]$ pass init 00T1B2AC8885D969DF5573FFC570FE4B588303C4
Password store initialized for 00T1B2AC8885D969DF5573FFC570FE4B588303C4

[347578674476@thermalite Kubernetes-NodeJs]$ pass insert docker-credential-helpers/docker-pass-initialized-check
Enter password for docker-credential-helpers/docker-pass-initialized-check: pass is initialized
Retype password for docker-credential-helpers/docker-pass-initialized-check: pass is initialized

[347578674476@thermalite Kubernetes-NodeJs]$ pass show docker-credential-helpers/docker-pass-initialized-check
pass is initialized

[347578674476@thermalite Kubernetes-NodeJs]$ docker logout
Removing login credentials for https://index.docker.io/v1/

[347578674476@thermalite Kubernetes-NodeJs]$ docker-credential-pass list
{"347578674476.dkr.ecr.us-east-1.amazonaws.com":"AWS","https://index.docker.io/v1/":"jdelacruz"}

[347578674476@thermalite Kubernetes-NodeJs]$ vi ~/.docker/config.json

[347578674476@thermalite Kubernetes-NodeJs]$ cat ~/.docker/config.json
{
        "auths": {
                "347578674476.dkr.ecr.us-east-1.amazonaws.com": {},
                "https://index.docker.io/v1/": {}
        },
        "credsStore": "pass"
}
[347578674476@thermalite Kubernetes-NodeJs]$

[347578674476@thermalite Kubernetes-NodeJs]$ sed -i '0,/{/s/{/{\n\t"credsStore": "pass",/' ~/.docker/config.json

[347578674476@thermalite Kubernetes-NodeJs]$ vi ~/.docker/config.json

[347578674476@thermalite Kubernetes-NodeJs]$ docker-credential-pass list
{}

How to Install AWSCLI on Rocky Linux 8 / Centos 8

Note:
    It is assumed that you have a working docker that will be use to build a docker image.


1. add the current user to the root group
[root@DESKTOP-M9QDJVD Alex Madriaga]# useradd -m -s $(which bash) -G root malex
  
2. change user from root to regular user
[root@DESKTOP-M9QDJVD Alex Madriaga]# sudo -i -u malex

3. install awscli as a regular user
[malex@DESKTOP-M9QDJVD ~]$ pip3 install awscli --upgrade --user

4. check the version
[malex@DESKTOP-M9QDJVD ~]$ aws --version
aws-cli/1.22.41 Python/3.6.8 Linux/5.10.16.3-microsoft-standard-WSL2 botocore/1.23.41  

5. configure credentials
[malex@DESKTOP-M9QDJVD ~]$ aws configure
AWS Access Key ID [None]: JKIJ9BFLQ242O9M2HFDR
AWS Secret Access Key [None]: RB8T8EKegNkURW+llpnneELqnlXUwXEhhhpzH7Ij
Default region name [None]: us-east-1
Default output format [None]: json

6. check the 2 files created
[malex@DESKTOP-M9QDJVD ~]$ cat ~/.aws/credentials
[default]
aws_access_key_id = JKIJ9BFLQ242O9M2HFDR
aws_secret_access_key = RB8T8EKegNkURW+llpnneELqnlXUwXEhhhpzH7Ij

[malex@DESKTOP-M9QDJVD ~]$ cat ~/.aws/config
[default]
region = us-east-1
output = json

7. login to aws 
[malex@DESKTOP-M9QDJVD ~]$ aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 867579674613.dkr.ecr.us-east-1.amazonaws.com/test-ecr
-bash: docker: command not found
Exception ignored in: <_io.TextIOWrapper name='' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe
[malex@DESKTOP-M9QDJVD ~]$

8. install docker (see separate guide)

9. install docker-credential-store (see separate guide)

10. after installing docker successfully, try again
[malex@DESKTOP-M9QDJVD ~]$ aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 867579674613.dkr.ecr.us-east-1.amazonaws.com/test-ecr
Login Succeeded

Saturday, June 12, 2021

Install Microsoft SQL Server 2019 Express on Centos 8

Install Microsoft SQL Server 2019 Express on Centos 8

[root@thermalite ~]# sudo curl https://packages.microsoft.com/config/rhel/8/mssql-server-2019.repo -o /etc/yum.repos.d/mssql-server-2019.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   231  100   231    0     0    639      0 --:--:-- --:--:-- --:--:--   638

[root@thermalite ~]# sudo  curl https://packages.microsoft.com/config/rhel/8/prod.repo -o /etc/yum.repos.d/msprod.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   192  100   192    0     0    611      0 --:--:-- --:--:-- --:--:--   609
[root@thermalite ~]# sudo dnf -y install mssql-server
Repository packages-microsoft-com-prod is listed more than once in the configuration
Repository packages-microsoft-com-prod is listed more than once in the configuration
packages-microsoft-com-mssql-server-2019                                                                                                                                         3.0 MB/s | 4.0 MB     00:01
Last metadata expiration check: 0:00:02 ago on Sat 12 Jun 2021 12:28:51 PM EDT.
Dependencies resolved.
=================================================================================================================================================================================================================
 Package                                     Architecture                          Version                                         Repository                                                               Size
=================================================================================================================================================================================================================
Installing:
 mssql-server                                x86_64                                15.0.4138.2-1                                   packages-microsoft-com-mssql-server-2019                                232 M
Installing dependencies:
 cyrus-sasl                                  x86_64                                2.1.27-5.el8                                    baseos                                                                   96 k

Transaction Summary
=================================================================================================================================================================================================================
Install  2 Packages

Total download size: 232 M
Installed size: 1.1 G
Downloading Packages:
(1/2): cyrus-sasl-2.1.27-5.el8.x86_64.rpm                                                                                                                                        160 kB/s |  96 kB     00:00
(2/2): mssql-server-15.0.4138.2-1.x86_64.rpm                                                                                                                                     9.0 MB/s | 232 MB     00:25
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                            8.9 MB/s | 232 MB     00:25
warning: /var/cache/dnf/packages-microsoft-com-mssql-server-2019-e6d048b9178d6297/packages/mssql-server-15.0.4138.2-1.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
packages-microsoft-com-mssql-server-2019                                                                                                                                         2.9 kB/s | 983  B     00:00
Importing GPG key 0xBE1229CF:
 Userid     : "Microsoft (Release signing) "
 Fingerprint: BC52 8686 B50D 79E3 39D3 721C EB3E 94AD BE12 29CF
 From       : https://packages.microsoft.com/keys/microsoft.asc
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                         1/1
  Running scriptlet: cyrus-sasl-2.1.27-5.el8.x86_64                                                                                                                                                          1/2
  Installing       : cyrus-sasl-2.1.27-5.el8.x86_64                                                                                                                                                          1/2
  Running scriptlet: cyrus-sasl-2.1.27-5.el8.x86_64                                                                                                                                                          1/2
  Running scriptlet: mssql-server-15.0.4138.2-1.x86_64                                                                                                                                                       2/2
  Installing       : mssql-server-15.0.4138.2-1.x86_64                                                                                                                                                       2/2
  Running scriptlet: mssql-server-15.0.4138.2-1.x86_64                                                                                                                                                       2/2

+--------------------------------------------------------------+
Please run 'sudo /opt/mssql/bin/mssql-conf setup'
to complete the setup of Microsoft SQL Server
+--------------------------------------------------------------+


  Verifying        : cyrus-sasl-2.1.27-5.el8.x86_64                                                                                                                                                          1/2
  Verifying        : mssql-server-15.0.4138.2-1.x86_64                                                                                                                                                       2/2

Installed:
  cyrus-sasl-2.1.27-5.el8.x86_64                                                                        mssql-server-15.0.4138.2-1.x86_64

Complete!
[root@thermalite ~]#

[root@thermalite ~]# rpm -qi mssql-server
Name        : mssql-server
Version     : 15.0.4138.2
Release     : 1
Architecture: x86_64
Install Date: Sat 12 Jun 2021 12:29:49 PM EDT
Group       : Unspecified
Size        : 1162993815
License     : Commercial
Signature   : RSA/SHA256, Sat 29 May 2021 05:51:25 AM EDT, Key ID eb3e94adbe1229cf
Source RPM  : mssql-server-15.0.4138.2-1.src.rpm
Build Date  : Sat 29 May 2021 03:54:07 AM EDT
Build Host  : hls-rhel8-1-prod-build-rhel8-03
Relocations : (not relocatable)
Summary     : Microsoft SQL Server Relational Database Engine
Description :
The mssql-server package contains the Microsoft SQL Server Relational Database Engine.

[root@thermalite ~]# /opt/mssql/bin/mssql-conf setup
usermod: no changes
Choose an edition of SQL Server:
  1) Evaluation (free, no production use rights, 180-day limit)
  2) Developer (free, no production use rights)
  3) Express (free)
  4) Web (PAID)
  5) Standard (PAID)
  6) Enterprise (PAID) - CPU Core utilization restricted to 20 physical/40 hyperthreaded
  7) Enterprise Core (PAID) - CPU Core utilization up to Operating System Maximum
  8) I bought a license through a retail sales channel and have a product key to enter.

Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=2109348&clcid=0x409

Use of PAID editions of this software requires separate licensing through a
Microsoft Volume Licensing program.
By choosing a PAID edition, you are verifying that you have the appropriate
number of licenses in place to install and run this software.

Enter your edition(1-8): 3
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=2104294&clcid=0x409

The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409

Do you accept the license terms? [Yes/No]:yes

Enter the SQL Server system administrator password: my_msql_server_pass

The licensing PID was successfully processed. The new edition is [Express Edition].
ForceFlush is enabled for this instance.
ForceFlush feature is enabled for log durability.
Created symlink /etc/systemd/system/multi-user.target.wants/mssql-server.service → /usr/lib/systemd/system/mssql-server.service.
Setup has completed successfully. SQL Server is now starting.

[root@thermalite ~]# systemctl status mssql-server.service
● mssql-server.service - Microsoft SQL Server Database Engine
   Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2021-06-12 12:48:29 EDT; 1min 11s ago
     Docs: https://docs.microsoft.com/en-us/sql/linux
 Main PID: 1433420 (sqlservr)
    Tasks: 149
   Memory: 661.0M
   CGroup: /system.slice/mssql-server.service
           ├─1433420 /opt/mssql/bin/sqlservr
           └─1433443 /opt/mssql/bin/sqlservr

Jun 12 12:48:32 thermalite.localdomain sqlservr[1433420]: [145B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [158B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [155B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [61B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [96B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [66B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [96B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [100B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [71B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [124B blob data]
[root@thermalite ~]#

The licensing PID was successfully processed. The new edition is [Express Edition].
ForceFlush is enabled for this instance.
ForceFlush feature is enabled for log durability.
Created symlink /etc/systemd/system/multi-user.target.wants/mssql-server.service → /usr/lib/systemd/system/mssql-server.service.
Setup has completed successfully. SQL Server is now starting.

[root@thermalite ~]# systemctl status mssql-server.service
● mssql-server.service - Microsoft SQL Server Database Engine
   Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2021-06-12 12:48:29 EDT; 1min 11s ago
     Docs: https://docs.microsoft.com/en-us/sql/linux
 Main PID: 1433420 (sqlservr)
    Tasks: 149
   Memory: 661.0M
   CGroup: /system.slice/mssql-server.service
           ├─1433420 /opt/mssql/bin/sqlservr
           └─1433443 /opt/mssql/bin/sqlservr

Jun 12 12:48:32 thermalite.localdomain sqlservr[1433420]: [145B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [158B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [155B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [61B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [96B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [66B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [96B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [100B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [71B blob data]
Jun 12 12:48:33 thermalite.localdomain sqlservr[1433420]: [124B blob data]

[root@thermalite ~]# echo 'export PATH=$PATH:/opt/mssql/bin:/opt/mssql-tools/bin' | sudo tee /etc/profile.d/mssql.sh
export PATH=$PATH:/opt/mssql/bin:/opt/mssql-tools/bin

[root@thermalite ~]# source /etc/profile.d/mssql.sh

[root@thermalite ~]# sudo  firewall-cmd --add-port=1433/tcp --permanent
success

[root@thermalite ~]# sudo firewall-cmd --reload
success

# install sql oracle driver for ms sql server

http://www.snapdba.com/2013/10/using-sql-developer-to-connect-to-sql-server-databases/#.YMTipvlKiUl

http://sourceforge.net/projects/jtds/files

https://sourceforge.net/projects/jtds/files/jtds/1.3.1/jtds-1.3.1-dist.zip/download


# test connection on sql developer

# Oracle SQL Developer Connection Details
Username: SA
Password: my_msql_server_pass
Hostname: 192.168.1.80
Port: 1433

Install MySQL server on Centos 8

Install MySQL server on Centos 8

# install mysql-server

[root@thermalite ~]# rpm -qa | grep mysql
[root@thermalite ~]# dnf install mysql-server
Last metadata expiration check: 1:42:40 ago on Sat 12 Jun 2021 08:58:09 AM EDT.
Dependencies resolved.
=================================================================================================================================================================================================================
 Package                                                  Architecture                         Version                                                             Repository                               Size
=================================================================================================================================================================================================================
Installing:
 mysql-server                                             x86_64                               8.0.21-1.module_el8.2.0+493+63b41e36                                appstream                                22 M
Installing dependencies:
 mariadb-connector-c-config                               noarch                               3.1.11-2.el8_3                                                      appstream                                15 k
 mecab                                                    x86_64                               0.996-1.module_el8.2.0+493+63b41e36.9                               appstream                               393 k
 mysql                                                    x86_64                               8.0.21-1.module_el8.2.0+493+63b41e36                                appstream                                12 M
 mysql-common                                             x86_64                               8.0.21-1.module_el8.2.0+493+63b41e36                                appstream                               148 k
 mysql-errmsg                                             x86_64                               8.0.21-1.module_el8.2.0+493+63b41e36                                appstream                               581 k
 protobuf-lite                                            x86_64                               3.5.0-13.el8                                                        appstream                               149 k
Enabling module streams:
 mysql                                                                                         8.0

Transaction Summary
=================================================================================================================================================================================================================
Install  7 Packages

Total download size: 35 M
Installed size: 182 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): mariadb-connector-c-config-3.1.11-2.el8_3.noarch.rpm                                                                                                                      258 kB/s |  15 kB     00:00
(2/7): mysql-common-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64.rpm                                                                                                              3.4 MB/s | 148 kB     00:00
(3/7): mecab-0.996-1.module_el8.2.0+493+63b41e36.9.x86_64.rpm                                                                                                                    3.6 MB/s | 393 kB     00:00
(4/7): mysql-errmsg-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64.rpm                                                                                                              5.8 MB/s | 581 kB     00:00
(5/7): protobuf-lite-3.5.0-13.el8.x86_64.rpm                                                                                                                                     9.4 MB/s | 149 kB     00:00
(6/7): mysql-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64.rpm                                                                                                                      23 MB/s |  12 MB     00:00
(7/7): mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64.rpm                                                                                                               33 MB/s |  22 MB     00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                             36 MB/s |  35 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                         1/1
  Installing       : mariadb-connector-c-config-3.1.11-2.el8_3.noarch                                                                                                                                        1/7
  Installing       : mysql-common-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64                                                                                                                                2/7
  Installing       : mysql-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64                                                                                                                                       3/7
  Installing       : mysql-errmsg-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64                                                                                                                                4/7
  Installing       : protobuf-lite-3.5.0-13.el8.x86_64                                                                                                                                                       5/7
  Installing       : mecab-0.996-1.module_el8.2.0+493+63b41e36.9.x86_64                                                                                                                                      6/7
  Running scriptlet: mecab-0.996-1.module_el8.2.0+493+63b41e36.9.x86_64                                                                                                                                      6/7
  Running scriptlet: mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64                                                                                                                                7/7
  Installing       : mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64                                                                                                                                7/7
  Running scriptlet: mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64                                                                                                                                7/7
ValueError: File context for /var/log/mysql(/.*)? already defined

[/usr/lib/tmpfiles.d/pesign.conf:1] Line references path below legacy directory /var/run/, updating /var/run/pesign → /run/pesign; please update the tmpfiles.d/ drop-in file accordingly.
[/usr/lib/tmpfiles.d/postgresql.conf:1] Line references path below legacy directory /var/run/, updating /var/run/postgresql → /run/postgresql; please update the tmpfiles.d/ drop-in file accordingly.

  Verifying        : mariadb-connector-c-config-3.1.11-2.el8_3.noarch                                                                                                                                        1/7
  Verifying        : mecab-0.996-1.module_el8.2.0+493+63b41e36.9.x86_64                                                                                                                                      2/7
  Verifying        : mysql-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64                                                                                                                                       3/7
  Verifying        : mysql-common-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64                                                                                                                                4/7
  Verifying        : mysql-errmsg-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64                                                                                                                                5/7
  Verifying        : mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64                                                                                                                                6/7
  Verifying        : protobuf-lite-3.5.0-13.el8.x86_64                                                                                                                                                       7/7

Installed:
  mariadb-connector-c-config-3.1.11-2.el8_3.noarch                     mecab-0.996-1.module_el8.2.0+493+63b41e36.9.x86_64                   mysql-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64
  mysql-common-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64             mysql-errmsg-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64             mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64
  protobuf-lite-3.5.0-13.el8.x86_64

Complete!
[root@thermalite ~]#

# setup the mysql service

[root@thermalite ~]# systemctl start mysqld.service

[root@thermalite ~]# systemctl status mysqld.service
● mysqld.service - MySQL 8.0 database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2021-06-12 10:42:47 EDT; 5s ago
  Process: 1429927 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 1429800 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
  Process: 1429775 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
 Main PID: 1429883 (mysqld)
   Status: "Server is operational"
    Tasks: 39 (limit: 49085)
   Memory: 428.1M
   CGroup: /system.slice/mysqld.service
           └─1429883 /usr/libexec/mysqld --basedir=/usr

Jun 12 10:42:12 thermalite.localdomain systemd[1]: Starting MySQL 8.0 database server...
Jun 12 10:42:12 thermalite.localdomain mysql-prepare-db-dir[1429800]: Initializing MySQL database
Jun 12 10:42:47 thermalite.localdomain systemd[1]: Started MySQL 8.0 database server.
[root@thermalite ~]# systemctl restart mysqld.service
[root@thermalite ~]# systemctl status mysqld.service
● mysqld.service - MySQL 8.0 database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2021-06-12 10:43:06 EDT; 3s ago
  Process: 1429965 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)
  Process: 1430100 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 1430019 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
  Process: 1429992 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
 Main PID: 1430056 (mysqld)
   Status: "Server is operational"
    Tasks: 39 (limit: 49085)
   Memory: 335.1M
   CGroup: /system.slice/mysqld.service
           └─1430056 /usr/libexec/mysqld --basedir=/usr

Jun 12 10:43:05 thermalite.localdomain systemd[1]: Starting MySQL 8.0 database server...
Jun 12 10:43:06 thermalite.localdomain systemd[1]: Started MySQL 8.0 database server.

[root@thermalite ~]# systemctl enable mysqld
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.

[root@thermalite ~]#

# configure the firewall setting

[root@thermalite ~]# sudo firewall-cmd --add-service=mysql --permanent
success
[root@thermalite ~]# sudo firewall-cmd --reload
success

# Verify the changes with the ss utility:

[root@thermalite ~]# ss -nlt | grep 3306
LISTEN 0      128          0.0.0.0:3306       0.0.0.0:*
LISTEN 0      70                 *:33060            *:*
[root@thermalite ~]#


# setup the Oracle SQL Developer Connection

Name: thermalitedb
Username: dbuser
Password: my_mysql_password
Hostname: 10.10.1.80
Port: 3306

# secure the mysql installation

[root@thermalite ~]# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Please set the password for root here.

New password: my_very_hard_password

Re-enter new password: my_very_hard_password

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

[root@thermalite ~]# exit
logout

# check installation

[malex@thermalite ~]$ mysqladmin -u root -p version
Enter password:
mysqladmin  Ver 8.0.21 for Linux on x86_64 (Source distribution)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version          8.0.21
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/lib/mysql/mysql.sock
Uptime:                 5 min 7 sec

Threads: 2  Questions: 12  Slow queries: 0  Opens: 127  Flush tables: 3  Open tables: 48  Queries per second avg: 0.039

[malex@thermalite ~]$ 

# setup the user and the database access

[malex@thermalite ~]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.21 Source distribution

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE USER 'dbuser'@'%' IDENTIFIED BY 'my_mysql_password';
Query OK, 0 rows affected (0.04 sec)

mysql> create database thermalitedb;
Query OK, 1 row affected (0.05 sec)

mysql> grant all on thermalitedb.* to 'dbuser'@'%';
Query OK, 0 rows affected (0.03 sec)

mysql>

Monday, June 7, 2021

Install PostgreSQL Server on EC2 instance


Install PSQL client on EC2 instance
1. We need to first add the pgdg repository in Amazon Linux

$ amazon-linux-extras install postgresql10 vim epel

2. Now, install postgresql 10

$ yum install -y postgresql-server postgresql-devel

/usr/bin/postgresql-setup –-initdb

4. Start the postgres service

systemctl enable postgresql

systemctl start postgresql

5. To check if the postgres service is running or not

systemctl status postgresql

Now we are all good to connect to our database cluster using psql client tool

Fire the below command to connect to the rds cluster



[root@ip-172-31-81-123 ~]# amazon-linux-extras install postgresql10 vim epel
Installing vim-minimal, epel-release, postgresql, vim-enhanced
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Cleaning repos: AmazonCorretto amzn2-core amzn2extra-docker amzn2extra-epel amzn2extra-postgresql10 amzn2extra-vim epel epel-apache-maven
27 metadata files removed
12 sqlite files removed
0 metadata files removed
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
AmazonCorretto                                                                                                                                                                                                        | 2.9 kB  00:00:00
amzn2-core                                                                                                                                                                                                            | 3.7 kB  00:00:00
amzn2extra-docker                                                                                                                                                                                                     | 3.0 kB  00:00:00
amzn2extra-epel                                                                                                                                                                                                       | 3.0 kB  00:00:00
amzn2extra-postgresql10                                                                                                                                                                                               | 3.0 kB  00:00:00
amzn2extra-vim                                                                                                                                                                                                        | 3.0 kB  00:00:00
epel/x86_64/metalink                                                                                                                                                                                                  |  15 kB  00:00:00
epel                                                                                                                                                                                                                  | 4.7 kB  00:00:00
epel-apache-maven                                                                                                                                                                                                     | 3.3 kB  00:00:00
(1/16): AmazonCorretto/x86_64/primary_db                                                                                                                                                                              |  27 kB  00:00:00
(2/16): amzn2-core/2/x86_64/group_gz                                                                                                                                                                                  | 2.5 kB  00:00:00
(3/16): amzn2-core/2/x86_64/updateinfo                                                                                                                                                                                | 373 kB  00:00:00
(4/16): amzn2extra-epel/2/x86_64/primary_db                                                                                                                                                                           | 1.8 kB  00:00:00
(5/16): amzn2extra-postgresql10/2/x86_64/updateinfo                                                                                                                                                                   |   76 B  00:00:00
(6/16): amzn2extra-postgresql10/2/x86_64/primary_db                                                                                                                                                                   |  43 kB  00:00:00
(7/16): amzn2extra-vim/2/x86_64/updateinfo                                                                                                                                                                            |   76 B  00:00:00
(8/16): amzn2extra-vim/2/x86_64/primary_db                                                                                                                                                                            |  13 kB  00:00:00
(9/16): amzn2extra-docker/2/x86_64/updateinfo                                                                                                                                                                         |   76 B  00:00:00
(10/16): amzn2extra-epel/2/x86_64/updateinfo                                                                                                                                                                          |   76 B  00:00:00
(11/16): amzn2extra-docker/2/x86_64/primary_db                                                                                                                                                                        |  78 kB  00:00:00
(12/16): epel/x86_64/group_gz                                                                                                                                                                                         |  96 kB  00:00:00
(13/16): epel/x86_64/updateinfo                                                                                                                                                                                       | 1.0 MB  00:00:00
(14/16): epel-apache-maven/x86_64/primary_db                                                                                                                                                                          | 5.0 kB  00:00:00
(15/16): epel/x86_64/primary_db                                                                                                                                                                                       | 6.9 MB  00:00:00
(16/16): amzn2-core/2/x86_64/primary_db                                                                                                                                                                               |  53 MB  00:00:02
221 packages excluded due to repository priority protections
Package epel-release-7-11.noarch already installed and latest version
Package 2:vim-enhanced-8.1.1602-1.amzn2.x86_64 already installed and latest version
Package 2:vim-minimal-8.1.1602-1.amzn2.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package postgresql.x86_64 0:10.16-1.amzn2.0.2 will be installed
--> Processing Dependency: postgresql-libs(x86-64) = 10.16-1.amzn2.0.2 for package: postgresql-10.16-1.amzn2.0.2.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql-10.16-1.amzn2.0.2.x86_64
--> Running transaction check
---> Package postgresql-libs.x86_64 0:10.16-1.amzn2.0.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                  Arch                                            Version                                                     Repository                                                        Size
=============================================================================================================================================================================================================================================
Installing:
 postgresql                                               x86_64                                          10.16-1.amzn2.0.2                                           amzn2extra-postgresql10                                          1.5 M
Installing for dependencies:
 postgresql-libs                                          x86_64                                          10.16-1.amzn2.0.2                                           amzn2extra-postgresql10                                          293 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 1.7 M
Installed size: 6.1 M
Is this ok [y/d/N]: y
Is this ok [y/d/N]: y
Downloading packages:
(1/2): postgresql-libs-10.16-1.amzn2.0.2.x86_64.rpm                                                                                                                                                                   | 293 kB  00:00:00
(2/2): postgresql-10.16-1.amzn2.0.2.x86_64.rpm                                                                                                                                                                        | 1.5 MB  00:00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                        7.9 MB/s | 1.7 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : postgresql-libs-10.16-1.amzn2.0.2.x86_64                                                                                                                                                                                  1/2
  Installing : postgresql-10.16-1.amzn2.0.2.x86_64                                                                                                                                                                                       2/2
  Verifying  : postgresql-libs-10.16-1.amzn2.0.2.x86_64                                                                                                                                                                                  1/2
  Verifying  : postgresql-10.16-1.amzn2.0.2.x86_64                                                                                                                                                                                       2/2

Installed:
  postgresql.x86_64 0:10.16-1.amzn2.0.2

Dependency Installed:
  postgresql-libs.x86_64 0:10.16-1.amzn2.0.2

Complete!
  0  ansible2                 available    \
        [ =2.4.2  =2.4.6  =2.8  =stable ]
  2  httpd_modules            available    [ =1.0  =stable ]
  3  memcached1.5             available    \
        [ =1.5.1  =1.5.16  =1.5.17 ]
  5  postgresql9.6            available    \
        [ =9.6.6  =9.6.8  =stable ]
  6  postgresql10=latest      enabled      [ =10  =stable ]
  9  R3.4                     available    [ =3.4.3  =stable ]
 10  rust1                    available    \
        [ =1.22.1  =1.26.0  =1.26.1  =1.27.2  =1.31.0  =1.38.0
          =stable ]
 11  vim=latest               enabled      [ =8.0  =stable ]
 15  php7.2                   available    \
        [ =7.2.0  =7.2.4  =7.2.5  =7.2.8  =7.2.11  =7.2.13  =7.2.14
          =7.2.16  =7.2.17  =7.2.19  =7.2.21  =7.2.22  =7.2.23
          =7.2.24  =7.2.26  =stable ]
 17  lamp-mariadb10.2-php7.2  available    \
        [ =10.2.10_7.2.0  =10.2.10_7.2.4  =10.2.10_7.2.5
          =10.2.10_7.2.8  =10.2.10_7.2.11  =10.2.10_7.2.13
          =10.2.10_7.2.14  =10.2.10_7.2.16  =10.2.10_7.2.17
          =10.2.10_7.2.19  =10.2.10_7.2.22  =10.2.10_7.2.23
          =10.2.10_7.2.24  =stable ]
 18  libreoffice              available    \
        [ =5.0.6.2_15  =5.3.6.1  =stable ]
 19  gimp                     available    [ =2.8.22 ]
 20  docker=latest            enabled      \
        [ =17.12.1  =18.03.1  =18.06.1  =18.09.9  =stable ]
 21  mate-desktop1.x          available    \
        [ =1.19.0  =1.20.0  =stable ]
 22  GraphicsMagick1.3        available    \
        [ =1.3.29  =1.3.32  =1.3.34  =stable ]
 23  tomcat8.5                available    \
        [ =8.5.31  =8.5.32  =8.5.38  =8.5.40  =8.5.42  =8.5.50
          =stable ]
 24  epel=latest              enabled      [ =7.11  =stable ]
 25  testing                  available    [ =1.0  =stable ]
 26  ecs                      available    [ =stable ]
 27  corretto8                available    \
        [ =1.8.0_192  =1.8.0_202  =1.8.0_212  =1.8.0_222  =1.8.0_232
          =1.8.0_242  =stable ]
 28  firecracker              available    [ =0.11  =stable ]
 29  golang1.11               available    \
        [ =1.11.3  =1.11.11  =1.11.13  =stable ]
 30  squid4                   available    [ =4  =stable ]
 31  php7.3                   available    \
        [ =7.3.2  =7.3.3  =7.3.4  =7.3.6  =7.3.8  =7.3.9  =7.3.10
          =7.3.11  =7.3.13  =stable ]
 32  lustre2.10               available    \
        [ =2.10.5  =2.10.8  =stable ]
 33  java-openjdk11           available    [ =11  =stable ]
 34  lynis                    available    [ =stable ]
 35  kernel-ng                available    [ =stable ]
 36  BCC                      available    [ =0.x  =stable ]
 37  mono                     available    [ =5.x  =stable ]
 38  nginx1                   available    [ =stable ]
 39  ruby2.6                  available    [ =2.6  =stable ]
 40  mock                     available    [ =stable ]
 41  postgresql11             available    [ =11  =stable ]
 42  php7.4                   available    [ =stable ]
 43  livepatch                available    [ =stable ]
 44  python3.8                available    [ =stable ]
 45  haproxy2                 available    [ =stable ]
 46  collectd                 available    [ =stable ]
 47  aws-nitro-enclaves-cli   available    [ =stable ]
 48  R4                       available    [ =stable ]
 49  kernel-5.4               available    [ =stable ]
 50  selinux-ng               available    [ =stable ]
 51  php8.0                   available    [ =stable ]
 52  tomcat9                  available    [ =stable ]
 53  unbound1.13              available    [ =stable ]
 54  mariadb10.5              available    [ =stable ]
 55  kernel-5.10              available    [ =stable ]
 56  redis6                   available    [ =stable ]
[root@ip-172-31-81-123 ~]#

[root@ip-172-31-81-123 ~]# yum install -y postgresql-server postgresql-devel
yum install -y postgresql-server postgresql-devel
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
221 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package postgresql-devel.x86_64 0:10.16-1.amzn2.0.2 will be installed
---> Package postgresql-server.x86_64 0:10.16-1.amzn2.0.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                   Arch                                           Version                                                      Repository                                                       Size
=============================================================================================================================================================================================================================================
Installing:
 postgresql-devel                                          x86_64                                         10.16-1.amzn2.0.2                                            amzn2extra-postgresql10                                         1.3 M
 postgresql-server                                         x86_64                                         10.16-1.amzn2.0.2                                            amzn2extra-postgresql10                                         4.8 M

Transaction Summary
=============================================================================================================================================================================================================================================
Install  2 Packages

Total download size: 6.1 M
Installed size: 25 M
Downloading packages:
(1/2): postgresql-devel-10.16-1.amzn2.0.2.x86_64.rpm                                                                                                                                                                  | 1.3 MB  00:00:00
(2/2): postgresql-server-10.16-1.amzn2.0.2.x86_64.rpm                                                                                                                                                                 | 4.8 MB  00:00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                         16 MB/s | 6.1 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : postgresql-devel-10.16-1.amzn2.0.2.x86_64                                                                                                                                                                                 1/2
  Installing : postgresql-server-10.16-1.amzn2.0.2.x86_64                                                                                                                                                                                2/2
  Verifying  : postgresql-server-10.16-1.amzn2.0.2.x86_64                                                                                                                                                                                1/2
  Verifying  : postgresql-devel-10.16-1.amzn2.0.2.x86_64                                                                                                                                                                                 2/2

Installed:
  postgresql-devel.x86_64 0:10.16-1.amzn2.0.2                                                                          postgresql-server.x86_64 0:10.16-1.amzn2.0.2

Complete!
[root@ip-172-31-81-123 ~]#

[ec2-user@ip-172-31-81-123 myapp]$ sudo yum install postgresql-contrib
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
221 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package postgresql-contrib.x86_64 0:10.16-1.amzn2.0.2 will be installed
--> Processing Dependency: libossp-uuid.so.16()(64bit) for package: postgresql-contrib-10.16-1.amzn2.0.2.x86_64
--> Running transaction check
---> Package uuid.x86_64 0:1.6.2-26.amzn2.0.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                    Arch                                           Version                                                     Repository                                                       Size
=============================================================================================================================================================================================================================================
Installing:
 postgresql-contrib                                         x86_64                                         10.16-1.amzn2.0.2                                           amzn2extra-postgresql10                                         778 k
Installing for dependencies:
 uuid                                                       x86_64                                         1.6.2-26.amzn2.0.1                                          amzn2-core                                                       56 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 834 k
Installed size: 2.5 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): uuid-1.6.2-26.amzn2.0.1.x86_64.rpm                                                                                                                                                                             |  56 kB  00:00:00
(2/2): postgresql-contrib-10.16-1.amzn2.0.2.x86_64.rpm                                                                                                                                                                | 778 kB  00:00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                        3.4 MB/s | 834 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : uuid-1.6.2-26.amzn2.0.1.x86_64                                                                                                                                                                                            1/2
  Installing : postgresql-contrib-10.16-1.amzn2.0.2.x86_64                                                                                                                                                                               2/2
  Verifying  : postgresql-contrib-10.16-1.amzn2.0.2.x86_64                                                                                                                                                                               1/2
  Verifying  : uuid-1.6.2-26.amzn2.0.1.x86_64                                                                                                                                                                                            2/2

Installed:
  postgresql-contrib.x86_64 0:10.16-1.amzn2.0.2

Dependency Installed:
  uuid.x86_64 0:1.6.2-26.amzn2.0.1

Complete!
[ec2-user@ip-172-31-81-123 myapp]$

[root@ip-172-31-81-123 ~]# /usr/bin/postgresql-setup initdb
WARNING: using obsoleted argument syntax, try --help
WARNING: arguments transformed to: postgresql-setup --initdb --unit postgresql
 * Initializing database in '/var/lib/pgsql/data'
 * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log
[root@ip-172-31-81-123 ~]#

[ec2-user@ip-172-31-81-123 myapp]$ sudo su -
sudo su -
Last login: Tue Jun  8 00:48:18 UTC 2021 on pts/1
[root@ip-172-31-81-123 ~]# which postgresql-setup
/usr/bin/postgresql-setup
[root@ip-172-31-81-123 ~]# /usr/bin/postgresql-setup initdb
WARNING: using obsoleted argument syntax, try --help
WARNING: arguments transformed to: postgresql-setup --initdb --unit postgresql
 * Initializing database in '/var/lib/pgsql/data'
 * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log
[root@ip-172-31-81-123 ~]# systemctl enable --now postgresql
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql.service to /usr/lib/systemd/system/postgresql.service.
[root@ip-172-31-81-123 ~]# exit
logout
[ec2-user@ip-172-31-81-123 myapp]$ sudo -u postgres psql -c "SELECT version();"
could not change directory to "/home/ec2-user/myapp": Permission denied
                                                  version
------------------------------------------------------------------------------------------------------------
 PostgreSQL 10.16 on x86_64-koji-linux-gnu, compiled by gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-12), 64-bit
(1 row)

[ec2-user@ip-172-31-81-123 myapp]$
[root@ip-172-31-81-123 ~]# /usr/bin/postgresql-setup initdb
WARNING: using obsoleted argument syntax, try --help
WARNING: arguments transformed to: postgresql-setup --initdb --unit postgresql
 * Initializing database in '/var/lib/pgsql/data'
 * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log
[root@ip-172-31-81-123 ~]# systemctl enable --now postgresql
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql.service to /usr/lib/systemd/system/postgresql.service.
[root@ip-172-31-81-123 ~]# exit
logout
[ec2-user@ip-172-31-81-123 myapp]$ sudo -u postgres psql -c "SELECT version();"
could not change directory to "/home/ec2-user/myapp": Permission denied
                                                  version
------------------------------------------------------------------------------------------------------------
 PostgreSQL 10.16 on x86_64-koji-linux-gnu, compiled by gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-12), 64-bit
(1 row)

[ec2-user@ip-172-31-81-123 myapp]$ sudo systemctl start postgresql
[ec2-user@ip-172-31-81-123 myapp]$ sudo systemctl status postgresql
● postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2021-06-08 00:59:33 UTC; 2min 55s ago
  Process: 6635 ExecStartPre=/usr/libexec/postgresql-check-db-dir %N (code=exited, status=0/SUCCESS)
 Main PID: 6637 (postmaster)
   CGroup: /system.slice/postgresql.service
           ├─6637 /usr/bin/postmaster -D /var/lib/pgsql/data
           ├─6640 postgres: logger process
           ├─6642 postgres: checkpointer process
           ├─6643 postgres: writer process
           ├─6644 postgres: wal writer process
           ├─6645 postgres: autovacuum launcher process
           ├─6646 postgres: stats collector process
           └─6647 postgres: bgworker: logical replication launcher

Jun 08 00:59:33 ip-172-31-81-123.ec2.internal systemd[1]: Starting PostgreSQL database server...
Jun 08 00:59:33 ip-172-31-81-123.ec2.internal postmaster[6637]: 2021-06-08 00:59:33.319 UTC [6637] LOG:  listening on IPv4 address "127.0.0.1", port 5432
Jun 08 00:59:33 ip-172-31-81-123.ec2.internal postmaster[6637]: 2021-06-08 00:59:33.321 UTC [6637] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
Jun 08 00:59:33 ip-172-31-81-123.ec2.internal postmaster[6637]: 2021-06-08 00:59:33.324 UTC [6637] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
Jun 08 00:59:33 ip-172-31-81-123.ec2.internal postmaster[6637]: 2021-06-08 00:59:33.335 UTC [6637] LOG:  redirecting log output to logging collector process
Jun 08 00:59:33 ip-172-31-81-123.ec2.internal postmaster[6637]: 2021-06-08 00:59:33.335 UTC [6637] HINT:  Future log output will appear in directory "log".
Jun 08 00:59:33 ip-172-31-81-123.ec2.internal systemd[1]: Started PostgreSQL database server.
[ec2-user@ip-172-31-81-123 myapp]$




Configure to be accessible anywhere


[root@thermalite data]# cat postgresql.conf |  sed '/^$/d' | sed -e 's/^[[:space:]]*//' | grep -v "^#"
listen_addresses = '*'
port = 5432                             # (change requires restart)
max_connections = 100                   # (change requires restart)
shared_buffers = 128MB                  # min 128kB
dynamic_shared_memory_type = posix      # the default is the first option
logging_collector = on                  # Enable capturing of stderr and csvlog
log_filename = 'postgresql-%a.log'      # log file name pattern,
log_truncate_on_rotation = on           # If on, an existing log file with the
log_rotation_age = 1d                   # Automatic rotation of logfiles will
log_rotation_size = 0                   # Automatic rotation of logfiles will
log_timezone = 'America/New_York'
datestyle = 'iso, mdy'
timezone = 'America/New_York'
lc_messages = 'en_US.UTF-8'                     # locale for system error message
lc_monetary = 'en_US.UTF-8'                     # locale for monetary formatting
lc_numeric = 'en_US.UTF-8'                      # locale for number formatting
lc_time = 'en_US.UTF-8'                         # locale for time formatting
default_text_search_config = 'pg_catalog.english'
[root@thermalite data]#

[root@thermalite data]# cat pg_hba.conf  |  sed '/^$/d' | sed -e 's/^[[:space:]]*//' | grep -v "^#"
local   all             all                                     trust
host    all             all             127.0.0.1/32            trust
host    all             all             ::1/128                 ident
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            ident
host    replication     all             ::1/128                 ident
host all all 0.0.0.0/0 md5
host all all ::/0 md5
host all all 192.168.1.0/24 md5
host    all             all             192.168.1.0/16          ident map=thermalite
[root@thermalite data]#

[root@thermalite data]# vi pg_hba.conf

# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records.  In that case you will also need to make PostgreSQL
# listen on a non-local interface via the listen_addresses
# configuration parameter, or via the -i or -h command line switches.



# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
#local   all             all                                     peer
local   all             all                                     trust
# IPv4 local connections:
#host    all             all             127.0.0.1/32            ident
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            ident
host    replication     all             ::1/128                 ident

# Accept from anywhere
host all all 0.0.0.0/0 md5
host all all ::/0 md5

# Accept from trusted subnet
host all all 192.168.1.0/24 md5

# Allow users from 192.168.1.x hosts to connect to any database, if
# they pass the ident check.  If, for example, ident says the user is
# "malex" and he requests to connect as PostgreSQL user "dbuser", the
# connection is allowed if there is an entry in pg_ident.conf for map
# "thermalite" that says "malex" is allowed to connect as "dbuser".
#
# TYPE  DATABASE        USER            ADDRESS                 METHOD
host    all             all             192.168.1.0/16          ident map=thermalite




[root@thermalite data]# vi pg_ident.conf

# Put your actual configuration here
# ----------------------------------

# MAPNAME       SYSTEM-USERNAME         PG-USERNAME
thermalite         malex                  dbuser
thermalite         malex                  postgres




[root@thermalite data]# cat pg_ident.conf  |  sed '/^$/d' | sed -e 's/^[[:space:]]*//' | grep -v "^#"
thermalite         malex                  dbuser
thermalite         malex                  postgres
[root@thermalite data]#



How to clone a GitLab repository after enabling 2FA

Reference: https://dev.to/fpeluso/how-to-clone-a-gitlab-repository-after-enabling-2fa-6oc

[ec2-user@ip-172-31-81-123 myapp]$ git clone https://oauth2:WFodfsf3TKJCqdrgh676684WxRkV2KDXC@gitlab.com/username/hello-world.git
Cloning into 'hello-world'...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 24 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (24/24), done.
[ec2-user@ip-172-31-81-123 myapp]$ ls -l

Install git on EC2



[ec2-user@ip-172-31-81-123 myapp]$ sudo yum update -y
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                                                                                                                                                                                            | 3.7 kB  00:00:00
No packages marked for update
[ec2-user@ip-172-31-81-123 myapp]$ sudo yum install git  -y
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:2.23.4-1.amzn2.0.1 will be installed
--> Processing Dependency: perl-Git = 2.23.4-1.amzn2.0.1 for package: git-2.23.4-1.amzn2.0.1.x86_64
--> Processing Dependency: git-core-doc = 2.23.4-1.amzn2.0.1 for package: git-2.23.4-1.amzn2.0.1.x86_64
--> Processing Dependency: git-core = 2.23.4-1.amzn2.0.1 for package: git-2.23.4-1.amzn2.0.1.x86_64
--> Processing Dependency: emacs-filesystem >= 25.3 for package: git-2.23.4-1.amzn2.0.1.x86_64
--> Processing Dependency: perl(Term::ReadKey) for package: git-2.23.4-1.amzn2.0.1.x86_64
--> Processing Dependency: perl(Git::I18N) for package: git-2.23.4-1.amzn2.0.1.x86_64
--> Processing Dependency: perl(Git) for package: git-2.23.4-1.amzn2.0.1.x86_64
--> Processing Dependency: libsecret-1.so.0()(64bit) for package: git-2.23.4-1.amzn2.0.1.x86_64
--> Running transaction check
---> Package emacs-filesystem.noarch 1:25.3-3.amzn2.0.2 will be installed
---> Package git-core.x86_64 0:2.23.4-1.amzn2.0.1 will be installed
---> Package git-core-doc.noarch 0:2.23.4-1.amzn2.0.1 will be installed
---> Package libsecret.x86_64 0:0.18.5-2.amzn2.0.2 will be installed
---> Package perl-Git.noarch 0:2.23.4-1.amzn2.0.1 will be installed
--> Processing Dependency: perl(Error) for package: perl-Git-2.23.4-1.amzn2.0.1.noarch
---> Package perl-TermReadKey.x86_64 0:2.30-20.amzn2.0.2 will be installed
--> Running transaction check
---> Package perl-Error.noarch 1:0.17020-2.amzn2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                      Arch                                               Version                                                        Repository                                              Size
=============================================================================================================================================================================================================================================
Installing:
 git                                                          x86_64                                             2.23.4-1.amzn2.0.1                                             amzn2-core                                             135 k
Installing for dependencies:
 emacs-filesystem                                             noarch                                             1:25.3-3.amzn2.0.2                                             amzn2-core                                              64 k
 git-core                                                     x86_64                                             2.23.4-1.amzn2.0.1                                             amzn2-core                                             5.0 M
 git-core-doc                                                 noarch                                             2.23.4-1.amzn2.0.1                                             amzn2-core                                             2.4 M
 libsecret                                                    x86_64                                             0.18.5-2.amzn2.0.2                                             amzn2-core                                             153 k
 perl-Error                                                   noarch                                             1:0.17020-2.amzn2                                              amzn2-core                                              32 k
 perl-Git                                                     noarch                                             2.23.4-1.amzn2.0.1                                             amzn2-core                                              47 k
 perl-TermReadKey                                             x86_64                                             2.30-20.amzn2.0.2                                              amzn2-core                                              31 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install  1 Package (+7 Dependent packages)

Total download size: 7.9 M
Installed size: 41 M
Downloading packages:
(1/8): emacs-filesystem-25.3-3.amzn2.0.2.noarch.rpm                                                                                                                                                                   |  64 kB  00:00:00
(2/8): git-2.23.4-1.amzn2.0.1.x86_64.rpm                                                                                                                                                                              | 135 kB  00:00:00
(3/8): git-core-doc-2.23.4-1.amzn2.0.1.noarch.rpm                                                                                                                                                                     | 2.4 MB  00:00:00
(4/8): libsecret-0.18.5-2.amzn2.0.2.x86_64.rpm                                                                                                                                                                        | 153 kB  00:00:00
(5/8): git-core-2.23.4-1.amzn2.0.1.x86_64.rpm                                                                                                                                                                         | 5.0 MB  00:00:00
(6/8): perl-Error-0.17020-2.amzn2.noarch.rpm                                                                                                                                                                          |  32 kB  00:00:00
(7/8): perl-Git-2.23.4-1.amzn2.0.1.noarch.rpm                                                                                                                                                                         |  47 kB  00:00:00
(8/8): perl-TermReadKey-2.30-20.amzn2.0.2.x86_64.rpm                                                                                                                                                                  |  31 kB  00:00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                         29 MB/s | 7.9 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : git-core-2.23.4-1.amzn2.0.1.x86_64                                                                                                                                                                                        1/8
  Installing : git-core-doc-2.23.4-1.amzn2.0.1.noarch                                                                                                                                                                                    2/8
  Installing : 1:emacs-filesystem-25.3-3.amzn2.0.2.noarch                                                                                                                                                                                3/8
  Installing : 1:perl-Error-0.17020-2.amzn2.noarch                                                                                                                                                                                       4/8
  Installing : perl-TermReadKey-2.30-20.amzn2.0.2.x86_64                                                                                                                                                                                 5/8
  Installing : libsecret-0.18.5-2.amzn2.0.2.x86_64                                                                                                                                                                                       6/8
  Installing : perl-Git-2.23.4-1.amzn2.0.1.noarch                                                                                                                                                                                        7/8
  Installing : git-2.23.4-1.amzn2.0.1.x86_64                                                                                                                                                                                             8/8
  Verifying  : libsecret-0.18.5-2.amzn2.0.2.x86_64                                                                                                                                                                                       1/8
  Verifying  : perl-TermReadKey-2.30-20.amzn2.0.2.x86_64                                                                                                                                                                                 2/8
  Verifying  : git-2.23.4-1.amzn2.0.1.x86_64                                                                                                                                                                                             3/8
  Verifying  : git-core-doc-2.23.4-1.amzn2.0.1.noarch                                                                                                                                                                                    4/8
  Verifying  : perl-Git-2.23.4-1.amzn2.0.1.noarch                                                                                                                                                                                        5/8
  Verifying  : git-core-2.23.4-1.amzn2.0.1.x86_64                                                                                                                                                                                        6/8
  Verifying  : 1:perl-Error-0.17020-2.amzn2.noarch                                                                                                                                                                                       7/8
  Verifying  : 1:emacs-filesystem-25.3-3.amzn2.0.2.noarch                                                                                                                                                                                8/8

Installed:
  git.x86_64 0:2.23.4-1.amzn2.0.1

Dependency Installed:
  emacs-filesystem.noarch 1:25.3-3.amzn2.0.2  git-core.x86_64 0:2.23.4-1.amzn2.0.1 git-core-doc.noarch 0:2.23.4-1.amzn2.0.1 libsecret.x86_64 0:0.18.5-2.amzn2.0.2 perl-Error.noarch 1:0.17020-2.amzn2 perl-Git.noarch 0:2.23.4-1.amzn2.0.1
  perl-TermReadKey.x86_64 0:2.30-20.amzn2.0.2

Complete!
[ec2-user@ip-172-31-81-123 myapp]$

Create a test Springboot Application on EC2


[ec2-user@ip-172-31-81-123 myapp]$ clear
[ec2-user@ip-172-31-81-123 myapp]$ ls -l
total 0
drwxrwxr-x 3 ec2-user ec2-user 32 Jun  7 22:24 webpring-buxvue
[ec2-user@ip-172-31-81-123 myapp]$ ls -l  webpring-buxvue/
total 4
-rw-rw-r-- 1 ec2-user ec2-user 654 Jun  7 22:24 pom.xml
drwxrwxr-x 4 ec2-user ec2-user  30 Jun  7 22:24 src
[ec2-user@ip-172-31-81-123 myapp]$ bash
[ec2-user@ip-172-31-81-123 myapp]$ vi pom.xml
[ec2-user@ip-172-31-81-123 myapp]$ ls -l
total 0
drwxrwxr-x 3 ec2-user ec2-user 32 Jun  7 22:24 webpring-buxvue
[ec2-user@ip-172-31-81-123 myapp]$ cd webpring-buxvue/
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ ls -l
total 4
-rw-rw-r-- 1 ec2-user ec2-user 654 Jun  7 22:24 pom.xml
drwxrwxr-x 4 ec2-user ec2-user  30 Jun  7 22:24 src
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ vi pom.xml
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ ls -l src/
main/ test/
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ ls -l src/
main/ test/
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ ls -l src/main/java/com/example/App.java
-rw-rw-r-- 1 ec2-user ec2-user 174 Jun  7 22:24 src/main/java/com/example/App.java
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ vi src/main/java/com/example/App.java
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ cat src/main/java/com/example/App.java
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ cat src/main/java/com/example/App.java
package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class App {

        public static void main(String[] args) {
                SpringApplication.run(App.class, args);
        }

        @GetMapping("/")
        public String hello(@RequestParam(value = "name", defaultValue = "World") String name) {
                return String.format("Hello %s!", name);
        }
}
[ec2-user@ip-172-31-81-123 webpring-buxvue]$
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ mkdir -p src/main/java/resources
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ mkdir -p src/main/resources
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ rm -rf src/main/java/resources
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ vi src/main/resources/application.properties
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ cat src/main/resources/application.properties

[ec2-user@ip-172-31-81-123 webpring-buxvue]$ cat src/main/resources/application.properties
server.port=8080

[ec2-user@ip-172-31-81-123 webpring-buxvue]$

[ec2-user@ip-172-31-81-123 webpring-buxvue]$ pwd
/home/ec2-user/myapp/webpring-buxvue
[ec2-user@ip-172-31-81-123 webpring-buxvue]$

[ec2-user@ip-172-31-81-123 webpring-buxvue]$ mvn clean install -DskipTests -X dependency:tree -Dorgs.slf4j.simpleLogger.showDateTime=true -Dorgs.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS -Dverbose


[DEBUG]       org.springframework:spring-web:jar:5.3.7:compile (version managed from 5.3.7)
[DEBUG]          org.springframework:spring-beans:jar:5.3.7:compile (version managed from 5.3.7)
[DEBUG]       org.springframework:spring-webmvc:jar:5.3.7:compile (version managed from 5.3.7)
[DEBUG]          org.springframework:spring-aop:jar:5.3.7:compile (version managed from 5.3.7)
[DEBUG]          org.springframework:spring-context:jar:5.3.7:compile (version managed from 5.3.7)
[DEBUG]          org.springframework:spring-expression:jar:5.3.7:compile (version managed from 5.3.7)
[INFO] com.example:webpring-buxvue:jar:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] \- org.springframework.boot:spring-boot-starter-web:jar:2.5.0:compile
[INFO]    +- org.springframework.boot:spring-boot-starter:jar:2.5.0:compile
[INFO]    |  +- org.springframework.boot:spring-boot:jar:2.5.0:compile
[INFO]    |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.5.0:compile
[INFO]    |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.5.0:compile
[INFO]    |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO]    |  |  |  +- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO]    |  |  |  \- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO]    |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.14.1:compile
[INFO]    |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.14.1:compile
[INFO]    |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.30:compile
[INFO]    |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO]    |  +- org.springframework:spring-core:jar:5.3.7:compile
[INFO]    |  |  \- org.springframework:spring-jcl:jar:5.3.7:compile
[INFO]    |  \- org.yaml:snakeyaml:jar:1.28:compile
[INFO]    +- org.springframework.boot:spring-boot-starter-json:jar:2.5.0:compile
[INFO]    |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.12.3:compile
[INFO]    |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.12.3:compile
[INFO]    |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.12.3:compile
[INFO]    |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.12.3:compile
[INFO]    |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.12.3:compile
[INFO]    |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.12.3:compile
[INFO]    +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.5.0:compile
[INFO]    |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.46:compile
[INFO]    |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.46:compile
[INFO]    |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.46:compile
[INFO]    +- org.springframework:spring-web:jar:5.3.7:compile
[INFO]    |  \- org.springframework:spring-beans:jar:5.3.7:compile
[INFO]    \- org.springframework:spring-webmvc:jar:5.3.7:compile
[INFO]       +- org.springframework:spring-aop:jar:5.3.7:compile
[INFO]       +- org.springframework:spring-context:jar:5.3.7:compile
[INFO]       \- org.springframework:spring-expression:jar:5.3.7:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.846 s
[INFO] Finished at: 2021-06-07T22:40:23Z
[INFO] Final Memory: 39M/151M
[INFO] ------------------------------------------------------------------------
[ec2-user@ip-172-31-81-123 webpring-buxvue]$


[ec2-user@ip-172-31-81-123 webpring-buxvue]$ mvn spring-boot:run &
[1] 4522
[ec2-user@ip-172-31-81-123 webpring-buxvue]$ [INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building webpring-buxvue 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.5.0:run (default-cli) > test-compile @ webpring-buxvue >>>
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ webpring-buxvue ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ webpring-buxvue ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ webpring-buxvue ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /home/ec2-user/myapp/webpring-buxvue/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ webpring-buxvue ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< spring-boot-maven-plugin:2.5.0:run (default-cli) < test-compile @ webpring-buxvue <<<
[INFO]
[INFO]
[INFO] --- spring-boot-maven-plugin:2.5.0:run (default-cli) @ webpring-buxvue ---
[INFO] Attaching agents: []

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.5.0)

2021-06-07 22:42:12.425  INFO 4551 --- [           main] com.example.App                          : Starting App using Java 1.8.0_292 on ip-172-31-81-123.ec2.internal with PID 4551 (/home/ec2-user/myapp/webpring-buxvue/target/classes started by ec2-user in /home/ec2-user/myapp/webpring-buxvue)
2021-06-07 22:42:12.430  INFO 4551 --- [           main] com.example.App                          : No active profile set, falling back to default profiles: default
2021-06-07 22:42:13.523  INFO 4551 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2021-06-07 22:42:13.537  INFO 4551 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-06-07 22:42:13.538  INFO 4551 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.46]
2021-06-07 22:42:13.588  INFO 4551 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-06-07 22:42:13.589  INFO 4551 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1094 ms
2021-06-07 22:42:14.081  INFO 4551 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2021-06-07 22:42:14.092  INFO 4551 --- [           main] com.example.App                          : Started App in 2.244 seconds (JVM running for 2.863)
2021-06-07 22:42:14.094  INFO 4551 --- [           main] o.s.b.a.ApplicationAvailabilityBean      : Application availability state LivenessState changed to CORRECT
2021-06-07 22:42:14.095  INFO 4551 --- [           main] o.s.b.a.ApplicationAvailabilityBean      : Application availability state ReadinessState changed to ACCEPTING_TRAFFIC

[ec2-user@ip-172-31-81-123 webpring-buxvue]$ curl http://localhost:8080/
2021-06-07 22:42:42.430  INFO 4551 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-06-07 22:42:42.431  INFO 4551 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2021-06-07 22:42:42.432  INFO 4551 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
Hello World![ec2-user@ip-172-31-81-123 webpring-buxvue]$

  
Open a browser and point to URL: http://ec2-3-88-0-252.compute-1.amazonaws.com:8080/