「Minecraft サーバを AWS で作る」
https://qiita.com/nanbuwks/items/601832b2da00b451d55d
では、あっけなく動いたのでその知見を元に Raspberry Pi 4 で Minecraft サーバを作ってみる。
環境
- Raspberry Pi 4 Model B 4GB (Raspberry Pi 3 Model B でも検証したが厳しい感じ)
- 2020-02-13-raspbian-buster-lite.zip
- 有線接続LAN
インストール
micro SD カードの書き込みはこちらの方法を使用
「Ubuntu Linux で Raspian ZIP ファイルを microSD カードに書き込む」
https://qiita.com/nanbuwks/items/2c296549ff72dacf7adc
また、/boot に ssh を作っておきます
初期設定
ログオンしてからの初期設定は
$ sudo apt update
$ sudo apt upgrade
の後、
$ sudo raspi-config
として、
「Raspberry Pi 最初の設定をCUIで行う(ディスプレイ、キーボードがある場合)」
https://qiita.com/nanbuwks/items/9a1d46c22e898178015c
のように行いました。
なお、ssh で行うとキーボード設定はできない感じです。
IP アドレスの固定化
サーバとして使う時は IPアドレスを固定にしておくほうが便利です。
sudo vi /etc/dhcpcd.conf
として、以下をファイル末尾に付け加えます。
interface eth0
static ip_address=192.168.42.104/24
static routers=192.168.42.1
static domain_name_servers=192.168.42.1
保存終了した後、以下で再起動。
$ sudo reboot
102.168.42.104 でログインし直します。
Javaをインストール
Raspbianで用意されているうちの最新のものを使用しました。
sudo apt install openjdk-11-jre
起動
以下のようにして起動します
$ java -Xmx1024M -Xms1024M -jar server.jar nogui
テスト時などはこの通りでいいですが、長期で稼働しっぱなしなどにする場合は & を最後に付けたり screen セッションでつかったり、あるいは本格的に自動起動設定やサービス化するのがいいでしょう。
Raspberry Pi 4 Model B ( 4G ) で動かした所、以下のようにして2分ほどで起動しました。
[20:29:36] [main/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[20:29:36] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[20:29:36] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[20:29:36] [main/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[20:29:36] [main/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[20:29:36] [Server thread/INFO]: Starting minecraft server version 1.15.2
[20:29:36] [Server thread/INFO]: Loading properties
[20:29:36] [Server thread/INFO]: Default game type: SURVIVAL
[20:29:36] [Server thread/INFO]: Generating keypair
[20:29:37] [Server thread/INFO]: Starting Minecraft server on *:25565
[20:29:38] [Server thread/INFO]: Using default channel type
[20:29:38] [Server thread/INFO]: Preparing level "world"
[20:29:39] [Server thread/INFO]: Reloading ResourceManager: Default
[20:30:10] [Server thread/INFO]: Loaded 6 recipes
[20:30:27] [Server thread/INFO]: Loaded 825 advancements
[20:30:28] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:34] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:35] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:36] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:36] [Server thread/INFO]: Preparing spawn area: 0%
[20:30:36] [Server thread/INFO]: Preparing spawn area: 48%
[20:30:49] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[20:30:49] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:49] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[20:30:50] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:53] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:53] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:53] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:53] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[20:30:53] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:53] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:53] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:54] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:54] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:54] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:55] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[20:30:55] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:56] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[20:30:56] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[20:30:57] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[20:30:57] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:30:58] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:58] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:30:59] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:31:00] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:31:00] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:31:00] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:31:01] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:31:01] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:31:02] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:31:02] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:31:03] [Server-Worker-1/INFO]: Preparing spawn area: 83%
[20:31:03] [Server-Worker-2/INFO]: Preparing spawn area: 83%
[20:31:04] [Server-Worker-3/INFO]: Preparing spawn area: 83%
[20:31:04] [Server-Worker-3/INFO]: Preparing spawn area: 84%
[20:31:05] [Server-Worker-3/INFO]: Preparing spawn area: 84%
[20:31:05] [Server-Worker-3/INFO]: Preparing spawn area: 86%
[20:31:06] [Server-Worker-2/INFO]: Preparing spawn area: 91%
[20:31:06] [Server-Worker-1/INFO]: Preparing spawn area: 91%
[20:31:07] [Server-Worker-1/INFO]: Preparing spawn area: 92%
[20:31:07] [Server-Worker-2/INFO]: Preparing spawn area: 93%
[20:31:08] [Server-Worker-3/INFO]: Preparing spawn area: 95%
[20:31:08] [Server-Worker-3/INFO]: Preparing spawn area: 98%
[20:31:09] [Server thread/INFO]: Preparing spawn area: 99%
[20:31:09] [Server thread/INFO]: Time elapsed: 41122 ms
[20:31:09] [Server thread/INFO]: Done (90.443s)! For help, type "help"
[20:31:13] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2008ms or 40 ticks behind
プレイしてみる
動かしてみて、問題ないことを確認します。
インターネット外部に公開
詳細は割愛しますが、TCP25565 と UDP25565 の公開をルータなどに設定すればOKです。
おまけ Raspberry Pi 3 で動かした時のログ
なお、最初にRaspberry Pi 3 で動かした時は、動きはしましたがかなり苦しそうでした。
[19:23:59] [main/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[19:23:59] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9,
0 0 0]
[19:24:00] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[19:24:00] [main/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[19:24:00] [main/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[19:24:00] [Server thread/INFO]: Starting minecraft server version 1.15.2
[19:24:00] [Server thread/INFO]: Loading properties
[19:24:00] [Server thread/INFO]: Default game type: SURVIVAL
[19:24:00] [Server thread/INFO]: Generating keypair
[19:24:07] [Server thread/INFO]: Starting Minecraft server on *:25565
[19:24:07] [Server thread/INFO]: Using default channel type
[19:24:08] [Server thread/INFO]: Preparing level "world"
[19:24:10] [Server thread/INFO]: Found new data pack vanilla, loading it automatically
[19:24:10] [Server thread/INFO]: Reloading ResourceManager: Default
[19:26:04] [Server thread/INFO]: Loaded 6 recipes
[19:26:06] [Server thread/INFO]: Loaded 825 advancements
[19:26:56] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[19:26:57] [Server-Worker-2/INFO]: Preparing spawn area: 0%
[19:26:57] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[19:26:57] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[19:26:58] [Server-Worker-2/INFO]: Preparing spawn area: 0%
[19:26:58] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[19:26:59] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[19:26:59] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[19:27:00] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[19:27:01] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[19:27:01] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[19:27:01] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[19:27:02] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[19:27:02] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[19:27:03] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[19:27:03] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[19:27:04] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[19:27:04] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[19:27:05] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[19:27:05] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[19:27:06] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[19:27:06] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[19:27:07] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[19:27:07] [Server-Worker-1/INFO]: Preparing spawn area: 0%
[19:27:08] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[19:27:08] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[19:27:09] [Server-Worker-2/INFO]: Preparing spawn area: 0%
[19:27:09] [Server-Worker-2/INFO]: Preparing spawn area: 0%
[19:27:10] [Server-Worker-2/INFO]: Preparing spawn area: 0%
[19:27:10] [Server-Worker-2/INFO]: Preparing spawn area: 0%
[19:27:11] [Server-Worker-2/INFO]: Preparing spawn area: 1%
[19:27:11] [Server-Worker-3/INFO]: Preparing spawn area: 1%
[19:27:12] [Server-Worker-3/INFO]: Preparing spawn area: 1%
[19:27:12] [Server-Worker-2/INFO]: Preparing spawn area: 1%
・
・
・
[19:29:27] [Server-Worker-2/INFO]: Preparing spawn area: 92%
[19:29:27] [Server-Worker-2/INFO]: Preparing spawn area: 92%
[19:29:27] [Server-Worker-2/INFO]: Preparing spawn area: 92%
[19:29:27] [Server-Worker-3/INFO]: Preparing spawn area: 92%
[19:29:27] [Server-Worker-2/INFO]: Preparing spawn area: 92%
[19:29:27] [Server-Worker-3/INFO]: Preparing spawn area: 92%
[19:29:27] [Server-Worker-3/INFO]: Preparing spawn area: 92%
[19:29:27] [Server-Worker-3/INFO]: Preparing spawn area: 92%
[19:29:27] [Server-Worker-2/INFO]: Preparing spawn area: 92%
[19:29:27] [Server-Worker-2/INFO]: Preparing spawn area: 92%
[19:29:30] [Server-Worker-3/INFO]: Preparing spawn area: 97%
[19:29:30] [Server-Worker-1/INFO]: Preparing spawn area: 97%
[19:29:30] [Server-Worker-3/INFO]: Preparing spawn area: 97%
[19:29:30] [Server-Worker-2/INFO]: Preparing spawn area: 97%
[19:29:30] [Server-Worker-1/INFO]: Preparing spawn area: 97%
[19:29:30] [Server thread/INFO]: Time elapsed: 153775 ms
[19:29:30] [Server thread/INFO]: Done (321.899s)! For help, type "help"
[19:29:32] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2159ms or 43 ticks behind
[19:30:05] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 17806ms or 356 ticks behind
[19:34:58] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 7821ms or 156 ticks behind
・
・
・