0
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?

はじめに

マイクラ教育版(Minecraft Education)のサーバー版のLinuxで設定してみた記録です。

管理画面での作業手順

まずは管理画面(MS側)の設定から。ここを先にやっておく。

1. 管理画面にログインする
まずはブラウザを開いて、Minecraft Education Dedicated Servers にアクセスする。ここで学校とかの組織の管理者アカウント(MSアカウント)を使ってログインする。
image.png

2. ADD Serverでサーバーを作成する
ログインしたら画面にある「ADD Server」ってボタンを押す。ここでこれから作るサーバーの器(登録情報)を事前に作成しておく。
image.png
グローバルIPとポート番号を入力する。デフォルトから変えたほうがセキュリティ面では良いらしい。
image.png
ゲームモードを設定。シードは空欄でもOK。あとからファイルを変更するのでそのままでダウンロード。Configured Linux ServerもしくはFile Only。前者はサーバの実行ファイルと設定ファイル。後者は設定フィあるのみ

image.png
サーバ名の設定、パスコード(接続時に入力するコード。)の設定。
Enabledをオンにする
image.png

サーバーマシンの構築手順

次はマイクラを動かすLinux(Ubuntuとか)のサーバー側。

1. サーバーファイルのダウンロード
Linux用のサーバーバイナリ(https://aka.ms/downloadmee-linuxserver)をwgetとかでサーバーでダウンロードする

ちなみにWindows用(https://aka.ms/downloadmee-winserver)はこちら。

2. 圧縮ファイルを展開して配置
落としてきたzipファイルを解凍して、今回は構成管理がしやすいように /opt/minecraft-ee ディレクトリを作ってから展開。
ここに、サーバの本体と、設定ファイルを格納。

3. server.propertiesの設定
server-public-ipがGlobalIPであること
server-portを19132を確認。
level-nameを自分データのディレクトリ名

4. FW(ファイアウォール)の穴あけ。
外からのアクセスを許可するために、さっき決めたポート番号を iptables で開放する。

sudo iptables -I INPUT 1 -p udp --dport 19132 -j ACCEPT
sudo iptables -I INPUT 1 -p tcp --dport 19132 -j ACCEPT

最後まで動いたら、

5. Worldデータの差し替え
もし自分で作った自前のワールド(ステージ)で遊ばせたいなら、そのワールドデータをサーバー内の worlds ディレクトリの中に上書き保存して差し替えておく。
規定値がここなので、横に別のディレクトリを作るのもOK。その場合は設定ファイルのlevel-nameも一緒に変更する

/opt/minecraft-ee/worlds/Bedrock level/

6. 設定ファイルの最終変更と初期認証
ここで一度、手動で ./bedrock_server_edu を実行して、画面に出る指示に従ってブラウザでデバイス認証(コード入力)を終わらせる。これで /opt/minecraft-ee/edu_server_session.json が生成され準備が整う。

7. 自動起動の設定(systemd)
マシンの再起動時に勝手に裏で動くように、/etc/systemd/system/mc-edu.service を作ってデーモン化する。

[Unit]
Description=Minecraft Education Server
After=network.target

[Service]
User=minecraft
WorkingDirectory=/opt/minecraft-ee
ExecStart=/opt/minecraft-ee/bedrock_server_edu
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

作ったら sudo systemctl daemon-reload して、sudo systemctl enable --now mc-edu.service で自動起動を有効化&スタートさせる。

・まとめ
ここまで手順通りにやれば、Linuxサーバーが裏で常駐しつつ、マイクロソフトの管理画面(Webポータル)からサーバーのOnOffや設定のコントロールがポチポチ連動できるようになる。
バックアップやら運用管理は次回。

0
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
0
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?