MINECRAFT is an open world video game developed in Java, originally created by Markus "Notch" Persson and maintained by Mojang AB. It is presently owned by Microsoft studios as well. This game involves players interacting within by placing and breaking various types of blocks in a three-dimensional environment. The players can even collect resources, build structures, battle mobs, manage hunger, explore the land simply, creates & destroys structures on both multiplayer servers and singleplayer worlds across multiple game modes. These are the six game modes available as below:
In this article, I'm discussing on how to setup a Minecraft server on a CentOS 7 build.
First of all, let me go through the installation requirements.
- VPS or Dedicated servers with SSH access
- RAM : 1GB or more
- Disk Space : 5GB or more
- Install the latest Java compatible with the OS architecture.
- Disable Selinux
Let us start with the installation procedures. We need to install the latest Java version for the server depending on its architecture.
Minecraft server requires the latest JAVA version to be installed and running.
root@server1 ~]#yum install java-1.6.0-openjdk
Package Arch Version Repository Size
java-1.6.0-openjdk x86_64 1:184.108.40.206-220.127.116.11.el7_2 updates 42 M
Installing for dependencies:
alsa-lib x86_64 1.0.28-2.el7 base 391 k
flac-libs x86_64 1.3.0-5.el7_1 base 169 k
fontconfig x86_64 2.10.95-7.el7 base 228 k
fontpackages-filesystem noarch 1.44-8.el7 base 9.9 k
giflib x86_64 4.1.6-9.el7 base 40 k
gsm x86_64 1.0.13-11.el7 base 30 k
javapackages-tools noarch 3.4.1-11.el7 base 73 k
libICE x86_64 1.0.9-2.el7 base 65 k
libSM x86_64 1.2.2-2.el7 base 39 k
libX11 x86_64 1.6.3-2.el7 base 605 k
libX11-common noarch 1.6.3-2.el7 base 162 k
libXau x86_64 1.0.8-2.1.el7 base 29 k
libXext x86_64 1.3.3-3.el7 base 39 k
libXi x86_64 1.7.4-2.el7 base 40 k
libXrender x86_64 0.9.8-2.1.el7 base 25 k
libXtst x86_64 1.2.2-2.1.el7 base 20 k
libasyncns x86_64 0.8-7.el7 base 26 k
libjpeg-turbo x86_64 1.2.90-5.el7 base 134 k
libogg x86_64 2:1.3.0-7.el7 base 24 k
libpng x86_64 2:1.5.13-7.el7_2 updates 213 k
libsndfile x86_64 1.0.25-10.el7 base 149 k
libvorbis x86_64 1:1.3.3-8.el7 base 204 k
libxcb x86_64 1.11-4.el7 base 189 k
libxslt x86_64 1.1.28-5.el7 base 242 k
pulseaudio-libs x86_64 6.0-7.el7 base 576 k
python-javapackages noarch 3.4.1-11.el7 base 31 k
python-lxml x86_64 3.2.1-4.el7 base 758 k
tzdata-java noarch 2016a-1.el7 updates 176 k
These many packages will be installed. Now we need to download the Minecraft server package from there website into the "minecraft" folder.
Create a MINECRAFT folder
Create a minecraft folder for the installation and other game files. It is always advised to run this executable inside a dedicated folder, as it creates several configuration files. This will make it more easier to organize and locate all the files.
root@server1 ~]#mkdir minecraft
[root@server1 ~]# cd minecraft
Download the Minecraft server jar file
Download the minecraft .jar file to the minecraft folder and modify the .jar file permissions to make it executable.
[root@server1 minecraft]# wget https://minecraft.net/download/minecraft_server.jar
--2016-03-09 07:28:39-- https://minecraft.net/download/minecraft_server.jar
Connecting to minecraft.net (minecraft.net)|18.104.22.168|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar [following] --2016-03-09 07:28:39-- https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
Resolving s3.amazonaws.com (s3.amazonaws.com)... 22.214.171.124
Connecting to s3.amazonaws.com (s3.amazonaws.com)|126.96.36.199|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2360903 (2.3M) [application/octet-stream] Saving to: ‘minecraft_server.jar’
100%[=====================================================================================================>] 23,60,903 84.3KB/s in 28s
2016-03-09 07:29:09 (81.7 KB/s) - ‘minecraft_server.jar’ saved [2360903/2360903] [root@server1 minecraft]# chmod +x minecraft_server.jar
Make sure Screen is installed in your server or else run this command to install screen for your server.
[root@server1 minecraft]# yum install screen
Run the Application
Now get into a screen session and run the minecraft .jar file as per the required resolution and hardware settings. Both the Java and the executable version can be run from the command line with extra parameters to configure depending on the memory, graphical interface, mode, architecture etc.
Depending on my server capability, I prefer to ran my Minecraft server on 512MB without graphical interface to lower the CPU and memory resource usages.
root@server1 minecraft]# java -Xmx512M -Xms512M -jar minecraft_server.jar nogui
The launching text will look like this:
2016-03-09 07:30:09 [INFO] Starting minecraft server version 1.5.2
2016-03-09 07:30:09 [WARNING] To start the server with more ram, launch it as "java -Xmx1024M -Xms1024M -jar minecraft_server.jar"
2016-03-09 07:30:09 [INFO] Loading properties
2016-03-09 07:30:09 [WARNING] server.properties does not exist
2016-03-09 07:30:09 [INFO] Generating new properties file
2016-03-09 07:30:09 [INFO] Default game type: SURVIVAL
2016-03-09 07:30:09 [INFO] Generating keypair
2016-03-09 07:30:09 [INFO] Starting Minecraft server on *:25565
2016-03-09 07:30:09 [WARNING] Failed to load operators list: java.io.FileNotFoundException: ./ops.txt (No such file or directory)
2016-03-09 07:30:09 [WARNING] Failed to load white-list: java.io.FileNotFoundException: ./white-list.txt (No such file or directory)
2016-03-09 07:30:09 [INFO] Preparing level "world"
2016-03-09 07:30:10 [INFO] Preparing start region for level 0
2016-03-09 07:30:11 [INFO] Preparing spawn area: 4%
2016-03-09 07:30:12 [INFO] Preparing spawn area: 9%
2016-03-09 07:30:13 [INFO] Preparing spawn area: 16%
2016-03-09 07:30:14 [INFO] Preparing spawn area: 24%
2016-03-09 07:30:15 [INFO] Preparing spawn area: 35%
2016-03-09 07:30:16 [INFO] Preparing spawn area: 45%
2016-03-09 07:30:17 [INFO] Preparing spawn area: 55%
2016-03-09 07:30:18 [INFO] Preparing spawn area: 61%
2016-03-09 07:30:19 [INFO] Preparing spawn area: 70%
2016-03-09 07:30:20 [INFO] Preparing spawn area: 78%
2016-03-09 07:30:21 [INFO] Preparing spawn area: 84%
2016-03-09 07:30:22 [INFO] Preparing spawn area: 95%
2016-03-09 07:30:23 [INFO] Done (13.396s)! For help, type "help" or "?"
You can get back to your normal screen by press ctrl +A +D
You can get back to the screen where Minecraft is running by using the screen resume command.
# screen -r (screenid)
You can even run this executable using 1GB memory or more depending on your server specifications. This is how we run for 1GB memory usage.
java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
Tip: If you want to spare more memory, you may set the -Xms parameter with a lower value, say:
java -Xms512M -Xmx1024M -jar minecraft_server.jar nogui
The parameter controls how much memory is reserved on startup. Your server will start with 512MB RAM and whenever it needs more memory it will allocate some until it reaches the allotted maximum value of 1GB.
Hurray!! Your Minecraft is all set and it should be running good. You can have your friends login to your server and start building.
You can have any number of players depending on your server resources. There is a software called Multicraft to manage your Minecraft servers. You can download this software from their official website and use it as a user friendly control Panel managing your MC servers.
I hope you enjoyed reading this article. I would recommend your valuable suggestions and comments on this.
Thank you and have a great day :)