142 lines
4 KiB
HTML
142 lines
4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en-US">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="author" content="Aleksei Savin" />
|
|
<meta
|
|
name="description"
|
|
content="Guide how to install the Minecraft server on Debian-based Linux
|
|
distribution."
|
|
/>
|
|
<meta name="keywords" content="minecraft,linux" />
|
|
<meta name="viewport" content="width=device-width" />
|
|
<title>Minecraft Server Installation</title>
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<h1>Minecraft Server Installation</h1>
|
|
|
|
<p>
|
|
This page is a guide how to install the Minecraft server on Debian-based
|
|
Linux distribution.
|
|
</p>
|
|
|
|
<p>
|
|
The steps in this guide are only prompts to the desired result, do not
|
|
follow them stupid and read manuals before do something.
|
|
</p>
|
|
|
|
<h2>Network setup</h2>
|
|
|
|
<p>Open the 25565/TCP port on your router to connect to your server.</p>
|
|
|
|
<h2>Server setup</h2>
|
|
|
|
<p>Create a Minecraft user:</p>
|
|
<code># adduser --system --group minecraft-server</code>
|
|
<p>
|
|
This is a system user, it means that you will not have remote access.
|
|
</p>
|
|
|
|
<p>
|
|
Add the non-root user to the <i>minecraft</i> group to access the server
|
|
files:
|
|
</p>
|
|
<code># adduser $username minecraft-server</code>
|
|
|
|
<p>Create a server directory and change owner and group permissions:</p>
|
|
<pre><code># mkdir /srv/minecraft-server
|
|
# chown minecraft-server:minecraft-server /srv/minecraft-server
|
|
# chmod 770 /srv/minecraft-server</code></pre>
|
|
|
|
<h2>Install Oracle JDK</h2>
|
|
|
|
<p>
|
|
Download the latest version JDK <i>package.deb</i> from
|
|
<a href="https://www.oracle.com/java/technologies/downloads/"
|
|
>Oracle official website</a
|
|
>.
|
|
</p>
|
|
|
|
<p>
|
|
Then install it <i>dpkg</i> package management tool (replace X character
|
|
to your version number).
|
|
</p>
|
|
<code># dpkg -i ./jdk-X_linux-x64_bin.deb</code>
|
|
|
|
<h2>Download server</h2>
|
|
|
|
<p>
|
|
Download the <i>server.jar</i> from
|
|
<a href="https://www.minecraft.net/en-us/download/server"
|
|
>Minecraft official website</a
|
|
>
|
|
or another server platform and put in
|
|
<code>/srv/minecraft-server</code> directory.
|
|
</p>
|
|
|
|
<h2>Create systemd service</h2>
|
|
|
|
<p>
|
|
Copy this systemd service file as
|
|
<i>/etc/systemd/system/minecraft-server.service</i>:
|
|
</p>
|
|
<pre><code>[Unit]
|
|
Description=Minecraft Server
|
|
|
|
[Service]
|
|
WorkingDirectory=/srv/minecraft-server
|
|
User=minecraft-server
|
|
Group=minecraft-server
|
|
Restart=on-failure
|
|
RestartSec=60
|
|
ExecStart=/usr/bin/java -Xmx2G -jar server.jar --nogui
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target</code></pre>
|
|
|
|
<p>Restart the systemd daemon and check errors:</p>
|
|
<code># systemctl daemon-reload</code>
|
|
|
|
<p>Enable (autorun) and start service:</p>
|
|
<code># systemctl enable --now minecraft-server.service</code>
|
|
|
|
<p>Agree with Minecraft End(er)-User License Agreement ("EULA"):</p>
|
|
<code>$ echo "eula=true" > eula.txt</code>
|
|
|
|
<h2>Change server configuration</h2>
|
|
|
|
<p>Edit <i>server.properties</i> file in server directory:</p>
|
|
<code>$ vim server.properties</code>
|
|
|
|
<p>Enable server remote control and set <i>*your_password*</i>:</p>
|
|
<pre><code>enable-rcon=true
|
|
rcon.password=*your_password*</code></pre>
|
|
|
|
<p>Enable server whitelist:</p>
|
|
<code>white-list=true</code>
|
|
|
|
<p>Restart the server:</p>
|
|
<code># systemctl restart minecraft-server.service</code>
|
|
|
|
<h2>Remote control</h2>
|
|
|
|
<p>
|
|
Install
|
|
<a href="https://tracker.debian.org/pkg/python-rcon">RCON client</a>
|
|
</p>
|
|
<code># apt install rcon</code>
|
|
|
|
<p>Connect to server locally:</p>
|
|
<code>$ rconshell localhost:25575</code>
|
|
|
|
<p>Or from remote-machine:</p>
|
|
<code>$ ssh remote-machine rconshell localhost:25575</code>
|
|
|
|
<p>
|
|
Do not open RCON port to remote server control. Instead use RCON
|
|
connection under SSH.
|
|
</p>
|
|
</main>
|
|
</body>
|
|
</html>
|