AWS で マインクラフトサーバ (途中)

# 環境
- Ubuntu 18.04.2 LTS
- シンガポールリージョン の T2.micro

AWSの既存のインスタンスを使ってみましたが、メモリが少なすぎてうまくいきませんでした。
改めてチャレンジ予定。

# ポートを開ける。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/139524/6599c007-a189-8c57-b5ee-3b90b37388c6.png)
minecraft_server.1.15.2.jar 

# jdk1.8をインストール

```

$ sudo apt install openjdk-8-jdk

```

# サーバプログラムの用意

ここからURLをコピーして
https://www.minecraft.net/ja-jp/download/server/


サーバをダウンロードして

```

$ wget https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar

```

server.jar という名前で落ちてくるので、名前を変更

```

$ mv server.jar minecraft_server.1.15.2.jar

```

# 起動→失敗!

サーバのロードアベレージを見てみる

```

$ top

top - 04:52:25 up 38 days, 10:53,  1 user,  load average: 0.04, 0.12, 0.06
Tasks:  93 total,   1 running,  52 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.3 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1007612 total,    93060 free,   196672 used,   717880 buff/cache
KiB Swap:        0 total,        0 free,        0 used.   644768 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND         
31248 ubuntu    20   0   44516   3924   3332 R  0.3  0.4   0:00.01 top             
    1 root      20   0  225416   8580   6136 S  0.0  0.9   0:25.72 systemd         
    2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd        
    4 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 kworker/0:0H    
    6 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 mm_percpu_wq    
    7 root      20   0       0      0      0 S  0.0  0.0   0:03.68 ksoftirqd/0     
    8 root      20   0       0      0      0 I  0.0  0.0   0:05.66 rcu_sched       
    9 root      20   0       0      0      0 I  0.0  0.0   0:00.00 rcu_bh          
   10 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 migration/0     
   11 root      rt   0       0      0      0 S  0.0  0.0   0:09.07 watchdog/0      
   12 root      20   0       0      0      0 S  0.0  0.0   0:00.00 cpuhp/0         
   13 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kdevtmpfs       
   14 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 netns           
   15 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcu_tasks_kthre 
   16 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kauditd         
   17 root      20   0       0      0      0 S  0.0  0.0   0:00.00 xenbus          
   18 root      20   0       0      0      0 S  0.0  0.0   0:00.01 xenwatch        
   20 root      20   0       0      0      0 S  0.0  0.0   0:01.01 khungtaskd      
   21 root      20   0       0      0      0 S  0.0  0.0   0:00.00 oom_reaper      
   22 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 writeback       
   23 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kcompactd0      

```
メモリ１G だけど、試しに起動してみる

```

$ java -Xms1024M -Xmx1024M -jar minecraft_server.1.15.2.jar nogui
[04:54:09] [main/ERROR]: Failed to load properties from file: server.properties
[04:54:09] [main/WARN]: Failed to load eula.txt
[04:54:09] [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.

```
EULAを書き換える

```


$ vi eula.txt
```

もう一度起動

```

$ java -Xms1024M -Xmx1024M -jar minecraft_server.1.15.2.jar nogui
[04:54:57] [main/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[04:54:57] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[04:54:57] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[04:54:57] [main/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[04:54:57] [main/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[04:54:57] [Server thread/INFO]: Starting minecraft server version 1.15.2
[04:54:57] [Server thread/INFO]: Loading properties
[04:54:57] [Server thread/INFO]: Default game type: SURVIVAL
[04:54:57] [Server thread/INFO]: Generating keypair
[04:54:58] [Server thread/INFO]: Starting Minecraft server on *:25565
[04:54:58] [Server thread/INFO]: Using epoll channel type
[04:54:58] [Server thread/INFO]: Preparing level "world"
[04:54:59] [Server thread/INFO]: Found new data pack vanilla, loading it automatically
[04:54:59] [Server thread/INFO]: Reloading ResourceManager: Default
[04:55:03] [Server thread/INFO]: Loaded 6 recipes
[04:55:04] [Server thread/INFO]: Loaded 825 advancements
[04:55:46] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[04:55:47] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[04:55:47] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[04:55:47] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[04:55:48] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[04:55:48] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[04:55:49] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[04:55:50] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[04:55:50] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[04:55:51] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[04:55:51] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[04:55:51] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[04:55:52] [Server-Worker-1/INFO]: Preparing spawn area: 1%
[04:55:52] [Server-Worker-1/INFO]: Preparing spawn area: 2%
[04:55:53] [Server-Worker-1/INFO]: Preparing spawn area: 2%
[04:55:54] [Server-Worker-1/INFO]: Preparing spawn area: 2%
[04:55:54] [Server-Worker-1/INFO]: Preparing spawn area: 3%
[04:55:55] [Server-Worker-1/INFO]: Preparing spawn area: 3%
[04:55:55] [Server-Worker-1/INFO]: Preparing spawn area: 4%
[04:55:55] [Server-Worker-1/INFO]: Preparing spawn area: 5%
[04:55:56] [Server-Worker-1/INFO]: Preparing spawn area: 5%
[04:55:56] [Server-Worker-1/INFO]: Preparing spawn area: 6%
[04:55:57] [Server-Worker-1/INFO]: Preparing spawn area: 7%
[04:55:57] [Server-Worker-1/INFO]: Preparing spawn area: 8%
[04:55:58] [Server-Worker-1/INFO]: Preparing spawn area: 9%
[04:55:58] [Server-Worker-1/INFO]: Preparing spawn area: 10%
[04:55:59] [Server-Worker-1/INFO]: Preparing spawn area: 11%
[04:55:59] [Server-Worker-1/INFO]: Preparing spawn area: 12%
[04:56:00] [Server-Worker-1/INFO]: Preparing spawn area: 14%
[04:56:00] [Server-Worker-1/INFO]: Preparing spawn area: 15%
[04:56:01] [Server-Worker-1/INFO]: Preparing spawn area: 16%
[04:56:01] [Server-Worker-1/INFO]: Preparing spawn area: 17%
[04:56:02] [Server-Worker-1/INFO]: Preparing spawn area: 18%
[04:56:02] [Server-Worker-1/INFO]: Preparing spawn area: 19%
[04:56:03] [Server-Worker-1/INFO]: Preparing spawn area: 21%
[04:56:03] [Server-Worker-1/INFO]: Preparing spawn area: 22%
[04:56:04] [Server-Worker-1/INFO]: Preparing spawn area: 24%
[04:56:04] [Server-Worker-1/INFO]: Preparing spawn area: 24%
[04:56:05] [Server-Worker-1/INFO]: Preparing spawn area: 26%
[04:56:05] [Server-Worker-1/INFO]: Preparing spawn area: 27%
[04:56:06] [Server-Worker-1/INFO]: Preparing spawn area: 29%
[04:56:06] [Server-Worker-1/INFO]: Preparing spawn area: 31%
[04:56:07] [Server-Worker-1/INFO]: Preparing spawn area: 32%
[04:56:07] [Server-Worker-1/INFO]: Preparing spawn area: 33%
[04:56:08] [Server-Worker-1/INFO]: Preparing spawn area: 34%
[04:56:08] [Server-Worker-1/INFO]: Preparing spawn area: 36%
[04:56:09] [Server-Worker-1/INFO]: Preparing spawn area: 37%
[04:56:09] [Server-Worker-1/INFO]: Preparing spawn area: 38%
[04:56:10] [Server-Worker-1/INFO]: Preparing spawn area: 41%
[04:56:10] [Server-Worker-1/INFO]: Preparing spawn area: 43%
[04:56:11] [Server-Worker-1/INFO]: Preparing spawn area: 44%
[04:56:11] [Server-Worker-1/INFO]: Preparing spawn area: 45%
[04:56:12] [Server-Worker-1/INFO]: Preparing spawn area: 48%
[04:56:12] [Server-Worker-1/INFO]: Preparing spawn area: 50%
[04:56:13] [Server-Worker-1/INFO]: Preparing spawn area: 51%
[04:56:13] [Server-Worker-1/INFO]: Preparing spawn area: 53%
[04:56:14] [Server-Worker-1/INFO]: Preparing spawn area: 55%
[04:56:14] [Server-Worker-1/INFO]: Preparing spawn area: 58%
[04:56:15] [Server-Worker-1/INFO]: Preparing spawn area: 61%
[04:56:15] [Server-Worker-1/INFO]: Preparing spawn area: 64%
[04:56:16] [Server-Worker-1/INFO]: Preparing spawn area: 67%
[04:56:16] [Server-Worker-1/INFO]: Preparing spawn area: 69%
[04:56:17] [Server-Worker-1/INFO]: Preparing spawn area: 72%
[04:56:17] [Server-Worker-1/INFO]: Preparing spawn area: 74%
[04:56:18] [Server-Worker-1/INFO]: Preparing spawn area: 77%
[04:56:18] [Server-Worker-1/INFO]: Preparing spawn area: 80%
[04:56:19] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[04:56:19] [Server-Worker-1/INFO]: Preparing spawn area: 85%
[04:56:20] [Server-Worker-1/INFO]: Preparing spawn area: 87%
[04:56:20] [Server-Worker-1/INFO]: Preparing spawn area: 88%
[04:56:21] [Server-Worker-1/INFO]: Preparing spawn area: 90%
[04:56:21] [Server-Worker-1/INFO]: Preparing spawn area: 93%
[04:56:22] [Server-Worker-1/INFO]: Preparing spawn area: 96%
[04:56:22] [Server-Worker-1/INFO]: Preparing spawn area: 99%
[04:56:22] [Server thread/INFO]: Time elapsed: 36086 ms
[04:56:23] [Server thread/INFO]: Done (84.106s)! For help, type "help"
[04:57:25] [Server Watchdog/FATAL]: A single server tick took 60.06 seconds (should be max 0.05)
[04:57:26] [Server Watchdog/FATAL]: Considering it to be crashed, server will forcibly shutdown.
[05:09:32] [Server Watchdog/ERROR]: This crash report has been saved to: /home/ubuntu/minecraft_server/./crash-reports/crash-2020-04-06_05.08.53-server.txt
```

うーん、落ちた。元々メモリ1Gしかないのに1G指定で起動したから当然かな。
別のインスタンスを用意して、再チャレンジしてみます。