minecraft
my directory location is /home/mysqli/server/
Failed to verify user name
online-mode=true change to false in server.properties
sudo useradd -r -m -U -d /opt/mysqli -s /bin/bash mysqli
iptables -I INPUT -p tcp --dport 25565 --syn -j ACCEPT
/etc/systemd/system
vi minecraft.service
systemctl start minecraft.service
systemctl status minecraft.service
[Unit]
Description=Minecraft Server
After=network.target
[Service]
User=mysqli
Nice=1
KillMode=none
SuccessExitStatus=0 1
ProtectHome=true
ProtectSystem=full
PrivateDevices=true
NoNewPrivileges=true
WorkingDirectory=/opt/minecraft/server
ExecStart=/usr/bin/java -Xmx4024M -Xms4024M -jar server.jar nogui
ExecStop=/opt/minecraft/tools/mcrcon/mcrcon -H 127.0.0.1 -P 25575 -p bumkailash stop
[Install]
WantedBy=multi-user.target
Setup Instructions
1. Install Java
The first step is to make sure that we have Java installed. Minecraft requires Java 1.8 or higher, so we must verify the installed version using java -version.
[user@host ~]$ java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
If Java is not installed, or you have an older version, we can fix that by using the sudo yum command.
[user@host ~]$ java -version
-bash: java: command not found
[user@host ~]$ sudo yum install java
[...]
Installed:
java-1.8.0-openjdk.x86_64 1:1.8.0.292.b10-1.el7_9
2. Create a User
Next, we want to create a separate user with limited permissions for Minecraft. Creating a separate user with limited permissions is a security measure to prevent our VPS from being hacked even if the Minecraft server is compromised.
sudo useradd -r -m -U -d /opt/minecraft -s /bin/bash minecraft
- -r creates the user as a system account instead of a regular user.
- -m creates a home directory despite this being a system account.
- -U creates a group that matches this user.
- -d specifies the home directory for the user, in this case, /opt/minecraft.
- -s specifies the shell, in this case, /bin/bash.
3. Minecraft Server Setup
We will switch to the Minecraft user and start setting up the server by downloading the official Java edition server inside a new folder called server.
[user@host ~]$ sudo su - minecraft
[sudo] password for user:
[minecraft@host ~]$ mkdir server
[minecraft@host ~]$ cd server
[minecraft@host server]$ wget https://launcher.mojang.com/[...]/server.jar
4. Start the Server & Agree to the EULA Terms
When we have the server downloaded, we can start it for the first time with the following command.
[minecraft@host server]$ java -Xmx1024M -Xms512M -jar server.jar nogui
[00:02:27] [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
Now, we need to edit the eula.txt file to read and agree to the Mojang license terms. We can do that using the vim editor. With the file open:
- Press i to enter Insert mode.
- Change eula=true to eula=false.
- Press Escape to exit Insert mode.
- Type :wq to save your changes and exit the editor.
[minecraft@host server]$ vim eula.txt
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).
#Thu May 13 00:02:27 EDT 2021
eula=true
5. Ready to Play!
Now that the server is in place, we are ready to start playing. We will use the screen command to log out of the server while it still runs.
[minecraft@host server]$ screen
This will give us a new terminal window where we can then start the server.
[minecraft@host server]$ java -Xmx1024M -Xms1024M -jar /opt/minecraft/server/server.jar nogui
And we are done! The server will automatically generate a new random world, and when it’s done booting up, we can join the server by using the direct IP address or any domain name that we have on the VPS.
OWNLOAD THE MINECRAFT: JAVA EDITION SERVER
Want to set up a multiplayer server?
Please note: This server setup is only compatible with Minecraft: Java Edition.
If you want to run a Minecraft multiplayer server by yourself things get kind of involved (see this wiki article for a tutorial). First make sure you can use java from the command line. On Linux and macOS this should already be set up but on Windows you might have to tinker with the PATH environment variable.
Download minecraft_server.1.18.2.jar and run it with the following command:
java -Xmx1024M -Xms1024M -jar minecraft_server.1.18.2.jar nogui
Should you want to start the server with its graphical user interface you can leave out the "nogui" part.
Just so you know, by downloading any of the software on this page, you agree to
Cannot invoke "adw.p_()" because "$$5" is null
sudo yum install java-17-openjdk
sudo update-alternatives --config 'java'choose number 3 as per openjdk 17
Comments
Post a Comment