Azure VMにElixir環境構築

# Brightの対象
Webアプリ開発 Elixir > クラス1 > Elixir環境構築 > クラウド > Azure VMにElixir環境構築

# 前提
Azureのアカウント登録しログイン

# Azure VMの作成
赤い矢印は入力またはクリック

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/bb16f3b0-c850-c427-b0b4-b20065281ba8.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/c8b4d355-4465-d5f1-b5ab-11a4f1d0b4df.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/7826c1c3-67f9-1e0c-b105-54f440135a86.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/31862f5b-7e0b-f921-c555-df9a178bbac2.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/d3c6de20-3e68-dff3-7335-99c2d3ca38ff.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/8689a448-8032-005b-ff07-f6e5cb8b7ed0.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/6ceedc46-5f7f-08cd-2ecd-ed28f90c66eb.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/17861e2e-99a2-aa04-4dc6-726153b2c315.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/b02d15c2-042b-b2d1-9075-98edb8fa6f4d.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/681f946a-898e-bf4a-031a-6d4046fdb1fb.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/09348596-ac24-4a01-f4d0-4642d4d15f57.png)

# FWの設定
4000番をポート開放します
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/7158862c-7bfc-b070-d1c0-46b6011c9e46.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/80fcfc44-ba43-d4cf-9fc3-6f21b9d585d9.png)

# ssh接続
sshの接続の案内が表示されます（画面取り忘れ）
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/ed7ebb85-092f-19cc-1e9e-7e1a3234d9f1.png)

接続例
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/3406acf9-dbbf-d575-df57-5f1e5873b623.png)



# Elixir環境構築

(自作スクリプトを使ってます）
http://github.com/t-yamanashi/install

```sh
$ git clone http://github.com/t-yamanashi/install
$ cd install/elixir_asdf_install
$ sh asdf.sh
$ source ~/.bashrc
$ sh elixir20.sh 
$ sh phxinstall.sh 
```

[Yn]聞かれるのでY
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/809e990e-26fb-1528-d688-d1c380468cc3.png)

```sh
$ cd 
$ mix phx.new hoge --no-ecto
```
[Yn]聞かれるのでY

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/e1c25663-734e-927c-dc55-b32b2fe3ff0e.png)

```sh
$ cd hoge
```

```sh
$ vi config/dev.exs
```
httpの部分を0, 0, 0, 0に修正
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/b9814746-3cf7-6cfc-a948-aef51f5f08e5.png)

```sh
$ mix phx.server
```

[Yn]聞かれるのでY
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/16cfe14a-2fd6-07e8-7031-7e0828c3baa1.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/132ef043-0b18-56b6-6a10-95cc1b2b83ea.png)

外部IPを調べる
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/e940dba7-0160-d73f-be95-575e37b2db98.png)

外部IP:4000でアクセス
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/f04d9a31-4d0d-1b00-8101-d3fd3e2eca13.png)

# VMの削除

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/37bd277a-3740-8624-60a4-d3ca0580c02c.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/295814/6b55db53-5afc-fe8b-9c56-555adc901fa4.png)