This is a memo when I built the Java version of Minecraft server as it is on the ubuntu server I built last time. I will not write about Java tuning, so please check it separately ┏ (<:)
Since the memory size of "f1-micro" of AlwaysFree (free for a lifetime) is too small, I expanded it to "n1-standard-1" in advance.
Ssh to the server and switch to the root user.
su
After logging in as the root user, use the mkdir command to create a directory to install the server. Once created, move it with the cd command.
mkdir /mcjava
cd /mcjava
I thought I'd install a Minecraft server, but Java doesn't seem to be included, so let's install Java first.
apt install default-jre
When asked what the disk capacity is, type y (yes). This completes the Java installation.
Next is the installation of the Minecraft server. Find out the download URL in advance. [MINECRAFT]https://www.minecraft.net/ja-jp/download/server/
Copy the link and download it.
wget https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar
After downloading, start the server once. It should end with an error. There should be a text file called eula.txt in the directory where you downloaded the server, so open it and edit the contents. It is a file that asks whether or not you agree with the EULA (End User License Agreement), so if you agree, replace eula = false with eula = true.
eula=true
This completes the installation. I forgot. The Java version of the Minecraft server uses the tcp / 25565 port by default, so let's open the port in the firewall rule settings of GCP.
Move to the created directory and enter the command to start the server. You can create a dedicated user to start the server, but this time, start it as the root user. If the name of the downloaded file is "server.jar", start it with the following command.
cd /mcjava
java -Xmx1024M -Xms1024M -jar server.jar nogui
It will start up.
As an aside, the Java version of the Minecraft server starts on the Java virtual machine JVM, up to a preset amount of memory. So, just looking at the load on the ubuntu server doesn't tell you if Minecraft is working well. If you think that the number of people is increasing and you are running out of memory, try increasing the numbers of -Xmx and -Xms in the server startup command. Tuning is not discussed here.
Since it is the same as the integrated version, the explanation is omitted.
Since it is the same as the integrated version, the explanation is omitted.
I tried to set the whitelist together, but the specifications are a little different from the integrated version, so make a note of it. I was free to whitelist player names that didn't exist in the integrated version, but it seems that the Java version can't. Johniki Joestar2 could not be registered as below. So I decided to edit whitelist.json directly. There are more traps here as well. In the integrated whitelist, you can register whitelist.json if you know only the user's name, but in the Java version, uuid seems to be a required item. I intended to be an integrated version, so I was addicted to it for about 10 minutes. You can see the uuid by looking at the log on the server side, but there is no log of new users logging in from now on. However, Mojang provides a Mojang API to look up uuids.
[Mojang API] https://api.mojang.com/users/profiles/minecraft/JohnikiJoestar
{"id":"1f843a4609ae4715a3b062a522193fa0","name":"JohnikiJoestar"}
Now that you know Jonathan Joestar's uuid, whitelist it. The format of whitelist.json is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, so modify the id a little and edit the file.
[
{
"uuid": "1f843a46-09ae-4715-a3b0-62a522193fa0",
"name": "JohnikiJoestar"
}
]
If you edited the file directly, reload the whitelist.
whitelist reload
that's all. Right? It was easy, wasn't it? (I was addicted to it)
Recommended Posts