我完全按照指南操作地点在我的 Ubuntu Server 20.04 系统上安装 Minecraft 服务器,使用以下命令得到以下输出:
owner@mk-dell-t110:~$ sudo systemctl start minecraft@survival
owner@mk-dell-t110:~$ sudo systemctl status minecraft@survival
● [email protected] - Minecraft Server: survival
Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2021-09-26 04:46:11 UTC; 23s ago
Process: 583600 ExecStart=/usr/bin/screen -DmS mc-survival /usr/bin/java -Xmx4G -jar minecraft_server.jar nogui (code=exited, status=0/SUCCE>
Process: 583619 ExecStop=/usr/bin/screen -p 0 -S mc-survival -X eval stuff "say SERVER SHUTTING DOWN IN 5 SECONDS. SAVING ALL MAPS..."^M (co>
Main PID: 583600 (code=exited, status=0/SUCCESS)
Sep 26 04:46:11 mk-dell-t110 systemd[1]: [email protected]: Scheduled restart job, restart counter is at 5.
Sep 26 04:46:11 mk-dell-t110 systemd[1]: Stopped Minecraft Server: survival.
Sep 26 04:46:11 mk-dell-t110 systemd[1]: [email protected]: Start request repeated too quickly.
Sep 26 04:46:11 mk-dell-t110 systemd[1]: [email protected]: Failed with result 'exit-code'.
Sep 26 04:46:11 mk-dell-t110 systemd[1]: Failed to start Minecraft Server: survival.
owner@mk-dell-t110:~$ journalctl -u [email protected]
-- Logs begin at Thu 2021-09-23 21:52:02 UTC, end at Sun 2021-09-26 04:46:37 UTC. --
Sep 26 00:25:48 mk-dell-t110 systemd[1]: Started Minecraft Server: survival.
Sep 26 00:25:48 mk-dell-t110 screen[558000]: No screen session found.
Sep 26 00:25:48 mk-dell-t110 systemd[1]: [email protected]: Control process exited, code=exited, status=1/FAILURE
Sep 26 00:25:48 mk-dell-t110 systemd[1]: [email protected]: Failed with result 'exit-code'.
Sep 26 00:25:48 mk-dell-t110 systemd[1]: [email protected]: Scheduled restart job, restart counter is at 1.
Sep 26 00:25:48 mk-dell-t110 systemd[1]: Stopped Minecraft Server: survival.
Sep 26 00:25:48 mk-dell-t110 systemd[1]: Started Minecraft Server: survival.
Sep 26 00:25:48 mk-dell-t110 screen[558027]: No screen session found.
Sep 26 00:25:48 mk-dell-t110 systemd[1]: [email protected]: Control process exited, code=exited, status=1/FAILURE
Sep 26 00:25:48 mk-dell-t110 systemd[1]: [email protected]: Failed with result 'exit-code'.
Sep 26 00:25:49 mk-dell-t110 systemd[1]: [email protected]: Scheduled restart job, restart counter is at 2.
Sep 26 00:25:49 mk-dell-t110 systemd[1]: Stopped Minecraft Server: survival.
Sep 26 00:25:49 mk-dell-t110 systemd[1]: Started Minecraft Server: survival.
Sep 26 00:25:49 mk-dell-t110 screen[558049]: No screen session found.
Sep 26 00:25:49 mk-dell-t110 systemd[1]: [email protected]: Control process exited, code=exited, status=1/FAILURE
Sep 26 00:25:49 mk-dell-t110 systemd[1]: [email protected]: Failed with result 'exit-code'.
Sep 26 00:25:49 mk-dell-t110 systemd[1]: [email protected]: Scheduled restart job, restart counter is at 3.
Sep 26 00:25:49 mk-dell-t110 systemd[1]: Stopped Minecraft Server: survival.
Sep 26 00:25:49 mk-dell-t110 systemd[1]: Started Minecraft Server: survival.
Sep 26 00:25:49 mk-dell-t110 screen[558072]: No screen session found.
Sep 26 00:25:49 mk-dell-t110 systemd[1]: [email protected]: Control process exited, code=exited, status=1/FAILURE
Sep 26 00:25:49 mk-dell-t110 systemd[1]: [email protected]: Failed with result 'exit-code'.
owner@mk-dell-t110:~$
我是 Ubuntu Server 的新手,所以如果这对诊断错误没有太大帮助,我深表歉意。就像我说的,我完全按照链接的指南操作,直到标有“在同一主机上配置新的 Minecraft 服务器实例”的部分。目前我只想要一个 Minecraft 服务器。
更新:我刚刚尝试使用命令手动运行服务器java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
,这是输出:
owner@mk-dell-t110:/opt/minecraft/survival$ ls
eula.txt minecraft_server.jar
owner@mk-dell-t110:/opt/minecraft/survival$ java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
Error: LinkageError occurred while loading main class net.minecraft.server.Main
java.lang.UnsupportedClassVersionError: net/minecraft/server/Main has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 55.0
owner@mk-dell-t110:/opt/minecraft/survival$
sudo apt install wget screen default-jdk nmap
在我尝试使用网站教程(之前链接在上面)中的命令检查以确保我已经安装了 Java 之后,我便遵循了这一步骤。
答案1
我使用 添加了 Java 存储库sudo add-apt-repository ppa:linuxuprising/java
,然后使用sudo apt-get update
,最后使用sudo apt install openjdk-17-jdk
获取最新版本的 Java。然后我继续运行服务器,状态显示它正在运行。我也能够从我的 Minecraft 客户端进行连接。