set setting reset

脂肪と糖にはたらくやつ

CentOS7 に pip と awscli をインストール

vagrant 上の CentOS7 です。

# cat /etc/centos-release
CentOS Linux release 7.1.1503 (Core)

普通に yum だとインストールできませんでした。 結論を先に記載すると 4 コマンド実行で pip と awscli のインストールができました。

# yum install epel-release
# yum install python-pip
# pip install pip --upgrade
$ pip install awscli --user

以下は経緯というかログです。

# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
#
# yum install python-pip
Loaded plugins: fastestmirror

- 略 -

No package python-pip available.
Error: Nothing to do

デフォルトのレポジトリからは yum できなかったので epel からインストールしてみます。
まずは epel レポジトリを追加します。

# yum install epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.tsukuba.wide.ad.jp
 * extras: ftp.tsukuba.wide.ad.jp
 * updates: ftp.tsukuba.wide.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================================================================================================================================================================
 Package                                                                           Arch                                                                        Version                                                                   Repository                                                                   Size
===========================================================================================================================================================================================================================================================================================================================
Installing:
 epel-release                                                                      noarch                                                                      7-5                                                                       extras                                                                       14 k

Transaction Summary
===========================================================================================================================================================================================================================================================================================================================
Install  1 Package

Total download size: 14 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-5.noarch.rpm                                                                                                                                                                                                                                                                         |  14 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-5.noarch                                                                                                                                                                                                                                                                                 1/1
  Verifying  : epel-release-7-5.noarch                                                                                                                                                                                                                                                                                 1/1

Installed:
  epel-release.noarch 0:7-5

Complete!

続いて pip をインストールします。

# yum install python-pip --enablerepo=epel
Loaded plugins: fastestmirror
epel/x86_64/metalink                                                                                                                                                                                                                                                                                | 5.2 kB  00:00:00
epel                                                                                                                                                                                                                                                                                                | 4.3 kB  00:00:00
(1/3): epel/x86_64/updateinfo                                                                                                                                                                                                                                                                       | 374 kB  00:00:00
(2/3): epel/x86_64/group_gz                                                                                                                                                                                                                                                                         | 169 kB  00:00:00
(3/3): epel/x86_64/primary_db                                                                                                                                                                                                                                                                       | 3.6 MB  00:00:00
Loading mirror speeds from cached hostfile
 * base: ftp.tsukuba.wide.ad.jp
 * epel: ftp.riken.jp
 * extras: ftp.tsukuba.wide.ad.jp
 * updates: ftp.tsukuba.wide.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package python-pip.noarch 0:7.1.0-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================================================================================================================================================================
 Package                                                                        Arch                                                                       Version                                                                          Repository                                                                Size
===========================================================================================================================================================================================================================================================================================================================
Installing:
 python-pip                                                                     noarch                                                                     7.1.0-1.el7                                                                      epel                                                                     1.5 M

Transaction Summary
===========================================================================================================================================================================================================================================================================================================================
Install  1 Package

Total download size: 1.5 M
Installed size: 6.6 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/epel/packages/python-pip-7.1.0-1.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY       12% [================-                                                                                                                    ]  0.0 B/s | 196 kB  --:--:-- ETA
Public key for python-pip-7.1.0-1.el7.noarch.rpm is not installed
python-pip-7.1.0-1.el7.noarch.rpm                                                                                                                                                                                                                                                                   | 1.5 MB  00:00:01
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-5.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-pip-7.1.0-1.el7.noarch                                                                                                                                                                                                                                                                           1/1
  Verifying  : python-pip-7.1.0-1.el7.noarch                                                                                                                                                                                                                                                                           1/1

Installed:
  python-pip.noarch 0:7.1.0-1.el7

Complete!

できた、けど古いようです。執筆時点での pip のバージョンは 7.1.2 です。
upgrade してみます。

# pip install pip --upgrade
/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Collecting pip
  Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB)
    100% |████████████████████████████████| 1.1MB 452kB/s
Installing collected packages: pip
  Found existing installation: pip 7.1.0
    Uninstalling pip-7.1.0:
      Successfully uninstalled pip-7.1.0
Successfully installed pip-7.1.2

upgrade できました。

# pip --version
pip 7.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

ついでに awscli をインストールします。
ここでは一般ユーザー向けにインストールしてみます。

$ pip install awscli --user
Collecting awscli
/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading awscli-1.9.1-py2.py3-none-any.whl (797kB)
    100% |████████████████████████████████| 798kB 549kB/s
Collecting rsa<=3.3.0,>=3.1.2 (from awscli)
  Downloading rsa-3.2-py2.py3-none-any.whl (43kB)
    100% |████████████████████████████████| 45kB 7.0MB/s
Collecting colorama<=0.3.3,>=0.2.5 (from awscli)
  Downloading colorama-0.3.3.tar.gz
Collecting botocore==1.3.1 (from awscli)
  Downloading botocore-1.3.1-py2.py3-none-any.whl (2.1MB)
    100% |████████████████████████████████| 2.1MB 207kB/s
Collecting docutils>=0.10 (from awscli)
  Downloading docutils-0.12.tar.gz (1.6MB)
    100% |████████████████████████████████| 1.6MB 289kB/s
Collecting pyasn1>=0.1.3 (from rsa<=3.3.0,>=3.1.2->awscli)
  Downloading pyasn1-0.1.9-py2.py3-none-any.whl
Collecting jmespath<1.0.0,>=0.7.1 (from botocore==1.3.1->awscli)
  Downloading jmespath-0.9.0-py2.py3-none-any.whl
Collecting python-dateutil<3.0.0,>=2.1 (from botocore==1.3.1->awscli)
  Downloading python_dateutil-2.4.2-py2.py3-none-any.whl (188kB)
    100% |████████████████████████████████| 192kB 2.0MB/s
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore==1.3.1->awscli)
  Downloading six-1.10.0-py2.py3-none-any.whl
Installing collected packages: pyasn1, rsa, colorama, jmespath, six, python-dateutil, docutils, botocore, awscli
  Running setup.py install for colorama
  Running setup.py install for docutils
Successfully installed awscli botocore colorama docutils jmespath pyasn1 python-dateutil rsa six
/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

できました。

$ aws --version
aws-cli/1.9.1 Python/2.7.5 Linux/3.10.0-229.14.1.el7.x86_64 botocore/1.3.1