How to set up a Minecraft Server on CentOS 7.x
You may find yourself in a confusing world on your new VPS and all you want to do is set up a Minecraft Server. This will show you the easy steps of how to do this.
Setting up your Dependencies
It might seem daunting sitting at an SSH not knowing what to type. but its quite simple once you have your dependencies installed.
You need to Update your Server
sudo yum update
Installing screen
sudo yum install screen -y
Installing nano
sudo yum install nano -y
Installing OpenJDK 8 JRE
sudo yum install java-1.8.0-openjdk -y
Congratulations! You have installed your dependencies.
Installing Minecraft
Setting up the folder
mkdir server
cd server
Login to your server via SFTP and upload your Minecraft JAR file into the server folder created
Creating a screen. You can replace Minecraft with any name you want for your server.
screen -S Minecraft
Creating a Start Command
nano start.sh
Pase the following line into the nano.sh file. Replace minecraft.jar with the name of the JAR file that you uploaded
java -Xms1024M -Xmx1024M -jar minecraft.jar
You can also replace 1024 with the amount of RAM you want to allocate to your Minecraft server. This should be less than the total amount of RAM on your VPS
Then type the following key combinations into your SSH Control+x Then hit y Finally hit Enter
Now you need to allow the script to run so enter the following command
chmod +x start.sh
Finally, run the following command to start your server
./start.sh
Now your Minecraft server will start up. If you want to quit out of the SSH client and leave the server running in the background you can detach from the screen by pressing Control+a+d
To Reattach to your Minecraft Server Screen you can type screen -x Minecraft or the name of your screen.