網頁

2021/12/1

AWS EC2 Linux 2使用yum安裝Go

在AWS EC2執行個體Linux 2 AMI使用yum安裝Go。


SSH連線到EC2後輸入sudo yum --showduplicates list golang列出可安裝的golang所有package。

[ec2-user@ip-172-31-21-26 ~]$ yum --showduplicates list golang
Failed to set locale, defaulting to C
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Installed Packages
golang.x86_64                    1.15.14-1.amzn2.0.1                    @amzn2-core
Available Packages
golang.x86_64                    1.8.3-1.amzn2                          amzn2-core
golang.x86_64                    1.9.4-1.amzn2                          amzn2-core
golang.x86_64                    1.9.4-1.amzn2.0.2                      amzn2-core
golang.x86_64                    1.9.4-3.amzn2.0.1                      amzn2-core
golang.x86_64                    1.9.4-3.amzn2.0.2                      amzn2-core
golang.x86_64                    1.9.4-3.amzn2.0.3                      amzn2-core
golang.x86_64                    1.13.4-1.amzn2.0.1                     amzn2-core
golang.x86_64                    1.13.14-1.amzn2.0.1                    amzn2-core
golang.x86_64                    1.13.15-1.amzn2.0.1                    amzn2-core
golang.x86_64                    1.15.3-1.amzn2.0.1                     amzn2-core
golang.x86_64                    1.15.5-1.amzn2.0.2                     amzn2-core
golang.x86_64                    1.15.8-1.amzn2.0.1                     amzn2-core
golang.x86_64                    1.15.12-1.amzn2.0.1                    amzn2-core
golang.x86_64                    1.15.14-1.amzn2.0.1                    amzn2-core

可以看到EC2 yum可安裝golang的最新版本為1.15.14。


輸入sudo yum install golang -y會安裝最新版的Go。-y代表過程的yes/no選項都自動輸入y

[ec2-user@ip-172-31-21-26 ~]$ sudo yum install golang -y
Failed to set locale, defaulting to C
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                                  | 3.7 kB  00:00:00
Resolving Dependencies
-->  Running transaction check
--->  Package golang.x86_64 0:1.15.14-1.amzn2.0.1 will be installed
-->  Processing Dependency: golang-src = 1.15.14-1.amzn2.0.1 for package: golang-1.15.14-1.amzn2.0.1.x86_64
-->  Processing Dependency: golang-bin = 1.15.14-1.amzn2.0.1 for package: golang-1.15.14-1.amzn2.0.1.x86_64
-->  Running transaction check
--->  Package golang-bin.x86_64 0:1.15.14-1.amzn2.0.1 will be installed
-->  Processing Dependency: mercurial for package: golang-bin-1.15.14-1.amzn2.0.1.x86_64
-->  Processing Dependency: subversion for package: golang-bin-1.15.14-1.amzn2.0.1.x86_64
-->  Processing Dependency: gcc for package: golang-bin-1.15.14-1.amzn2.0.1.x86_64
--->  Package golang-src.noarch 0:1.15.14-1.amzn2.0.1 will be installed
-->  Running transaction check
--->  Package gcc.x86_64 0:7.3.1-13.amzn2 will be installed
-->  Processing Dependency: cpp = 7.3.1-13.amzn2 for package: gcc-7.3.1-13.amzn2.x86_64
-->  Processing Dependency: libsanitizer >= 7.3.1-13.amzn2 for package: gcc-7.3.1-13.amzn2.x86_64
-->  Processing Dependency: libquadmath >= 7.3.1-13.amzn2 for package: gcc-7.3.1-13.amzn2.x86_64
-->  Processing Dependency: libmpx >= 7.3.1-13.amzn2 for package: gcc-7.3.1-13.amzn2.x86_64
-->  Processing Dependency: libitm >= 7.3.1-13.amzn2 for package: gcc-7.3.1-13.amzn2.x86_64
-->  Processing Dependency: libcilkrts >= 7.3.1-13.amzn2 for package: gcc-7.3.1-13.amzn2.x86_64
-->  Processing Dependency: libatomic >= 7.3.1-13.amzn2 for package: gcc-7.3.1-13.amzn2.x86_64
-->  Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-7.3.1-13.amzn2.x86_64
-->  Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-7.3.1-13.amzn2.x86_64
-->  Processing Dependency: libmpc.so.3()(64bit) for package: gcc-7.3.1-13.amzn2.x86_64
--->  Package mercurial.x86_64 0:2.6.2-10.amzn2 will be installed
--->  Package subversion.x86_64 0:1.7.14-16.amzn2.0.1 will be installed
-->  Processing Dependency: subversion-libs(x86-64) = 1.7.14-16.amzn2.0.1 for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_wc-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_subr-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_repos-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_ra_svn-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_ra_neon-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_ra_local-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_ra-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_fs_util-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_fs_fs-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_fs_base-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_fs-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_diff-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_delta-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libsvn_client-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libneon.so.27()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libaprutil-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Processing Dependency: libapr-1.so.0()(64bit) for package: subversion-1.7.14-16.amzn2.0.1.x86_64
-->  Running transaction check
--->  Package apr.x86_64 0:1.7.0-9.amzn2 will be installed
--->  Package apr-util.x86_64 0:1.6.1-5.amzn2.0.2 will be installed
-->  Processing Dependency: apr-util-bdb(x86-64) = 1.6.1-5.amzn2.0.2 for package: apr-util-1.6.1-5.amzn2.0.2.x86_64
--->  Package cpp.x86_64 0:7.3.1-13.amzn2 will be installed
--->  Package glibc-devel.x86_64 0:2.26-56.amzn2 will be installed
-->  Processing Dependency: glibc-headers = 2.26-56.amzn2 for package: glibc-devel-2.26-56.amzn2.x86_64
-->  Processing Dependency: glibc = 2.26-56.amzn2 for package: glibc-devel-2.26-56.amzn2.x86_64
-->  Processing Dependency: glibc-headers for package: glibc-devel-2.26-56.amzn2.x86_64
--->  Package libatomic.x86_64 0:7.3.1-13.amzn2 will be installed
--->  Package libcilkrts.x86_64 0:7.3.1-13.amzn2 will be installed
--->  Package libitm.x86_64 0:7.3.1-13.amzn2 will be installed
--->  Package libmpc.x86_64 0:1.0.1-3.amzn2.0.2 will be installed
--->  Package libmpx.x86_64 0:7.3.1-13.amzn2 will be installed
--->  Package libquadmath.x86_64 0:7.3.1-13.amzn2 will be installed
--->  Package libsanitizer.x86_64 0:7.3.1-13.amzn2 will be installed
--->  Package mpfr.x86_64 0:3.1.1-4.amzn2.0.2 will be installed
--->  Package neon.x86_64 0:0.30.0-3.amzn2.0.2 will be installed
-->  Processing Dependency: libgnutls.so.28(GNUTLS_2_12)(64bit) for package: neon-0.30.0-3.amzn2.0.2.x86_64
-->  Processing Dependency: libgnutls.so.28(GNUTLS_1_4)(64bit) for package: neon-0.30.0-3.amzn2.0.2.x86_64
-->  Processing Dependency: libproxy.so.1()(64bit) for package: neon-0.30.0-3.amzn2.0.2.x86_64
-->  Processing Dependency: libpakchois.so.0()(64bit) for package: neon-0.30.0-3.amzn2.0.2.x86_64
-->  Processing Dependency: libgnutls.so.28()(64bit) for package: neon-0.30.0-3.amzn2.0.2.x86_64
--->  Package subversion-libs.x86_64 0:1.7.14-16.amzn2.0.1 will be installed
-->  Running transaction check
--->  Package apr-util-bdb.x86_64 0:1.6.1-5.amzn2.0.2 will be installed
--->  Package glibc.x86_64 0:2.26-54.amzn2 will be updated
-->  Processing Dependency: glibc = 2.26-54.amzn2 for package: glibc-common-2.26-54.amzn2.x86_64
-->  Processing Dependency: glibc = 2.26-54.amzn2 for package: glibc-minimal-langpack-2.26-54.amzn2.x86_64
-->  Processing Dependency: glibc = 2.26-54.amzn2 for package: glibc-all-langpacks-2.26-54.amzn2.x86_64
-->  Processing Dependency: glibc = 2.26-54.amzn2 for package: glibc-locale-source-2.26-54.amzn2.x86_64
-->  Processing Dependency: glibc(x86-64) = 2.26-54.amzn2 for package: libcrypt-2.26-54.amzn2.x86_64
--->  Package glibc.x86_64 0:2.26-56.amzn2 will be an update
--->  Package glibc-headers.x86_64 0:2.26-56.amzn2 will be installed
-->  Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.26-56.amzn2.x86_64
-->  Processing Dependency: kernel-headers for package: glibc-headers-2.26-56.amzn2.x86_64
--->  Package gnutls.x86_64 0:3.3.29-9.amzn2 will be installed
-->  Processing Dependency: trousers >= 0.3.11.2 for package: gnutls-3.3.29-9.amzn2.x86_64
--->  Package libproxy.x86_64 0:0.4.11-10.amzn2.0.3 will be installed
-->  Processing Dependency: libmodman.so.1()(64bit) for package: libproxy-0.4.11-10.amzn2.0.3.x86_64
--->  Package pakchois.x86_64 0:0.4-10.amzn2.0.2 will be installed
-->  Running transaction check
--->  Package glibc-all-langpacks.x86_64 0:2.26-54.amzn2 will be updated
--->  Package glibc-all-langpacks.x86_64 0:2.26-56.amzn2 will be an update
--->  Package glibc-common.x86_64 0:2.26-54.amzn2 will be updated
--->  Package glibc-common.x86_64 0:2.26-56.amzn2 will be an update
--->  Package glibc-locale-source.x86_64 0:2.26-54.amzn2 will be updated
--->  Package glibc-locale-source.x86_64 0:2.26-56.amzn2 will be an update
--->  Package glibc-minimal-langpack.x86_64 0:2.26-54.amzn2 will be updated
--->  Package glibc-minimal-langpack.x86_64 0:2.26-56.amzn2 will be an update
--->  Package kernel-headers.x86_64 0:4.14.252-195.483.amzn2 will be installed
--->  Package libcrypt.x86_64 0:2.26-54.amzn2 will be updated
--->  Package libcrypt.x86_64 0:2.26-56.amzn2 will be an update
--->  Package libmodman.x86_64 0:2.0.1-8.amzn2.0.2 will be installed
--->  Package trousers.x86_64 0:0.3.14-2.amzn2.0.2 will be installed
-->  Finished Dependency Resolution

Dependencies Resolved

===================================================================================
 Package                   Arch      Version                   Repository     Size
===================================================================================
Installing:
 golang                    x86_64    1.15.14-1.amzn2.0.1       amzn2-core    705 k
Installing for dependencies:
 apr                       x86_64    1.7.0-9.amzn2             amzn2-core    122 k
 apr-util                  x86_64    1.6.1-5.amzn2.0.2         amzn2-core     99 k
 apr-util-bdb              x86_64    1.6.1-5.amzn2.0.2         amzn2-core     19 k
 cpp                       x86_64    7.3.1-13.amzn2            amzn2-core    9.2 M
 gcc                       x86_64    7.3.1-13.amzn2            amzn2-core     22 M
 glibc-devel               x86_64    2.26-56.amzn2             amzn2-core    994 k
 glibc-headers             x86_64    2.26-56.amzn2             amzn2-core    514 k
 gnutls                    x86_64    3.3.29-9.amzn2            amzn2-core    673 k
 golang-bin                x86_64    1.15.14-1.amzn2.0.1       amzn2-core     89 M
 golang-src                noarch    1.15.14-1.amzn2.0.1       amzn2-core    7.9 M
 kernel-headers            x86_64    4.14.252-195.483.amzn2    amzn2-core    1.2 M
 libatomic                 x86_64    7.3.1-13.amzn2            amzn2-core     46 k
 libcilkrts                x86_64    7.3.1-13.amzn2            amzn2-core     85 k
 libitm                    x86_64    7.3.1-13.amzn2            amzn2-core     84 k
 libmodman                 x86_64    2.0.1-8.amzn2.0.2         amzn2-core     29 k
 libmpc                    x86_64    1.0.1-3.amzn2.0.2         amzn2-core     52 k
 libmpx                    x86_64    7.3.1-13.amzn2            amzn2-core     51 k
 libproxy                  x86_64    0.4.11-10.amzn2.0.3       amzn2-core     61 k
 libquadmath               x86_64    7.3.1-13.amzn2            amzn2-core    189 k
 libsanitizer              x86_64    7.3.1-13.amzn2            amzn2-core    641 k
 mercurial                 x86_64    2.6.2-10.amzn2            amzn2-core    2.6 M
 mpfr                      x86_64    3.1.1-4.amzn2.0.2         amzn2-core    208 k
 neon                      x86_64    0.30.0-3.amzn2.0.2        amzn2-core    166 k
 pakchois                  x86_64    0.4-10.amzn2.0.2          amzn2-core     14 k
 subversion                x86_64    1.7.14-16.amzn2.0.1       amzn2-core    1.0 M
 subversion-libs           x86_64    1.7.14-16.amzn2.0.1       amzn2-core    912 k
 trousers                  x86_64    0.3.14-2.amzn2.0.2        amzn2-core    294 k
Updating for dependencies:
 glibc                     x86_64    2.26-56.amzn2             amzn2-core    3.3 M
 glibc-all-langpacks       x86_64    2.26-56.amzn2             amzn2-core    7.0 M
 glibc-common              x86_64    2.26-56.amzn2             amzn2-core    772 k
 glibc-locale-source       x86_64    2.26-56.amzn2             amzn2-core    3.2 M
 glibc-minimal-langpack    x86_64    2.26-56.amzn2             amzn2-core     32 k
 libcrypt                  x86_64    2.26-56.amzn2             amzn2-core     52 k

Transaction Summary
===================================================================================
Install  1 Package  (+27 Dependent packages)
Upgrade             (  6 Dependent packages)

Total download size: 153 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/34): apr-util-1.6.1-5.amzn2.0.2.x86_64.rpm               |  99 kB  00:00:00
(2/34): apr-1.7.0-9.amzn2.x86_64.rpm                        | 122 kB  00:00:00
(3/34): apr-util-bdb-1.6.1-5.amzn2.0.2.x86_64.rpm           |  19 kB  00:00:00
(4/34): cpp-7.3.1-13.amzn2.x86_64.rpm                       | 9.2 MB  00:00:00
(5/34): glibc-2.26-56.amzn2.x86_64.rpm                      | 3.3 MB  00:00:00
(6/34): glibc-all-langpacks-2.26-56.amzn2.x86_64.rpm        | 7.0 MB  00:00:00
(7/34): gcc-7.3.1-13.amzn2.x86_64.rpm                       |  22 MB  00:00:01
(8/34): glibc-common-2.26-56.amzn2.x86_64.rpm               | 772 kB  00:00:00
(9/34): glibc-headers-2.26-56.amzn2.x86_64.rpm              | 514 kB  00:00:00
(10/34): glibc-devel-2.26-56.amzn2.x86_64.rpm               | 994 kB  00:00:00
(11/34): glibc-minimal-langpack-2.26-56.amzn2.x86_64.rpm    |  32 kB  00:00:00
(12/34): gnutls-3.3.29-9.amzn2.x86_64.rpm                   | 673 kB  00:00:00
(13/34): glibc-locale-source-2.26-56.amzn2.x86_64.rpm       | 3.2 MB  00:00:00
(14/34): golang-1.15.14-1.amzn2.0.1.x86_64.rpm              | 705 kB  00:00:00
(15/34): golang-src-1.15.14-1.amzn2.0.1.noarch.rpm          | 7.9 MB  00:00:00
(16/34): kernel-headers-4.14.252-195.483.amzn2.x86_64.rpm   | 1.2 MB  00:00:00
(17/34): libatomic-7.3.1-13.amzn2.x86_64.rpm                |  46 kB  00:00:00
(18/34): libcilkrts-7.3.1-13.amzn2.x86_64.rpm               |  85 kB  00:00:00
(19/34): libcrypt-2.26-56.amzn2.x86_64.rpm                  |  52 kB  00:00:00
(20/34): libitm-7.3.1-13.amzn2.x86_64.rpm                   |  84 kB  00:00:00
(21/34): libmodman-2.0.1-8.amzn2.0.2.x86_64.rpm             |  29 kB  00:00:00
(22/34): libmpc-1.0.1-3.amzn2.0.2.x86_64.rpm                |  52 kB  00:00:00
(23/34): libmpx-7.3.1-13.amzn2.x86_64.rpm                   |  51 kB  00:00:00
(24/34): libproxy-0.4.11-10.amzn2.0.3.x86_64.rpm            |  61 kB  00:00:00
(25/34): libquadmath-7.3.1-13.amzn2.x86_64.rpm              | 189 kB  00:00:00
(26/34): libsanitizer-7.3.1-13.amzn2.x86_64.rpm             | 641 kB  00:00:00
(27/34): mercurial-2.6.2-10.amzn2.x86_64.rpm                | 2.6 MB  00:00:00
(28/34): mpfr-3.1.1-4.amzn2.0.2.x86_64.rpm                  | 208 kB  00:00:00
(29/34): neon-0.30.0-3.amzn2.0.2.x86_64.rpm                 | 166 kB  00:00:00
(30/34): pakchois-0.4-10.amzn2.0.2.x86_64.rpm               |  14 kB  00:00:00
(31/34): subversion-1.7.14-16.amzn2.0.1.x86_64.rpm          | 1.0 MB  00:00:00
(32/34): subversion-libs-1.7.14-16.amzn2.0.1.x86_64.rpm     | 912 kB  00:00:00
(33/34): trousers-0.3.14-2.amzn2.0.2.x86_64.rpm             | 294 kB  00:00:00
(34/34): golang-bin-1.15.14-1.amzn2.0.1.x86_64.rpm          |  89 MB  00:00:03
-----------------------------------------------------------------------------------
Total                                                  33 MB/s | 153 MB  00:04
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : glibc-minimal-langpack-2.26-56.amzn2.x86_64                    1/40
  Updating   : glibc-common-2.26-56.amzn2.x86_64                              2/40
  Updating   : glibc-2.26-56.amzn2.x86_64                                     3/40
  Updating   : libcrypt-2.26-56.amzn2.x86_64                                  4/40
  Installing : apr-1.7.0-9.amzn2.x86_64                                       5/40
  Installing : apr-util-bdb-1.6.1-5.amzn2.0.2.x86_64                          6/40
  Installing : apr-util-1.6.1-5.amzn2.0.2.x86_64                              7/40
  Installing : mpfr-3.1.1-4.amzn2.0.2.x86_64                                  8/40
  Installing : libmpc-1.0.1-3.amzn2.0.2.x86_64                                9/40
  Installing : cpp-7.3.1-13.amzn2.x86_64                                     10/40
  Installing : libsanitizer-7.3.1-13.amzn2.x86_64                            11/40
  Installing : pakchois-0.4-10.amzn2.0.2.x86_64                              12/40
  Installing : libquadmath-7.3.1-13.amzn2.x86_64                             13/40
  Installing : libmodman-2.0.1-8.amzn2.0.2.x86_64                            14/40
  Installing : libproxy-0.4.11-10.amzn2.0.3.x86_64                           15/40
  Installing : libitm-7.3.1-13.amzn2.x86_64                                  16/40
  Installing : libcilkrts-7.3.1-13.amzn2.x86_64                              17/40
  Installing : mercurial-2.6.2-10.amzn2.x86_64                               18/40
  Installing : libatomic-7.3.1-13.amzn2.x86_64                               19/40
  Installing : trousers-0.3.14-2.amzn2.0.2.x86_64                            20/40
  Installing : gnutls-3.3.29-9.amzn2.x86_64                                  21/40
  Installing : neon-0.30.0-3.amzn2.0.2.x86_64                                22/40
  Installing : subversion-libs-1.7.14-16.amzn2.0.1.x86_64                    23/40
  Installing : subversion-1.7.14-16.amzn2.0.1.x86_64                         24/40
  Installing : libmpx-7.3.1-13.amzn2.x86_64                                  25/40
  Installing : kernel-headers-4.14.252-195.483.amzn2.x86_64                  26/40
  Installing : glibc-headers-2.26-56.amzn2.x86_64                            27/40
  Installing : glibc-devel-2.26-56.amzn2.x86_64                              28/40
  Installing : gcc-7.3.1-13.amzn2.x86_64                                     29/40
  Installing : golang-src-1.15.14-1.amzn2.0.1.noarch                         30/40
  Installing : golang-1.15.14-1.amzn2.0.1.x86_64                             31/40
  Installing : golang-bin-1.15.14-1.amzn2.0.1.x86_64                         32/40
  Updating   : glibc-locale-source-2.26-56.amzn2.x86_64                      33/40
  Updating   : glibc-all-langpacks-2.26-56.amzn2.x86_64                      34/40
  Cleanup    : glibc-all-langpacks-2.26-54.amzn2.x86_64                      35/40
  Cleanup    : glibc-locale-source-2.26-54.amzn2.x86_64                      36/40
  Cleanup    : libcrypt-2.26-54.amzn2.x86_64                                 37/40
  Cleanup    : glibc-common-2.26-54.amzn2.x86_64                             38/40
  Cleanup    : glibc-minimal-langpack-2.26-54.amzn2.x86_64                   39/40
  Cleanup    : glibc-2.26-54.amzn2.x86_64                                    40/40
  Verifying  : libsanitizer-7.3.1-13.amzn2.x86_64                             1/40
  Verifying  : libmpc-1.0.1-3.amzn2.0.2.x86_64                                2/40
  Verifying  : golang-1.15.14-1.amzn2.0.1.x86_64                              3/40
  Verifying  : glibc-devel-2.26-56.amzn2.x86_64                               4/40
  Verifying  : pakchois-0.4-10.amzn2.0.2.x86_64                               5/40
  Verifying  : libproxy-0.4.11-10.amzn2.0.3.x86_64                            6/40
  Verifying  : libcrypt-2.26-56.amzn2.x86_64                                  7/40
  Verifying  : subversion-libs-1.7.14-16.amzn2.0.1.x86_64                     8/40
  Verifying  : libquadmath-7.3.1-13.amzn2.x86_64                              9/40
  Verifying  : libmodman-2.0.1-8.amzn2.0.2.x86_64                            10/40
  Verifying  : cpp-7.3.1-13.amzn2.x86_64                                     11/40
  Verifying  : gnutls-3.3.29-9.amzn2.x86_64                                  12/40
  Verifying  : golang-bin-1.15.14-1.amzn2.0.1.x86_64                         13/40
  Verifying  : libitm-7.3.1-13.amzn2.x86_64                                  14/40
  Verifying  : mpfr-3.1.1-4.amzn2.0.2.x86_64                                 15/40
  Verifying  : apr-util-1.6.1-5.amzn2.0.2.x86_64                             16/40
  Verifying  : apr-util-bdb-1.6.1-5.amzn2.0.2.x86_64                         17/40
  Verifying  : glibc-headers-2.26-56.amzn2.x86_64                            18/40
  Verifying  : libcilkrts-7.3.1-13.amzn2.x86_64                              19/40
  Verifying  : golang-src-1.15.14-1.amzn2.0.1.noarch                         20/40
  Verifying  : glibc-locale-source-2.26-56.amzn2.x86_64                      21/40
  Verifying  : glibc-2.26-56.amzn2.x86_64                                    22/40
  Verifying  : mercurial-2.6.2-10.amzn2.x86_64                               23/40
  Verifying  : kernel-headers-4.14.252-195.483.amzn2.x86_64                  24/40
  Verifying  : subversion-1.7.14-16.amzn2.0.1.x86_64                         25/40
  Verifying  : apr-1.7.0-9.amzn2.x86_64                                      26/40
  Verifying  : libatomic-7.3.1-13.amzn2.x86_64                               27/40
  Verifying  : trousers-0.3.14-2.amzn2.0.2.x86_64                            28/40
  Verifying  : gcc-7.3.1-13.amzn2.x86_64                                     29/40
  Verifying  : neon-0.30.0-3.amzn2.0.2.x86_64                                30/40
  Verifying  : glibc-all-langpacks-2.26-56.amzn2.x86_64                      31/40
  Verifying  : libmpx-7.3.1-13.amzn2.x86_64                                  32/40
  Verifying  : glibc-minimal-langpack-2.26-56.amzn2.x86_64                   33/40
  Verifying  : glibc-common-2.26-56.amzn2.x86_64                             34/40
  Verifying  : glibc-all-langpacks-2.26-54.amzn2.x86_64                      35/40
  Verifying  : glibc-locale-source-2.26-54.amzn2.x86_64                      36/40
  Verifying  : glibc-minimal-langpack-2.26-54.amzn2.x86_64                   37/40
  Verifying  : libcrypt-2.26-54.amzn2.x86_64                                 38/40
  Verifying  : glibc-common-2.26-54.amzn2.x86_64                             39/40
  Verifying  : glibc-2.26-54.amzn2.x86_64                                    40/40

Installed:
  golang.x86_64 0:1.15.14-1.amzn2.0.1

Dependency Installed:
  apr.x86_64 0:1.7.0-9.amzn2
  apr-util.x86_64 0:1.6.1-5.amzn2.0.2
  apr-util-bdb.x86_64 0:1.6.1-5.amzn2.0.2
  cpp.x86_64 0:7.3.1-13.amzn2
  gcc.x86_64 0:7.3.1-13.amzn2
  glibc-devel.x86_64 0:2.26-56.amzn2
  glibc-headers.x86_64 0:2.26-56.amzn2
  gnutls.x86_64 0:3.3.29-9.amzn2
  golang-bin.x86_64 0:1.15.14-1.amzn2.0.1
  golang-src.noarch 0:1.15.14-1.amzn2.0.1
  kernel-headers.x86_64 0:4.14.252-195.483.amzn2
  libatomic.x86_64 0:7.3.1-13.amzn2
  libcilkrts.x86_64 0:7.3.1-13.amzn2
  libitm.x86_64 0:7.3.1-13.amzn2
  libmodman.x86_64 0:2.0.1-8.amzn2.0.2
  libmpc.x86_64 0:1.0.1-3.amzn2.0.2
  libmpx.x86_64 0:7.3.1-13.amzn2
  libproxy.x86_64 0:0.4.11-10.amzn2.0.3
  libquadmath.x86_64 0:7.3.1-13.amzn2
  libsanitizer.x86_64 0:7.3.1-13.amzn2
  mercurial.x86_64 0:2.6.2-10.amzn2
  mpfr.x86_64 0:3.1.1-4.amzn2.0.2
  neon.x86_64 0:0.30.0-3.amzn2.0.2
  pakchois.x86_64 0:0.4-10.amzn2.0.2
  subversion.x86_64 0:1.7.14-16.amzn2.0.1
  subversion-libs.x86_64 0:1.7.14-16.amzn2.0.1
  trousers.x86_64 0:0.3.14-2.amzn2.0.2

Dependency Updated:
  glibc.x86_64 0:2.26-56.amzn2
  glibc-all-langpacks.x86_64 0:2.26-56.amzn2
  glibc-common.x86_64 0:2.26-56.amzn2
  glibc-locale-source.x86_64 0:2.26-56.amzn2
  glibc-minimal-langpack.x86_64 0:2.26-56.amzn2
  libcrypt.x86_64 0:2.26-56.amzn2

Complete!

輸入go version檢視版本確認是安裝成功。

[ec2-user@ip-172-31-21-26 ~]$ go version
go version go1.15.14 linux/amd64

輸入yum golang info檢視安裝資訊。

[ec2-user@ip-172-31-21-26 ~]$ sudo yum info golang
Failed to set locale, defaulting to C
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Installed Packages
Name        : golang
Arch        : x86_64
Version     : 1.15.14
Release     : 1.amzn2.0.1
Size        : 7.8 M
Repo        : installed
From repo   : amzn2-core
Summary     : The Go Programming Language
URL         : http://golang.org/
License     : BSD and Public Domain
Description : The Go Programming Language.


反安裝則輸入sudo yum remove golang -y

[ec2-user@ip-172-31-21-26 ~]$ sudo yum remove golang -y
Failed to set locale, defaulting to C
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package golang.x86_64 0:1.15.14-1.amzn2.0.1 will be erased
--> Processing Dependency: go = 1.15.14-1.amzn2.0.1 for package: golang-bin-1.15.14-1.amzn2.0.1.x86_64
--> Running transaction check
---> Package golang-bin.x86_64 0:1.15.14-1.amzn2.0.1 will be erased
--> Finished Dependency Resolution
amzn2-core/2/x86_64                                         | 3.7 kB  00:00:00
amzn2extra-docker/2/x86_64                                  | 3.0 kB  00:00:00

Dependencies Resolved

===================================================================================
 Package          Arch         Version                     Repository         Size
===================================================================================
Removing:
 golang           x86_64       1.15.14-1.amzn2.0.1         @amzn2-core       7.8 M
Removing for dependencies:
 golang-bin       x86_64       1.15.14-1.amzn2.0.1         @amzn2-core       286 M

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

Installed size: 294 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : golang-1.15.14-1.amzn2.0.1.x86_64                               1/2
  Erasing    : golang-bin-1.15.14-1.amzn2.0.1.x86_64                           2/2
warning: file /usr/bin/gofmt: remove failed: No such file or directory
warning: file /usr/bin/go: remove failed: No such file or directory
  Verifying  : golang-bin-1.15.14-1.amzn2.0.1.x86_64                           1/2
  Verifying  : golang-1.15.14-1.amzn2.0.1.x86_64                               2/2

Removed:
  golang.x86_64 0:1.15.14-1.amzn2.0.1

Dependency Removed:
  golang-bin.x86_64 0:1.15.14-1.amzn2.0.1

Complete!
[ec2-user@ip-172-31-21-26 ~]$
[ec2-user@ip-172-31-21-26 ~]$ go version
-bash: /usr/bin/go: No such file or directory

安裝特定版本則輸入sudu yum install golang-<version>

例如安裝1.15.14-1.amzn2.0.1則輸入sudo yum install golang-1.15.14-1.amzn2.0.1 -y


沒有留言:

張貼留言