Atlantic.Net Blog

How to Set up a Minecraft Server on CentOS 6.7

Atlantic.Net NOC
by Atlantic.Net (68posts) under VPS Hosting
Verified and Tested 02/04/2015


This guide will walk you through setting up a Minecraft (version 1.8.1) server on CentOS6.7 64bit with nifty startup and shutdown scripts for easy management.


A CentOS 6.7 64-bit server, if you do not have a server then spin up a super fast Minecraft server today!

Setting up a Minecraft Server on CentOS 6.7

First, we install our prerequisite software:

yum install nano java-1.8.0-openjdk screen wget -y

Now, we create and enter the directory that the server will reside in:

mkdir /Minecraft cd /Minecraft/

Next, we download the actual Minecraft server application and make it executable:

chmod +x minecraft_server*.jar

Agree to the EULA that you definitely read:

echo 'eula=true' > eula.txt

The next steps are to create a handy script that allows us to start the server without remembering any arbitrary Java or screen CLI syntax:

echo 'cd /Minecraft' > /usr/bin/startcraft
echo '/usr/bin/screen -d -m sh -c "/usr/bin/java -Xmx768M -Xms768M -jar /Minecraft/minecraft_server.1.8.1.jar nogui"' >> /usr/bin/startcraft

Depending on the size of the server, you may want to adjust the “Xmx” and “Xms” values. These are the amount of RAM allocated to the Minecraft server instance. Mojang recommends 1GB of dedicated RAM, but you can get away with less if there will be very few people on at once.
If you end up upgrading the server in the future, or just wish to change the value after following this tutorial, simply use “nano” to edit the startcraft command:

nano /usr/bin/startcraft

Now we make “startcraft” executable:

chmod +x /usr/bin/startcraft

Now let’s test that this half of the setup is working:

screen –r
Sample Output

Sample Output

You should now see some text detailing that the server is starting/has started. Use Control + A then D to detach from the screen.

For the final step of the basic setup, we open up the default Minecraft port on the firewall:

iptables -I INPUT 1 -p tcp -m tcp --dport 25565 -j ACCEPT iptables-save > /etc/sysconfig/iptables

To stop the server process gracefully, we would need to enter the screen session:

screen –r

Although we are not at a prompt, we can still type Minecraft server commands here (/give, /op, etc). The command to stop the server is simply “stop.” When it has completed the shutdown process, the screen session will terminate. To run the server once again, just type “startcraft

Alternatively, we can setup a simple script to inject the “stop” command into the screen session:

echo 'screen -p 0 -X stuff "stop$(printf \\r)"' > /usr/bin/stopcraft chmod +x /usr/bin/stopcraft

To stop the server now, simply run “stopcraft” anytime:


Now you can start and stop the server with single commands without ever having to type out java stuff or jump into screen!

Don’t forget to give your username OP status. This can be done without touching screen with the following command:

screen -p 0 -X stuff "op USERNAME$(printf \\r)"

Replace “USERNAME” with your username.
Once you have it, you can perform any commands including /op while in-game. Depending on the circumstances, you may need to log into the server in the Minecraft game before you can OP yourself.

If you wish to have the “startcraft” script run when the server starts, simply run this command:

echo '/usr/bin/startcraft' >> /etc/rc.d/rc.local

The next step you will likely want to take is to point a DNS record to your server’s IP for easy connecting/distribution. You can read about using our cloud DNS manager here:

Finished! This page details all of the options you can modify in your “/Minecraft/” file:

Happy crafting! Be sure to contact us for all of your VPS hosting needs!

Get A Free To Use Cloud VPS

Free Tier Includes:
G2.1GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year

Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G2.1GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year

New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4


London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom