Installing MineCraft Server on CentOS 7 with Oracle Java 8


  • Service Provider

    Minecraft Server is a Java-based server for the MineCraft full client (as used on PCs.) In this "how to" we are going to get MineCraft set up to run as a service on CentOS 7.

    I started this project with a minimal CentOS 7 template on a Scale HC3 cluster. In addition to the basic install, only firewalld and sysstat were added to the basic image. The image was fully updated as of the time of this writing.

    0_1453139891184_mc.png

    Because Minecraft requires Java, and Java is not installed by default, we need to download that to our server. Minecraft wants Oracle Java rather than the OpenJDK that ships with CentOS so we need to acquire this software separately, which is unfortunate. In this guide we have used the very latest Java 8 release which seems to be working well.

    You will need to go to the Oracle Java SE Download Page and follow the link for the Server JRE. You will want the latest patch level, which at this time is 8u66. Look for the Linux x64 download link. You will need to accept the license agreement in order to download.

    0_1453132098885_javaforlinux.png

    Chances are you will not be downloading Java directly to your server since it requires interaction to accept the agreement. So we assume that you will download it elsewhere them copy it to the /top directory. Then, we can do as root...

    firewall-cmd --zone=public --add-port=25565/tcp --permanent
    firewall-cmd --reload
    mkdir /usr/java
    cp /tmp/server-jre-8u66-linux.x64.tar.gz /usr/java/
    cd /usr/java
    tar -xzvf *
    

    You can test your Java installation with this command:

    $ /usr/java/jdk1.8.0_66/bin/java -version
    java version "1.8.0_66"
    Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
    Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
    

    The Minecraft server also needs to be downloaded. This we can do directly, however.

    mkdir /opt/minecraft
    cd /opt/minecraft
    yum -y install wget
    wget https://s3.amazonaws.com/Minecraft.Download/versions/1.8.9/minecraft_server.1.8.9.jar
    

    That's all that it takes for installation. Very simple. And now we can fire up the server:

    nohup /usr/java/jdk1.8.0_66/bin/java -Xmx1024M -Xms1024M -jar /opt/minecraft/minecraft_server.1.9.jar nogui &
    

    Of course you can pop this into your crontab with @reboot if you want to set it to start at boot time.

    At this point you should have a minimal running Minecraft server!

    If you want to add the ability to have the server start when the system reboots, then just add this line via crontab -e

    @reboot	cd /opt/minecraft; /usr/java/jdk1.8.0_66/bin/java -Xmx1024M -Xms1024M -jar ./minecraft_server.1.9.jar nogui
    

    0_1453388034637_awesome-minecraft-wallpapers-in-HD-1dut.com-6-1366x768.jpg



  • You can actually run Minecraft server with the OpenJDK project. I think it can be installed via the EPEL repo.


  • Service Provider

    @coliver said:

    You can actually run Minecraft server with the OpenJDK project. I think it can be installed via the EPEL repo.

    OpenJDK can be installed automatically, yes. Mojang recommends the Oracle Java platform for speed and stability, though.


  • Service Provider

    @scottalanmiller said:

    @coliver said:

    You can actually run Minecraft server with the OpenJDK project. I think it can be installed via the EPEL repo.

    OpenJDK can be installed automatically, yes. Mojang recommends the Oracle Java platform for speed and stability, though.

    I have had a server running with a standard yum install java with no issues.



  • @JaredBusch said:

    I have had a server running with a standard yum install java with no issues.

    Me too. @scottalanmiller did you remember to install and enable the firewall?


  • Service Provider

    @anonymous said:

    @JaredBusch said:

    I have had a server running with a standard yum install java with no issues.

    Me too. @scottalanmiller did you remember to install and enable the firewall?

    Did you look at the install info?


  • Service Provider

    Added the ability to have it automatically start when the system reboots.


  • Service Provider

    Time to update to the latest version...

    cd /opt/minecraft
    wget https://s3.amazonaws.com/Minecraft.Download/versions/1.9/minecraft_server.1.9.jar
    

    And then we have to change how it starts up to make sure that it is grabbing the current JAR file.

    I just use crontab for MineCraft to keep things simple. This is the only line that I need in the cron entries:

    @reboot cd /opt/minecraft; /usr/java/jdk1.8.0_66/bin/java -Xmx1024M -Xms1024M -jar ./minecraft_server.1.9.jar nogui

  • Service Provider

    Original post has been updated to reflect the latest 0.9 release of the Minecraft Server.



Looks like your connection to MangoLassi was lost, please wait while we try to reconnect.