2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Cloud9でIDE環境を整えてみる

Last updated at Posted at 2019-12-11

はじめに

IDE環境が色々な拠点に乱雑に立っており、バージョンがバラバラだったりするので、Cloud9で統合できないか試してみることにしました。
まずは、環境セットアップとして、以下をやってみます。

  • pipのバージョンアップ
  • AWS-CLIのバージョンアップ
  • Amazon Corrent11のインストール
  • Homebrewのインストール
  • Mavenのインストール
  • Gradleのインストール
  • Kotlinのインストール
  • Terraformのインストール

pipのバージョンアップ

以下のコマンドでバージョンアップ可能です。

pip

$ sudo pip install --upgrade pip                                                                                                                                                    
Cache entry deserialization failed, entry ignored
Collecting pip
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 829kB/s 
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-19.3.1

AWS-CLIのバージョンアップ

同様に以下でバージョンアップ可能です。

$ pip install awscli --upgrade --user
Collecting awscli
  Downloading https://files.pythonhosted.org/packages/d3/37/0171a4da9c8d99b0466cef7265603b462a20806d628b04123192f5d17419/awscli-1.16.300-py2.py3-none-any.whl (2.5MB)
    100% |████████████████████████████████| 2.5MB 529kB/s 
Requirement already up-to-date: docutils<0.16,>=0.10 in /usr/local/lib/python2.7/site-packages (from awscli)
Requirement already up-to-date: rsa<=3.5.0,>=3.1.2 in /usr/local/lib/python2.7/site-packages (from awscli)
Requirement already up-to-date: s3transfer<0.3.0,>=0.2.0 in /usr/local/lib/python2.7/site-packages (from awscli)
Collecting PyYAML<5.2,>=3.10; python_version != "2.6" and python_version != "3.3" (from awscli)
  Downloading https://files.pythonhosted.org/packages/e3/e8/b3212641ee2718d556df0f23f78de8303f068fe29cdaa7a91018849582fe/PyYAML-5.1.2.tar.gz (265kB)
    100% |████████████████████████████████| 266kB 4.5MB/s 
Collecting botocore==1.13.36 (from awscli)
  Downloading https://files.pythonhosted.org/packages/08/e0/e47a793322fd68381e4cda4f98740c558c9ef2a87e71d06589048f59cbcb/botocore-1.13.36-py2.py3-none-any.whl (5.8MB)
    100% |████████████████████████████████| 5.8MB 210kB/s 
Requirement already up-to-date: colorama<0.4.2,>=0.2.5; python_version != "2.6" and python_version != "3.3" in /usr/local/lib/python2.7/site-packages (from awscli)
Requirement already up-to-date: pyasn1>=0.1.3 in /usr/local/lib/python2.7/site-packages (from rsa<=3.5.0,>=3.1.2->awscli)
Requirement already up-to-date: futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" in /usr/local/lib/python2.7/site-packages (from s3transfer<0.3.0,>=0.2.0->awscli)
Collecting urllib3<1.26,>=1.20; python_version == "2.7" (from botocore==1.13.36->awscli)
  Downloading https://files.pythonhosted.org/packages/b4/40/a9837291310ee1ccc242ceb6ebfd9eb21539649f193a7c8c86ba15b98539/urllib3-1.25.7-py2.py3-none-any.whl (125kB)
    100% |████████████████████████████████| 133kB 9.1MB/s 
Requirement already up-to-date: python-dateutil<2.8.1,>=2.1; python_version >= "2.7" in /usr/local/lib/python2.7/site-packages (from botocore==1.13.36->awscli)
Requirement already up-to-date: jmespath<1.0.0,>=0.7.1 in /usr/local/lib/python2.7/site-packages (from botocore==1.13.36->awscli)
Requirement already up-to-date: six>=1.5 in /usr/local/lib/python2.7/site-packages (from python-dateutil<2.8.1,>=2.1; python_version >= "2.7"->botocore==1.13.36->awscli)
Building wheels for collected packages: PyYAML
  Running setup.py bdist_wheel for PyYAML ... done
  Stored in directory: /home/ec2-user/.cache/pip/wheels/d9/45/dd/65f0b38450c47cf7e5312883deb97d065e030c5cca0a365030
Successfully built PyYAML
Installing collected packages: PyYAML, urllib3, botocore, awscli
Successfully installed PyYAML-5.1.2 awscli-1.16.300 botocore-1.13.36 urllib3-1.25.7

Amazon Corretto11のインストール

初期状態ではJDK 1.7.0-231がインストールされていました。古い。。。
Amazon謹製JDKのAmazon Corretto11を使ってみることにします。

yumから取れなかったので、最新のDLリンクをココから拾ってきて、rpmコマンドでインストールします。

$ sudo rpm -ivh https://d3pxv6yz143wms.cloudfront.net/11.0.3.7.1/java-11-amazon-corretto-devel-11.0.3.7-1.x86_64.rpm                                                                
Retrieving https://d3pxv6yz143wms.cloudfront.net/11.0.3.7.1/java-11-amazon-corretto-devel-11.0.3.7-1.x86_64.rpm
warning: /var/tmp/rpm-tmp.einimC: Header V3 RSA/SHA256 Signature, key ID f8152b28: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:java-11-amazon-corretto-devel-1:1################################# [100%]

Alternativesも自動的に変わってくれていました。

$ java -version
openjdk version "11.0.3" 2019-04-16 LTS
OpenJDK Runtime Environment Corretto-11.0.3.7.1 (build 11.0.3+7-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.3.7.1 (build 11.0.3+7-LTS, mixed mode)
$ alternatives --display java
java - status is auto.
 link currently points to /usr/lib/jvm/java-11-amazon-corretto/bin/java
~

Homebrewのインストール

Homebrew Documentationを参考にインストールします。

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
/bin/mkdir
==> This script will install:
/home/linuxbrew/.linuxbrew/bin/brew
/home/linuxbrew/.linuxbrew/share/doc/homebrew
/home/linuxbrew/.linuxbrew/share/man/man1/brew.1
/home/linuxbrew/.linuxbrew/share/zsh/site-functions/_brew
/home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew
/home/ec2-user/.cache/Homebrew/
/home/linuxbrew/.linuxbrew/Homebrew
==> The following new directories will be created:
/home/linuxbrew/.linuxbrew/bin
/home/linuxbrew/.linuxbrew/etc
/home/linuxbrew/.linuxbrew/include
/home/linuxbrew/.linuxbrew/lib
/home/linuxbrew/.linuxbrew/sbin
/home/linuxbrew/.linuxbrew/share
/home/linuxbrew/.linuxbrew/var
/home/linuxbrew/.linuxbrew/opt
/home/linuxbrew/.linuxbrew/share/zsh
/home/linuxbrew/.linuxbrew/share/zsh/site-functions
/home/linuxbrew/.linuxbrew/var/homebrew
/home/linuxbrew/.linuxbrew/var/homebrew/linked
/home/linuxbrew/.linuxbrew/Cellar
/home/linuxbrew/.linuxbrew/Caskroom
/home/linuxbrew/.linuxbrew/Homebrew
/home/linuxbrew/.linuxbrew/Frameworks

Press RETURN to continue or any other key to abort

と聞かれるので、エンターでインストール可能です。簡単ですね。
最後に

Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH.

とパスが通ってないと怒られるので、以下を実行してパスを通します。

$ test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
$ test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
$ test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
$ echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile

Gradleのインストール

Homebrew経由で一発ですね。簡単です。

$ brew install gradle
                                              ==> Downloading https://services.gradle.org/distributions/gradle-6.0.1-all.zip
==> Downloading from https://downloads.gradle-dn.com/distributions/gradle-6.0.1-all.zip
######################################################################## 100.0%
  /home/linuxbrew/.linuxbrew/Cellar/gradle/6.0.1: 14,178 files, 270.2MB, built in 9 seconds

Mavenのインストール

おなじく。

$ brew install gradle
                                              ==> Downloading https://services.gradle.org/distributions/gradle-6.0.1-all.zip
==> Downloading from https://downloads.gradle-dn.com/distributions/gradle-6.0.1-all.zip
######################################################################## 100.0%
  /home/linuxbrew/.linuxbrew/Cellar/gradle/6.0.1: 14,178 files, 270.2MB, built in 9 seconds

Kotlinのインストール

公式ドキュメントを読み進めてインストールします。
SDKMAN!経由でインストールするとのこと。

SDKMAN!のインストール

簡単ですね。

$ curl -s https://get.sdkman.io | bash
~

                                                                 Now attempting installation...


Looking for a previous installation of SDKMAN...
Looking for unzip...
Looking for zip...
Looking for curl...
Looking for sed...
Installing SDKMAN scripts...
Create distribution directories...
Getting available candidates...
Prime the config file...
Download script archive...
######################################################################## 100.0%
Extract script archive...
Install scripts...
Set version to 5.7.4+362 ...
Attempt update of interactive bash profile on regular UNIX...
Added sdkman init snippet to /home/ec2-user/.bashrc
Attempt update of zsh profile...
Updated existing /home/ec2-user/.zshrc



All done!


Please open a new terminal, or run the following in the existing one:

    source "/home/ec2-user/.sdkman/bin/sdkman-init.sh"

Then issue the following command:

    sdk help

Enjoy!!!

Kotlinのインストール

インストールしたターミナルではsdkコマンドが実行できないので、
新しいターミナルを開くか、以下のコマンドを実行してからインストールを行います。

新しいターミナルを開かない場合は以下を実行↓

$ source "/home/ec2-user/.sdkman/bin/sdkman-init.sh"

Kotlinのインストール

$ sdk install kotlin
==== BROADCAST =================================================================
* 2019-12-10: Vertx 3.8.4 released on SDKMAN! #vertx
* 2019-12-08: Groovy 3.0.0-rc-2 released on SDKMAN! #groovylang
* 2019-12-06: Springboot 2.2.2.RELEASE released on SDKMAN! #springboot
================================================================================

Downloading: kotlin 1.3.61

In progress...

########################################################################################################################################################################################## 100.0%

Installing: kotlin 1.3.61
Done installing!


Setting kotlin 1.3.61 as default.

Terraformのインストール

tfenv経由でインストールします。案件ごとに使ってるバージョンが違ったりするので、
切替が簡単にできるのと便利です。

以下のコマンドでインストールします。

$ brew install tfenv
==> Downloading https://github.com/tfutils/tfenv/archive/v1.0.2.tar.gz
==> Downloading from https://codeload.github.com/tfutils/tfenv/tar.gz/v1.0.2
######################################################################## 100.0%
  /home/linuxbrew/.linuxbrew/Cellar/tfenv/1.0.2: 20 files, 48.1KB, built in 3 seconds

今回は最新版をインストールします。が、バージョンも一応確認しておきます。

バージョンの確認

$ tfenv list-remote
0.12.17
0.12.16
0.12.15
0.12.14
0.12.13
0.12.12
0.12.11
0.12.10
~
0.1.0

インストール

$ tfenv install latest
[INFO] Installing Terraform v0.12.17
[INFO] Downloading release tarball from https://releases.hashicorp.com/terraform/0.12.17/terraform_0.12.17_linux_amd64.zip
########################################################################################################################################################################################## 100.0%
[INFO] Downloading SHA hash file from https://releases.hashicorp.com/terraform/0.12.17/terraform_0.12.17_SHA256SUMS
tfenv: tfenv-install: [WARN] No keybase install found, skipping OpenPGP signature verification
Archive:  tfenv_download.sy2Bv6/terraform_0.12.17_linux_amd64.zip
  inflating: /home/linuxbrew/.linuxbrew/Cellar/tfenv/1.0.2/versions/0.12.17/terraform  
[INFO] Installation of terraform v0.12.17 successful
[INFO] Switching to v0.12.17
[INFO] Switching completed

現時点の最新版のv0.12.17がインストールされました。

まとめ

簡単ですが、ざっとお遊びできる環境が整いました。
次回から使用感を実際に見ていきたいと思います。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?