概要

  • WSL(Windows Subsystem for Linux)+ Ubuntuの環境に、terraformingをインストールする手順をまとめます。Ubuntuのapt-getだけでterraformingのインストールができれば良かったのですが、先ずgemをインストールして、次にterraformingをインストールする順序となります。
  • terraformingの環境が整ったら、既存のAWS環境から構成情報をインポートする予定です。ご期待下さい。

Terraformingインストール手順

パッケージのアップデート

  • 事前作業として、Ubuntuにインストールされているパッケージのアップデートを行います。先ず、apt-get updateでパッケージリストの更新です。
  • 次に、apt-get upgradeでインストールされているパッケージのアップデートを行います。ログは省略します。
niikawa@niikawa1:~$ sudo apt-get update
niikawa@niikawa1:~$ sudo apt-get upgrade

gemのインストール

  • terraformingのインストールに使用するgemをインストールします。
niikawa@niikawa1:~$ sudo apt-get install rubygems
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'ruby' instead of 'rubygems'
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  fonts-lato javascript-common libjs-jquery libruby2.5 rake ruby-did-you-mean ruby-minitest ruby-net-telnet
  ruby-power-assert ruby-test-unit ruby2.5 rubygems-integration zip
Suggested packages:
  apache2 | lighttpd | httpd ri ruby-dev bundler
The following NEW packages will be installed:
  fonts-lato javascript-common libjs-jquery libruby2.5 rake ruby ruby-did-you-mean ruby-minitest ruby-net-telnet
  ruby-power-assert ruby-test-unit ruby2.5 rubygems-integration zip
0 upgraded, 14 newly installed, 0 to remove and 3 not upgraded.
Need to get 6326 kB of archives.
After this operation, 28.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 fonts-lato all 2.0-2 [2698 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 javascript-common all 11 [6066 B]
Get:3 http://archive.ubuntu.com/ubuntu bionic/main amd64 libjs-jquery all 3.2.1-1 [152 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic/main amd64 rubygems-integration all 1.11 [4994 B]
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 ruby2.5 amd64 2.5.1-1ubuntu1.6 [48.6 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 ruby amd64 1:2.5.1 [5712 B]
Get:7 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 rake all 12.3.1-1ubuntu0.1 [44.9 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic/main amd64 ruby-did-you-mean all 1.2.0-2 [9700 B]
Get:9 http://archive.ubuntu.com/ubuntu bionic/main amd64 ruby-minitest all 5.10.3-1 [38.6 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic/main amd64 ruby-net-telnet all 0.1.1-2 [12.6 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic/main amd64 ruby-power-assert all 0.3.0-1 [7952 B]
Get:12 http://archive.ubuntu.com/ubuntu bionic/main amd64 ruby-test-unit all 3.2.5-1 [61.1 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libruby2.5 amd64 2.5.1-1ubuntu1.6 [3069 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic/main amd64 zip amd64 3.0-11build1 [167 kB]
Fetched 6326 kB in 20s (311 kB/s)
Selecting previously unselected package fonts-lato.
(Reading database ... 35482 files and directories currently installed.)
Preparing to unpack .../00-fonts-lato_2.0-2_all.deb ...
Unpacking fonts-lato (2.0-2) ...
Selecting previously unselected package javascript-common.
Preparing to unpack .../01-javascript-common_11_all.deb ...
Unpacking javascript-common (11) ...
Selecting previously unselected package libjs-jquery.
Preparing to unpack .../02-libjs-jquery_3.2.1-1_all.deb ...
Unpacking libjs-jquery (3.2.1-1) ...
Selecting previously unselected package rubygems-integration.
Preparing to unpack .../03-rubygems-integration_1.11_all.deb ...
Unpacking rubygems-integration (1.11) ...
Selecting previously unselected package ruby2.5.
Preparing to unpack .../04-ruby2.5_2.5.1-1ubuntu1.6_amd64.deb ...
Unpacking ruby2.5 (2.5.1-1ubuntu1.6) ...
Selecting previously unselected package ruby.
Preparing to unpack .../05-ruby_1%3a2.5.1_amd64.deb ...
Unpacking ruby (1:2.5.1) ...
Selecting previously unselected package rake.
Preparing to unpack .../06-rake_12.3.1-1ubuntu0.1_all.deb ...
Unpacking rake (12.3.1-1ubuntu0.1) ...
Selecting previously unselected package ruby-did-you-mean.
Preparing to unpack .../07-ruby-did-you-mean_1.2.0-2_all.deb ...
Unpacking ruby-did-you-mean (1.2.0-2) ...
Selecting previously unselected package ruby-minitest.
Preparing to unpack .../08-ruby-minitest_5.10.3-1_all.deb ...
Unpacking ruby-minitest (5.10.3-1) ...
Selecting previously unselected package ruby-net-telnet.
Preparing to unpack .../09-ruby-net-telnet_0.1.1-2_all.deb ...
Unpacking ruby-net-telnet (0.1.1-2) ...
Selecting previously unselected package ruby-power-assert.
Preparing to unpack .../10-ruby-power-assert_0.3.0-1_all.deb ...
Unpacking ruby-power-assert (0.3.0-1) ...
Selecting previously unselected package ruby-test-unit.
Preparing to unpack .../11-ruby-test-unit_3.2.5-1_all.deb ...
Unpacking ruby-test-unit (3.2.5-1) ...
Selecting previously unselected package libruby2.5:amd64.
Preparing to unpack .../12-libruby2.5_2.5.1-1ubuntu1.6_amd64.deb ...
Unpacking libruby2.5:amd64 (2.5.1-1ubuntu1.6) ...
Selecting previously unselected package zip.
Preparing to unpack .../13-zip_3.0-11build1_amd64.deb ...
Unpacking zip (3.0-11build1) ...
Setting up libjs-jquery (3.2.1-1) ...
Setting up zip (3.0-11build1) ...
Setting up fonts-lato (2.0-2) ...
Setting up ruby-did-you-mean (1.2.0-2) ...
Setting up ruby-net-telnet (0.1.1-2) ...
Setting up rubygems-integration (1.11) ...
Setting up javascript-common (11) ...
Setting up ruby-minitest (5.10.3-1) ...
Setting up ruby-power-assert (0.3.0-1) ...
Setting up ruby2.5 (2.5.1-1ubuntu1.6) ...
Setting up ruby (1:2.5.1) ...
Setting up ruby-test-unit (3.2.5-1) ...
Setting up rake (12.3.1-1ubuntu0.1) ...
Setting up libruby2.5:amd64 (2.5.1-1ubuntu1.6) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
niikawa@niikawa1:~$ which gem
/usr/bin/gem
  • gemをアップデートします。(2.7.6 → 3.1.2)
niikawa@niikawa1:~$ gem -v
2.7.6
niikawa@niikawa1:~$ sudo gem update --system
Updating rubygems-update
Fetching: rubygems-update-3.1.2.gem (100%)
Successfully installed rubygems-update-3.1.2
Parsing documentation for rubygems-update-3.1.2
Installing ri documentation for rubygems-update-3.1.2
Installing darkfish documentation for rubygems-update-3.1.2
Done installing documentation for rubygems-update after 74 seconds
Parsing documentation for rubygems-update-3.1.2
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.1.2
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:29: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:30: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:29: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:30: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
  Successfully built RubyGem
  Name: bundler
  Version: 2.1.2
  File: bundler-2.1.2.gem
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
Bundler 2.1.2 installed
RubyGems 3.1.2 installed
Regenerating binstubs
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
`/usr/share/rubygems-integration/all/gems/rake-12.3.1/exe/rake` does not exist, maybe `gem pristine rake` will fix it?
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
Parsing documentation for rubygems-3.1.2
Installing ri documentation for rubygems-3.1.2

~ 省略 ~

RubyGems installed the following executables:
        /usr/bin/gem2.5
        /usr/bin/bundle2.5

Ruby Interactive (ri) documentation was installed. ri is kind of like man
pages for Ruby libraries. You may access it like this:
  ri Classname
  ri Classname.class_method
  ri Classname#instance_method
If you do not wish to install this documentation in the future, use the
--no-document flag, or set it as the default in your ~/.gemrc file. See
'gem help env' for details.

RubyGems system software updated
niikawa@niikawa1:~$ gem -v
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:29: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:30: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:29: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:30: warning: constant Gem::ConfigMap is deprecated
3.1.2

terraformingのインストール

  • 続いて、gemを使用してterraformingをインストールします。
niikawa@niikawa1:~$ sudo gem install terraforming
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:29: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:30: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:29: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:30: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
Fetching aws-eventstream-1.0.3.gem
Fetching jmespath-1.4.0.gem
Fetching aws-sigv4-1.1.1.gem
Fetching aws-partitions-1.285.0.gem
Fetching aws-sdk-core-3.91.1.gem
Fetching aws-sdk-autoscaling-1.33.0.gem
Fetching aws-sdk-cloudwatch-1.34.0.gem
Fetching aws-sdk-dynamodb-1.45.0.gem
Fetching aws-sdk-ec2-1.151.0.gem
Fetching aws-sdk-efs-1.26.0.gem
Fetching aws-sdk-elasticache-1.31.0.gem
Fetching aws-sdk-elasticloadbalancing-1.20.0.gem
Fetching aws-sdk-elasticloadbalancingv2-1.41.0.gem
Fetching aws-sdk-iam-1.34.0.gem
Fetching aws-sdk-kms-1.30.0.gem
Fetching aws-sdk-rds-1.80.0.gem
Fetching aws-sdk-redshift-1.39.0.gem
Fetching aws-sdk-route53-1.31.0.gem
Fetching terraforming-0.18.0.gem
Fetching aws-sdk-s3-1.61.1.gem
Fetching aws-sdk-sns-1.22.0.gem
Fetching aws-sdk-sqs-1.24.0.gem
Fetching multi_json-1.12.2.gem
Fetching thor-1.0.1.gem
Successfully installed jmespath-1.4.0
Successfully installed aws-partitions-1.285.0
Successfully installed aws-eventstream-1.0.3
Successfully installed aws-sigv4-1.1.1
Successfully installed aws-sdk-core-3.91.1
Successfully installed aws-sdk-autoscaling-1.33.0
Successfully installed aws-sdk-cloudwatch-1.34.0
Successfully installed aws-sdk-dynamodb-1.45.0
Successfully installed aws-sdk-ec2-1.151.0
Successfully installed aws-sdk-efs-1.26.0
Successfully installed aws-sdk-elasticache-1.31.0
Successfully installed aws-sdk-elasticloadbalancing-1.20.0
Successfully installed aws-sdk-elasticloadbalancingv2-1.41.0
Successfully installed aws-sdk-iam-1.34.0
Successfully installed aws-sdk-kms-1.30.0
Successfully installed aws-sdk-rds-1.80.0
Successfully installed aws-sdk-redshift-1.39.0
Successfully installed aws-sdk-route53-1.31.0
Successfully installed aws-sdk-s3-1.61.1
Successfully installed aws-sdk-sns-1.22.0
Successfully installed aws-sdk-sqs-1.24.0
Successfully installed multi_json-1.12.2
Successfully installed thor-1.0.1
Successfully installed terraforming-0.18.0
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
Parsing documentation for jmespath-1.4.0
Installing ri documentation for jmespath-1.4.0
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
Parsing documentation for aws-partitions-1.285.0
Installing ri documentation for aws-partitions-1.285.0
Parsing documentation for aws-eventstream-1.0.3
Installing ri documentation for aws-eventstream-1.0.3
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
Parsing documentation for aws-sigv4-1.1.1
Installing ri documentation for aws-sigv4-1.1.1
Parsing documentation for aws-sdk-core-3.91.1
Installing ri documentation for aws-sdk-core-3.91.1
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
Parsing documentation for aws-sdk-autoscaling-1.33.0
Installing ri documentation for aws-sdk-autoscaling-1.33.0
Parsing documentation for aws-sdk-cloudwatch-1.34.0
Installing ri documentation for aws-sdk-cloudwatch-1.34.0
Parsing documentation for aws-sdk-dynamodb-1.45.0
Installing ri documentation for aws-sdk-dynamodb-1.45.0
Parsing documentation for aws-sdk-ec2-1.151.0
Installing ri documentation for aws-sdk-ec2-1.151.0
Parsing documentation for aws-sdk-efs-1.26.0
Installing ri documentation for aws-sdk-efs-1.26.0
Parsing documentation for aws-sdk-elasticache-1.31.0
Installing ri documentation for aws-sdk-elasticache-1.31.0
Parsing documentation for aws-sdk-elasticloadbalancing-1.20.0
Installing ri documentation for aws-sdk-elasticloadbalancing-1.20.0
Parsing documentation for aws-sdk-elasticloadbalancingv2-1.41.0
Installing ri documentation for aws-sdk-elasticloadbalancingv2-1.41.0
Parsing documentation for aws-sdk-iam-1.34.0
Installing ri documentation for aws-sdk-iam-1.34.0
Parsing documentation for aws-sdk-kms-1.30.0
Installing ri documentation for aws-sdk-kms-1.30.0
Parsing documentation for aws-sdk-rds-1.80.0
Installing ri documentation for aws-sdk-rds-1.80.0
Parsing documentation for aws-sdk-redshift-1.39.0
Installing ri documentation for aws-sdk-redshift-1.39.0
Parsing documentation for aws-sdk-route53-1.31.0
Installing ri documentation for aws-sdk-route53-1.31.0
Parsing documentation for aws-sdk-s3-1.61.1
Installing ri documentation for aws-sdk-s3-1.61.1
Parsing documentation for aws-sdk-sns-1.22.0
Installing ri documentation for aws-sdk-sns-1.22.0
Parsing documentation for aws-sdk-sqs-1.24.0
Installing ri documentation for aws-sdk-sqs-1.24.0
Parsing documentation for multi_json-1.12.2
Installing ri documentation for multi_json-1.12.2
Parsing documentation for thor-1.0.1
Installing ri documentation for thor-1.0.1
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
Parsing documentation for terraforming-0.18.0
Installing ri documentation for terraforming-0.18.0
Done installing documentation for jmespath, aws-partitions, aws-eventstream, aws-sigv4, aws-sdk-core, aws-sdk-autoscaling, aws-sdk-cloudwatch, aws-sdk-dynamodb, aws-sdk-ec2, aws-sdk-efs, aws-sdk-elasticache, aws-sdk-elasticloadbalancing, aws-sdk-elasticloadbalancingv2, aws-sdk-iam, aws-sdk-kms, aws-sdk-rds, aws-sdk-redshift, aws-sdk-route53, aws-sdk-s3, aws-sdk-sns, aws-sdk-sqs, multi_json, thor, terraforming after 117 seconds
24 gems installed
niikawa@niikawa1:~$ which terraforming
/usr/local/bin/terraforming
  • terraformingがインストールできました。次は、terraformingを使って、既存のAWS環境より、 構成情報をインポートに挑戦してみようと思います。ご期待ください。

warning: constant Gem::ConfigMap is deprecated

  • terraforming実行時に出力される「warning: constant Gem::ConfigMap is deprecated」のメッセージは、known issue のようです。2020/3現在の最新terraforming でも出力されるため、もう少し様子見したいと思います。
I'm having a problem My current problem is I'm running the latest version of ruby gems and I'm seeing deprecation warnings: $ gem update --system /usr/lib/ruby/vendor_ruby/rubygems/defa...

元記事はこちら

UbuntuにTerraformingインストール