awsをCLIで扱うのに必要なawscli。最近、S3にファイルを置くようになって、それをとれるように手元のLinux(CentOS6.8)で扱いたいなと思い出したので、CentOSにawscliのインストールをしてみる。
環境
VirtualBox内にあるCentOSで実施します。
環境は以下。
[yatta47@localhost ~]$ cat /etc/redhat-release CentOS release 6.8 (Final) [yatta47@localhost ~]$ python --version Python 2.6.6 [yatta47@localhost ~]$
自分の場合は最初から入っていたので何もしていないのですが、pythonが必要になるので、無い場合は入れておいたほうがいいかと。
awscliをインストール
手順といっても、以下のサイトをそのままやるだけで特に問題なくできました。
CentOS に AWS CLI を「pip install awscli」でインストールする手順 | Check!Site
ざっくりいうと
- python-pipをインストール
- pipでawscliをインストール
この2つです。
最終的に入力したコマンドのみ。
$ sudo yum search python-pip $ sudo yum install python-pip $ pip install awscli $ aws --version
その中で若干ハマッタ(はまりそう)ポイントは以下。
EPELレポジトリを追加
自分の環境には最初から入っていたので実は特に何もやっていないんだけれど、これを追加しないとインストールできないから事前に追加しておきましょう。
rootで実施する必要あり
インストールするのにroot権限が必要でした。rootユーザでやったらいいんだろうけど、sudoで実施しました。
終わりに
以上でインストールは完了。簡単や。
S3のファイルを扱うために手元のCentOSにawscliをインストールしました。あとはアクセスキーとかシークレットキーの設定をすればS3が扱えるようになります。
それはまた今度にでも。
素朴な疑問として、今回はpytho-pipでインストールしたけれど、調べてみるとpython-setuptoolsからpipをインストールする手順も見つかった。
Pythonはよくわからないから気になるけどそのうち時間がある時にsetuptoosの役割とか、easy_installの役割を調べてみようかと思っています。
最後に、作業ログをベタ張りしておきます。
それではー。
[作業ログ]
[yatta47@localhost ~]$ sudo yum search python-pip [sudo] password for yatta47: 読み込んだプラグイン:fastestmirror Loading mirror speeds from cached hostfile * base: ftp.jaist.ac.jp * epel: mirror01.idc.hinet.net * extras: centos.usonyx.net * linuxtech-release: linuxsoft.cern.ch * updates: ftp.jaist.ac.jp ============================================== N/S Matched: python-pip ============================================== python-pip.noarch : A tool for installing and managing Python packages Name and summary matches only, use "search all" for everything. [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ sudo yum install python-pip 読み込んだプラグイン:fastestmirror インストール処理の設定をしています Loading mirror speeds from cached hostfile * base: ftp.jaist.ac.jp * epel: mirror01.idc.hinet.net * extras: centos.usonyx.net * linuxtech-release: linuxsoft.cern.ch * updates: ftp.jaist.ac.jp 依存性の解決をしています --> トランザクションの確認を実行しています。 ---> Package python-pip.noarch 0:7.1.0-1.el6 will be インストール --> 依存性の処理をしています: python-setuptools のパッケージ: python-pip-7.1.0-1.el6.noarch --> トランザクションの確認を実行しています。 ---> Package python-setuptools.noarch 0:0.6.10-3.el6 will be インストール --> 依存性解決を終了しました。 依存性を解決しました ===================================================================================================================== パッケージ アーキテクチャ バージョン リポジトリー 容量 ===================================================================================================================== インストールしています: python-pip noarch 7.1.0-1.el6 epel 1.5 M 依存性関連でのインストールをします。: python-setuptools noarch 0.6.10-3.el6 base 336 k トランザクションの要約 ===================================================================================================================== インストール 2 パッケージ 総ダウンロード容量: 1.9 M インストール済み容量: 8.1 M これでいいですか? [y/N]y パッケージをダウンロードしています: (1/2): python-pip-7.1.0-1.el6.noarch.rpm | 1.5 MB 00:01 (2/2): python-setuptools-0.6.10-3.el6.noarch.rpm | 336 kB 00:00 --------------------------------------------------------------------------------------------------------------------- 合計 159 kB/s | 1.9 MB 00:12 rpm_check_debug を実行しています トランザクションのテストを実行しています トランザクションのテストを成功しました トランザクションを実行しています インストールしています : python-setuptools-0.6.10-3.el6.noarch 1/2 インストールしています : python-pip-7.1.0-1.el6.noarch 2/2 Verifying : python-pip-7.1.0-1.el6.noarch 1/2 Verifying : python-setuptools-0.6.10-3.el6.noarch 2/2 インストール: python-pip.noarch 0:7.1.0-1.el6 依存性関連をインストールしました: python-setuptools.noarch 0:0.6.10-3.el6 完了しました! [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ pip pip pip2 pip2.6 [yatta47@localhost ~]$ sudo pip install awscli /usr/lib/python2.6/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 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. Collecting awscli /usr/lib/python2.6/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.11.35-py2.py3-none-any.whl (1.1MB) 100% |????????????????????????????????| 1.1MB 580kB/s Collecting s3transfer<0.2.0,>=0.1.9 (from awscli) Downloading s3transfer-0.1.10-py2.py3-none-any.whl (54kB) 100% |????????????????????????????????| 57kB 4.8MB/s Collecting PyYAML<=3.12,>=3.10 (from awscli) Downloading PyYAML-3.12.tar.gz (253kB) 100% |????????????????????????????????| 253kB 1.7MB/s Collecting colorama<=0.3.7,>=0.2.5 (from awscli) Downloading colorama-0.3.7-py2.py3-none-any.whl Requirement already satisfied (use --upgrade to upgrade): argparse>=1.1 in /usr/lib/python2.6/site-packages/argparse-1.4.0-py2.6.egg (from awscli) Collecting docutils>=0.10 (from awscli) Downloading docutils-0.13.1-py2-none-any.whl (537kB) 100% |????????????????????????????????| 540kB 1.1MB/s Collecting rsa<=3.5.0,>=3.1.2 (from awscli) Downloading rsa-3.4.2-py2.py3-none-any.whl (46kB) 100% |????????????????????????????????| 49kB 8.3MB/s Collecting botocore==1.4.92 (from awscli) Downloading botocore-1.4.92-py2.py3-none-any.whl (3.1MB) 100% |????????????????????????????????| 3.1MB 195kB/s Requirement already satisfied (use --upgrade to upgrade): futures<4.0.0,>=2.2.0 in /usr/lib/python2.6/site-packages/futures-3.0.5-py2.6.egg (from s3transfer<0.2.0,>=0.1.9->awscli) Collecting pyasn1>=0.1.3 (from rsa<=3.5.0,>=3.1.2->awscli) Downloading pyasn1-0.1.9-py2.py3-none-any.whl Collecting ordereddict==1.1 (from botocore==1.4.92->awscli) Downloading ordereddict-1.1.tar.gz Collecting jmespath<1.0.0,>=0.7.1 (from botocore==1.4.92->awscli) Downloading jmespath-0.9.0-py2.py3-none-any.whl Collecting simplejson==3.3.0 (from botocore==1.4.92->awscli) Downloading simplejson-3.3.0.tar.gz (67kB) 100% |????????????????????????????????| 69kB 5.8MB/s Collecting python-dateutil<3.0.0,>=2.1 (from botocore==1.4.92->awscli) Downloading python_dateutil-2.6.0-py2.py3-none-any.whl (194kB) 100% |????????????????????????????????| 196kB 2.7MB/s Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /usr/lib/python2.6/site-packages/six-1.10.0-py2.6.egg (from python-dateutil<3.0.0,>=2.1->botocore==1.4.92->awscli) Installing collected packages: ordereddict, jmespath, simplejson, python-dateutil, docutils, botocore, s3transfer, PyYAML, colorama, pyasn1, rsa, awscli Found existing installation: ordereddict 1.2 DEPRECATION: Uninstalling a distutils installed project (ordereddict) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project. Uninstalling ordereddict-1.2: Successfully uninstalled ordereddict-1.2 Running setup.py install for ordereddict Running setup.py install for simplejson Running setup.py install for PyYAML Successfully installed PyYAML-3.12 awscli-1.11.35 botocore-1.4.92 colorama-0.3.7 docutils-0.13.1 jmespath-0.9.0 ordereddict-1.1 pyasn1-0.1.9 python-dateutil-2.6.0 rsa-3.4.2 s3transfer-0.1.10 simplejson-3.3.0 [yatta47@localhost ~]$ which aws /usr/bin/aws [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ aws --version aws-cli/1.11.35 Python/2.6.6 Linux/2.6.32-642.4.2.el6.x86_64 botocore/1.4.92 [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$ [yatta47@localhost ~]$