3 年ほど前に公開していたもののリライトです。
Oracle Cloud Infrastructure (OCI) では AArch64 の 4 OCPU / 24GB RAM な VM が
Always Free で借りられます。すごいですね。
合計なので、 1 OCPU / 6GB RAM のインスタンスを 4 つ作ることなども可能です。
ただし、東京リージョンはインスタンス枠がほぼ上限のようで、取り合いになっています。
これを解決するには、 Pay As You Go に登録しちゃってください。
優先的に枠が割り当てられるようで、簡単に VM インスタンスが作成できます。
無料枠の範囲で利用するのであれば、課金されないので、安心してください。
(くれぐれも合計で 4 OCPU / 24GB RAM / 200GB Block Storage を超えないように。)
では、 Minecraft サーバーを建てていきます。お遊びからはじめて、後半に実践編です。
前者はあまり実用的ではないので、参考までに。
今回は Ubuntu 22.04 LTS を使っています。
AArch64 のサーバーでも Bedrock Edition を動かす
Bedrock Edition は x86_64 向けのプログラムなので、もちろん ARM CPU では動きません。
これを解決するために、 Box64 というエミュレーターを使います。
https://github.com/ptitSeb/box64インストールは簡単です。
$ git clone https://github.com/ptitSeb/box64
$ cd box64/
$ mkdir build; cd build; cmake .. \
-DARM_DYNAREC=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j$(nproc)
$ sudo make install
$ sudo systemctl restart systemd-binfmtこれだけです。 cmake などが必要なので、適宜 apt install してください。
次に Bedrock サーバーを Minecraft 公式から落としてきます。
https://www.minecraft.net/ja-jp/download/server/bedrock
(2025-05-16 現在のバージョンは 1.21.81.2)
$ wget https://www.minecraft.net/bedrockdedicatedserver/bin-linux/bedrock-server-1.21.81.2.zip
Resolving www.minecraft.net (www.minecraft.net)... 23.56.0.142, 23.56.0.141
Connecting to www.minecraft.net (www.minecraft.net)|23.56.0.142|:443... connected.
HTTP request sent, awaiting response...wget だとレスポンスが返ってきませんね。 curl でも試してみます。
$ curl -LO https://www.minecraft.net/bedrockdedicatedserver/bin-linux/bedrock-server-1.21.81.2.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (92) HTTP/2 stream 1 was not closed cleanly: INTERNAL_ERROR (err 2)だめなようです。なのでここは User-Agent を付与 (偽装) してしまいましょう。
$ curl -LO https://www.minecraft.net/bedrockdedicatedserver/bin-linux/bedrock-server-1.21.81.2.zip -A
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 64.1M 100 64.1M 0 0 137M 0 --:--:-- --:--:-- --:--:-- 138M無事にダウンロードできたようなので、 unzip して、起動してみます。
$ LD_LIBRARY_PATH=. ./bedrock_server
[BOX64] Box64 arm64 v0.3.5 d7538334 with Dynarec built on May 16 2025 04:32:44
[BOX64] Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS SHA1 SHA2
[BOX64] Running on Neoverse-N1 with 1 core, pagesize: 4096
[BOX64] Will use hardware counter measured at 25.0 MHz emulating 3.2 GHz
[BOX64] Detected 48bits at least of address space
[BOX64] Counted 19 Env var
[BOX64] Library search path:
[BOX64] Binary search path: ./:bin/:/usr/local/sbin/:/usr/local/bin/:/usr/sbin/:/usr/bin/:/sbin/:/bin/:/usr/games/:/usr/local/games/:/snap/bin/
[BOX64] Looking for ./bedrock_server
[BOX64] Rename process to "bedrock_server"
[BOX64] Using native(wrapped) libcurl.so.4
[BOX64] Using native(wrapped) libdl.so.2
[BOX64] Using native(wrapped) libm.so.6
[BOX64] Using emulated /usr/lib/box64-x86_64-linux-gnu/libgcc_s.so.1
[BOX64] Using native(wrapped) libpthread.so.0
[BOX64] Using native(wrapped) libc.so.6
[BOX64] Using native(wrapped) ld-linux-x86-64.so.2
[BOX64] Using native(wrapped) libutil.so.1
[BOX64] Using native(wrapped) librt.so.1
[BOX64] Using native(wrapped) libbsd.so.0
NO LOG FILE! - setting up server logging...
[2025-05-16 05:07:32:311 INFO] Server started.すんなり起動してしまいました。
3 年前に試したときは、 libssl.so.1.1 が見つからないというエラーがでていたのですが、
Bedrock サーバーがそれを必要としなくなったのか、
Box64 が適切に wrap できるようになったのか不明ですが、
追加の手順がなくなったのでよしとします。
OCI の Ubuntu は iptables でほとんどのポートが閉じているので、
コンソールから Ingress ルールを設定しただけでは繋がりません。
$ sudo iptables -I INPUT 5 -p udp --dport 19132 -j ACCEPT
$ sudo /etc/init.d/netfilter-persistent save
$ sudo /etc/init.d/netfilter-persistent reloadこれでポートが開きました。クライアントから接続を試してみてください。
Java Edition (PaperMC) + GeyserMC/Floodgateでクロスプレイを実現する
必要なもの
- Paper ( https://papermc.io/ )
- Spigot 互換のプラグインサーバー、なんだかんだで軽いです
- さらにフォークしてパフォーマンスを改善したらしい Purpur などもありますが、
多種プラグインのサポートなどを考慮すると Paper のほうが無難です
- Geyser ( https://geysermc.org/ )
- Java Edition のサーバーで Bedrock クライアントから接続できるようにするプラグイン
- Floodgate ( https://geysermc.org/wiki/floodgate/ )
- Bedrock のアカウントのみで接続できるようにするプラグイン
- ViaVersion (https://viaversion.com/)
- 新しいバージョンのクライアントで古いバージョンのサーバーに接続するためのプラグイン
PaperMC のインストール
インストールといってもダウンロードしてきて起動するだけです。
https://papermc.io/downloads/paper普通に wget でダウンロードできます。 (2025-05-17 現在のバージョンは 1.21.4 Build #230)
一応 paper.jar として保存します。
$ wget https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/230/downloads/paper-1.21.4-230.jar -O paper.jar
--2025-05-17 07:35:48-- https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/230/downloads/paper-1.21.4-230.jar
Resolving api.papermc.io (api.papermc.io)... 104.18.19.103, 104.18.18.103, 2606:4700::6812:1367, ...
Connecting to api.papermc.io (api.papermc.io)|104.18.19.103|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 51441115 (49M) [application/java-archive]
Saving to: ‘paper.jar’
paper.jar 100%[=================================================>] 49.06M 210MB/s in 0.2s
2025-05-17 07:35:48 (210 MB/s) - ‘paper.jar’ saved [51441115/51441115]ダウンロードしたらふつうに一旦起動して各種フォルダの生成、 Vanilla サーバーへのパッチします。
ただし、 eula.txt (サーバー利用許諾書) がないと怒られるので、先に作っておきます。
# eula.txt 作成
$ echo "eula=true" > eula.txt
# Paper 起動
$ java -jar paper.jar
Downloading mojang_1.21.4.jar
Applying patches
Starting org.bukkit.craftbukkit.Main
...
[07:46:04 INFO]: Done (80.790s)! For help, type "help"
[07:46:04 INFO]: *************************************************************************************
[07:46:04 INFO]: This is the first time you're starting this server.
[07:46:04 INFO]: It's recommended you read our 'Getting Started' documentation for guidance.
[07:46:04 INFO]: View this and more helpful information here: https://docs.papermc.io/paper/next-steps
[07:46:04 INFO]: *************************************************************************************起動したら、 Ctrl + C なり stop コマンドなりで中断しちゃって大丈夫です。
Geyser と Floodgate のダウンロード
https://geysermc.org/download?project=geyser
https://geysermc.org/download?project=floodgate
Spigot/Paper と書かれているものをダウンロードしますが、
コマンドラインからだとファイルにリダイレクトされないので、 curl を使います。
# プラグインディレクトリに移動
$ cd plugins/
# ダウンロード
$ curl -L https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/spigot -o Geyser-Spigot.jar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 18.2M 100 18.2M 0 0 20.3M 0 --:--:-- --:--:-- --:--:-- 20.3M
$ curl -L https://download.geysermc.org/v2/projects/floodgate/versions/latest/builds/latest/downloads/spigot -o floodgate-spigot.jar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 10.9M 100 10.9M 0 0 46.5M 0 --:--:-- --:--:-- --:--:-- 46.5Mそうしたら、一旦ディレクトリを戻ってまた Paper を起動します。
# とりあえず戻る
cd ../
# Paper 起動
$ java -jar paper.jar
Starting org.bukkit.craftbukkit.Main
...
[08:10:56 INFO]: [PluginInitializerManager] Initializing plugins...
[08:10:57 INFO]: [PluginRemapper] Remapping plugin 'plugins/floodgate-spigot.jar'...
[08:11:06 INFO]: [PluginRemapper] Done remapping plugin 'plugins/floodgate-spigot.jar' in 9323ms.
[08:11:07 INFO]: [PluginInitializerManager] Initialized 2 plugins
[08:11:07 INFO]: [PluginInitializerManager] Bukkit plugins (2):
- Geyser-Spigot (2.7.1-SNAPSHOT), floodgate (2.2.4-SNAPSHOT (b116-0e3163c))
...
[08:11:27 INFO]: [floodgate] Loading server plugin floodgate v2.2.4-SNAPSHOT (b116-0e3163c)
[08:11:30 WARN]: [floodgate] en_ is not a supported Floodgate language.
[08:11:31 INFO]: [floodgate] Took 3,402ms to boot Floodgate
[08:11:31 INFO]: [Geyser-Spigot] Loading server plugin Geyser-Spigot v2.7.1-SNAPSHOT
[08:11:33 INFO]: [Geyser-Spigot] Loading extensions...
[08:11:33 INFO]: [Geyser-Spigot] Loaded 0 extension(s)
...
[08:11:38 INFO]: [floodgate] Enabling floodgate v2.2.4-SNAPSHOT (b116-0e3163c)
...
[08:11:40 INFO]: [Geyser-Spigot] Enabling Geyser-Spigot v2.7.1-SNAPSHOT
[08:11:42 INFO]: [Geyser-Spigot] ******************************************
[08:11:42 INFO]: [Geyser-Spigot]
[08:11:42 INFO]: [Geyser-Spigot] Loading Geyser version 2.7.1-b832 (git-master-f616230)
[08:11:42 INFO]: [Geyser-Spigot]
[08:11:42 INFO]: [Geyser-Spigot] ******************************************
[08:11:59 INFO]: [Geyser-Spigot] Started Geyser on UDP port 19132
[08:11:59 WARN]: [Geyser-Spigot] Missing MC locale file: en_us
[08:11:59 INFO]: [Geyser-Spigot] Downloading Minecraft JAR to extract required files, please wait... (this may take some time depending on the speed of your internet connection)
[08:11:59 INFO]: [Geyser-Spigot] Done (17.191s)! Run /geyser help for help!
[08:11:59 WARN]: [Geyser-Spigot] Your server software does not support the Java version that Geyser requires (1.21.5). Please install ViaVersion (https://ci.viaversion.com/job/ViaVersion/) or update your server software!
...
[08:11:59 INFO]: Done (66.200s)! For help, type "help"
[08:12:01 INFO]: [Geyser-Spigot] Minecraft JAR has been successfully downloaded and loaded!地味になんか怒られていますね。
これは Geyser が要求しているバージョンと Paper のバージョンが違うことが違うという意味です。
ViaVersion もダウンロードしましょう。
# プラグインディレクトリに移動
$ cd plugins/
# ダウンロード
$ curl -L https://hangar.papermc.io/ViaVersion/ViaVersion/versions -o ViaVersion.jar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 124k 0 124k 0 0 59739 0 --:--:-- 0:00:02 --:--:-- 59750これで warning がでないようになるはずです。
初期設定
さきほど Geyser を読み込んだ際に、 config.yml ファイルが作成されています。
Geyser と floodgate をつなぐため、
その中にある auth-type: online を auth-type: floodgate に書き換えます。
適宜 vim や nano などを使ってください。
# Geyser-Spigot ディレクトリに移動
$ cd Geyser-Spigot/
# 書き換え
$ vi config.yml
# Authentication type. Can be offline, online, or floodgate (see https://github.com/GeyserMC/Geyser/wiki/Floodgate).
# For plugin versions, it's recommended to keep the `address` field to "auto" so Floodgate support is automatically configured.
# If Floodgate is installed and `address:` is set to "auto", then "auth-type: floodgate" will automatically be used.
auth-type: floodgateこれで最低限の設定は完了です。
接続できる最大人数や motd なども server.properties や config.yml で設定できます。
適宜調べていろいろ試してみてください。
ポートを開放する
デフォルトポートは Java が 25565 (TCP), Bedrock が 19132 (UDP) です。
iptables を使ってください。
$ sudo iptables -I INPUT 5 -p tcp --dport 25565 -j ACCEPT
$ sudo iptables -I INPUT 5 -p udp --dport 19132 -j ACCEPT
$ sudo /etc/init.d/netfilter-persistent save
$ sudo /etc/init.d/netfilter-persistent reloadこれで、外部から接続できるようになるはずです。
起動スクリプトを用意する
下記のサイトで起動スクリプトが作成できます。
https://flags.sh/メモリ使用量の設定は VM 容量の 8 割程度に設定しましょう。
個人的には screen などを使っておくと常時起動しやすいと思います。
一応サンプルを貼っておきます。 ( start.sh / RAM 16GB のサーバー想定)
#!/usr/bin/env sh
screen -S minecraft -m -d java -Xms12G -Xmx12G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar paper.jar --nogui終わりに
これで、クロスプレイが実現できました。
ただし、ここまでやっておいてなんですが、
Xbox One, Switch, PS4/PS5 は特集サーバー以外に接続できませんので、
ちょっとしたトリックが必要です。 (DNS に BedrockConnect の設定が必要)
今回はとくに説明しませんが、適宜調べてみてください。
OCI で公開したサーバーはサーバースキャナーに引っかかりやすく、
放っておくと荒らしやよくわからない bot なども接続してきます。
身内で遊ぶならホワイトリスト運用にするのがオススメです。
それでは、よき Minecraft ライフをお過ごしください。
(インストールスクリプトでも用意しとけばよかったのですが、またの機会に…。)