How to Setup Free Minecraft Server Hosting on a PaaS


Minecraft server hosting for free - check it

Alright todays super duper post is going to show you how to run your own Minecraft server on an OpenShift gear. There is no big introduction to this one since I am assuming most people have heard about Minecraft (if not then you need to come out from under that rock you are stuck under).


  1. A small gear is only 512 megs of RAM and so that is not going to let you allow many people to connect (notice on the server Download page they are using 1024 megs of RAM). We tested with 2 people on the same server and it ran completely fine with no lag.

  2. At this time, OpenShift is primarily a HTTP server platform - we proxy HTTP calls but no other protocols. In addition, we only expose ports 80 (HTTP), 443 (HTTPS), and 22 (SSH) to the outside world from your gear. While we can start up Minecraft Server on any port we want (and tell the client to listen on that port), the Minecraft server and client do not talk HTTP so we can not proxy the calls. To get this to work we are going to have to SSH port-forward either from your laptop to the server or vice versa (both configurations are supported on OpenShift).

  3. You will need to install the OpenShift command line tools to do this. Go sign up for an account and then install the client tools on your laptop or desktop machine.

All set? Good, let's do this!

Server Set Up

1) Cd on your local machine to a dir where you want to create a local git repository.

cd git_repos

2) Create a DIY application. DIY applications are basically a blank cartridge on your gear that let you install any binary that will run on Fedora and RHEL.

rhc app create minecraft diy-0.1

3) Copy the ssh command from the output of the rhc command. At the end of the instructions you will see a long url that looks like:


Everything after the // to the .com is the address you are going to use with the SSH command. So in this example it would be

4) Go ahead and SSH into your gear in a terminal or command prompt and then cd to the data directory. To get SSH working on windows you will need to install PUTTY and Puttygen - we have all your documentation needs right here

cd diy-0.1/data/

5) Download the minecraft server to your data directory.


6) Now log out of your SSH session, using either '+d' or 'exit'

7) You now cd into the directory created on your local machine that represents the git source-code repository. The directory name should match the name of your application. Then cd into .openshift/action_hooks (.openshift\action_hooks on windows)

cd minecraft/.openshift/action_hooks/

8) Now we need to modify the start and stop hooks. Here is what you are going to make the to the file named 'start':

    open the file named 'start' with your favorite editor and paste in the follow contents.
nohup bash -c "exec 'java' '-jar' 'minecraft_server.jar' '-Xms256M' '-Xmx490M' '-nogui' &> ${OPENSHIFT_DIY_LOG_DIR}minecraft.log" &> /dev/null &  

then edit the file named stop and edit it to only have

killall java
exit 0

Both of these files are saved in an attachment to this blog post. You can just download them and unzip them into the correct location given aboves.

9) Send our changes up to the gear

git commit -am "adding action hooks"
git push

10) Check to make sure the server tried to start up and failed - this is actually a good sign.

cd diy-0.1/logs/

Then tail the minecraft.log file and you should see

2012-11-01 19:52:58 [INFO] Done (42.296s)! For help, type "help" or "?"
2012-11-01 19:53:06 [WARNING] Can't keep up! Did the system time change, or is the server overloaded?
2012-11-01 19:53:23 [WARNING] Can't keep up! Did the system time change, or is the server overloaded?

This is what we want to see. It means the server started but couldn't bind to it's default port which is as expected. If you don't see those lines then please go back out to the command line on your local machine and do

rhc app force-stop

The other side effect is this now created a file in diy-0.1/data. We need to edit this so that the minecraft server binds to the right ports.

cd diy-0.1/data/

We are going to need to get the IP and port for our DIY cartridge. We can get these from the environment variables

env | grep INTERNAL

The output gives us is the IP address and port we need to bind to the Minecraft server. In my case it is


Now edit with your favorite text editor. I like to stay out of religious wars but vi seemed to work well for me.


change two lines in the file. Server-port needs to be changed to the value given above (8080)


and server-ip needs to be filled in with the IP address from above


Go ahead and save and exit the file. Now go back to the command line on your local machine and restart by typing -d or exit. Then restart the gear

rhc app start -a minecraft
Password: **********

Now ssh back into the gear and look at the log file again

cd diy-0.1/logs/
less minecraft.log

And it should look something like this

208 recipes
27 achievements
2012-11-01 21:06:07 [INFO] Starting minecraft server version 1.4.2
2012-11-01 21:06:07 [INFO] Loading properties
2012-11-01 21:06:07 [INFO] Default game type: SURVIVAL
2012-11-01 21:06:07 [INFO] Generating keypair
2012-11-01 21:06:10 [INFO] Starting Minecraft server on
2012-11-01 21:06:11 [INFO] Preparing level "world"
2012-11-01 21:06:11 [INFO] Preparing start region for level 0
2012-11-01 21:06:13 [INFO] Preparing spawn area: 3%
2012-11-01 21:06:14 [INFO] Preparing spawn area: 11%
2012-11-01 21:06:15 [INFO] Preparing spawn area: 24%
2012-11-01 21:06:16 [INFO] Preparing spawn area: 45%
2012-11-01 21:06:17 [INFO] Preparing spawn area: 81%
2012-11-01 21:06:17 [INFO] Done (6.702s)! For help, type "help" or "?"

ignore the warnings at the end this time - the important line is where it says it is starting up the server. As long as those match the IP address and port from before we should be good.

We now have our minecraft server running! Time to get our client machine ready to connect to it.

Getting the client machine connected to the Minecraft server

As I mentioned in the beginnng of this post - we will not be able to connect our local machine with the Minecraft client to the Minecraft server because of port-forwarding issues. But never fear - we can SSH tunnel into our gear and port-forward any outgoing network connections from our local machine to on port 8080 to the OpenShift gear. There is plenty of information about SSH port-forwarding also referred to as SSH tunneling. We are going to be using local forwarding, not remote forwarding.

If you installed the client tools to this then life is easy for you (though a little more work on a Mac). We have a blog post, an external blog post, and documentation that talk all about SSH port forwarding using the command line tools. Mac users (such as myself), because Mac OS is based off of BSD, you need to do a little more work to get this all going. Please be sure to read the documentation which explains nicely how to set this up on mac. Since I am on mac I am going to give those instructions here. For other systems you just need to run the RHC command.

1) Mac Only First you will need the IP address from the section where we installed the server. Then you put that into your ifconfig command on your local terminal

sudo ifconfig lo0 alias
(hint - the password here is the password for the account on your Mac)

2) Now you run the RHC command (I am using the newer syntax). Be aware that this will now tie up this terminal with the port forwarding

rhc port-forward -a minecraft
Password: **********

Checking available ports...
Binding java ->
Forwarding ports, use ctl + c to stop

Notice how it picked up the 8080 port which we are using for Minecraft server.

Normal SSH port forwarding

You could also do this with straight port forwarding not using the RHC command but that is a bit more involved. Read here to get some idea on how you would set that up with SSH for linux, mac, and Putty on Windows.

Connecting your minecraft client

3) Now just start up your Minecraft client and:

a) Click multiplayer (To avoid making the dumb mistake of the author, please note this option only comes up on the second screen AND only after you have paid for an account) OpenShift Minecraft multiplayer picture

b) Click Add Server (You could also click direct connect) OpenShift Minecraft Addsever picture

c) Put in the IP address with the port on the end as we saw in the rhc port-forward command. The name of the server can be anything you want - it is just there to help you remember the server. OpenShift PaaS Minecraft server address picture


Adding friends to your server

While it is fun to play minecraft just by yourself it is even more fun when you play with others. Allowing a friend to play is simple, we just use normal SSH port forwarding.

You do this

1) Add their public SSH key to your OpenShift account either through the command line "rhc sshkey" command OR through the web console on the My Account Tab. You can read more about adding SSH keys here. Remember you want to add your friends SSH public (the one ending in .pub) key to your account. OpenShift Paas Minecraft server add key picture

Your friends do this

2) A good test to see if they have it set up properly is to have them SSH into the machine using the same user and address that you used above. If it is set up properly they should be able to SSH into your gear running MineCraft.

3) Your friend now sets up an SSH tunnel to the machine. Read here to get some idea on how you would set that up with SSH for linux, mac, and Putty on Windows to set up the SSH tunnel to your server. The port we are going to forward is still 8080. So the SSH command for my friends trying to use my server would be:

ssh -N -L

4) Then in step C above for connecting the client they use This was tested with 2 Macs, so please let us know if it is something different on Putty with windows.

And there you have it, setting up your minecraft server and connecting a client - all for free. There are tons of ways to customize your server. Remember you are going to have to either SCP those changes up or wget them down to your gear. You can also change setting by SSH'ing in to your gear and changing setting in

Since I am generally new at running MineCraft (as in just started for this blog post), I would love to see other hints and suggestions in the commments here. I hope you and your friends have fun minecrafting!

What's Next?

I would suggest to directly create the file from deploy or build step, so if the ip/port change, this will be updated automatically.

In fact, adding the download in deploy seems also a nice idea, so people do not have to fiddle with ssh for that.

Hey Misc: Can you write the little shell script to do that and I will add it to the post (after I test of course). Thanks Steve

do i have to delete the text in the start and stop files and paste the code in? and what do i paste in?

Step 8 has all the text you need. For the start script paste the code in red. For the stop script just paste the code in the grey.

I get that but do i have to delete the text in the start/stop file and then paste the code in?

yup go ahead and delete anything else in those files if they exist

thx i will try it but... i erm... nvm il just try it

This is what I did...

[ jenkins-client-1.4]> wget
--2012-12-16 23:35:43--
Connecting to||:80... connected.
HTTP request sent, awaiting response... 302 FOUND
Location: [following]
--2012-12-16 23:35:43--
Connecting to||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12084211 (12M) [application/java-archive]
craftbukkit-1.4.5-R0.2.jar: Permission denied

Cannot write to âcraftbukkit-1.4.5-R0.2.jarâ

Can anyone tell me what I am going wrong?

Trying to save to root! Hehe, my simple mistake!

at step 7.) Where are the local files stored for my git repository? i cannot find them? at what step are they automatically created?

On your machine you need to CD into minecraft/.openshift/action_hooks and create those files there. Then you commit them and push them up to the server.

Thanks alot that worked! but.. i have a new error. If i ssh into my application and tail the log file i see "Error: cannot find jarfile minecraft_server.jar" and yet if i ssh into my app and use the LS command while in the data dir, it shows a minecraft_server.jar...

can you paste the contents of your start hook and do an ls -l in your data_dir so we can see the permissions.


The logic to start up your application should be put in this

script. The application will work only if it binds to


nohup bash -c "exec 'java' '-jar' 'minecraft_server.jar' '-Xms256M' '-Xmx490M' '-nogui' &> ${OPENSHIFT_DIY_LOG_DIR}minecraft.log" &> /dev/null &

And if i do an ls -l in my data_dir i get:

total 2016 -rw-r--r--. 1 2bf9fc2bde0b4f729eb83582dc8dc1b0 2bf9fc2bde0b4f729eb83582dc8dc1b0 2061647 Dec 20 05:26 minecraft_server.jar

Okay, Ive got it! but i had to do a little workaround. My app was executing from ./git/minecraft.git/ so i had to store all of my files there. One more question. Now that openshift supports port-forwarding is there a way to use my domain name to access my minecraft server? aka

when i do the tail minecraft.log command it says Error: Unable to access jarfile minecraft_server.jar

help me please,im only 13!

I have the same problem. Any solutions out there?

me too, i;m only 14 haha.., why it can be possible?? "unable to................ minecraft_server.jar"

... i can not use ....:(

i have a lot problem !!!!!!!!!!!!!!!!!!!!!!!!

i am very angry becase i am 10 yesar old... i do not know how to make :(

If you would like help, then you must be more specific as to where you are encountering trouble.

I've some truble to connect my friends to my server...

they have windows and i don't understand what is the correct configuration of PuTTY....

Can someone help me?

We have a blog post that will describe the necessary steps to setup putty connectivity here:


i've set all like in the post and when i give the command

ssh -L 8080:

it print

The authenticity of host ' (' can't be established. RSA key fingerprint is cf:ee:77:cb:0e:fc:02:d7:72:7e:ae:80:c0:90:88:a7. Are you sure you want to continue connecting (yes/no)? yes Failed to add the host to the list of known hosts (/var/lib/openshift/ac1ea1a8d7ef40369363d85a4e98afe5/.ssh/known_hosts). Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

thank for help!

That means that your ssh public key is not registered to the account that owns JioWorld. You can add that .pub contents to that account's "" page.


I've checked and there was alredy my pub. key in the account. I've try delete it and re-add, but nothing changed...

If can help i've try the comand "rhc domain status" and the output was:

Analyzing system ....F..


|| Your system did not pass all of the tests ||

1) Either ssh-agent is not running or you do not have any keys loaded If this is your only error, your connection may still work, depending on your SSH configuration.

thank you very much for your help!

Let's validate. You have a machine from which you used to create and configured the Minecraft app. From that machine, your .pub key is added to your account in which the Minecraft app is running. But when you want to connect your friend's machine to that app (via ssh), you will need to add the .pub key from your friends machine as well. Then from either machine, you should be able to run the ssh port-forwarding. Can you make sure both .pub keys are added (if they are in fact different keys)?
Note that each client will need to forward the port locally for client connection.


Both my key than my friend's key were added to my account but neither for me, from my machine, or for him, from his machine, is possible run the ssh port-forwarding. For both it give the same error: Failed to add the host to the list of known hosts (/var/lib/openshift/ac1ea1a8d7ef40369363d85a4e98afe5/.ssh/known_hosts). Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

Feel free to ping me on IRC when you get a chance. My handle is nduong (M-F 9AM - 5PM PST)

In order for you to get this app going, ssh had to work at one point. I'm wondering if you have multiple keys or .ssh directories, and whether the tool you're using is picking up the correct keys/locations. The solution to the problem you're describing is here:

It might be better off for you get install the rhc client tools and run:
$> rhc setup
$> rhc port-forward -a {appName}

I've did it! my fault was in the configuration of putty:

in connection->ssh->tunnel in destination I've try to put my server ip instead the name of my host.

now it work!

thanks for your help!

Gr8! Nice work!

Hello people I understand your dilemma as I ran into that problem initially too. It was a mis type in the instructions.

You are actually supposed to add

nohup bash -c "exec 'java' '-jar' 'minecraft_server.jar' '-Xms256M' '-Xmx490M' '-nogui' &> ${OPENSHIFT_DIY_LOG_DIR}minecraft.log" &> /dev/null &

To the start file rather than the one posted above.


Openshift is supposed to be for developers of php and red hat apps, if you are 10,11,12,13,14,etc. then this is not for you and you should be hosting on YOUR OWN COMPUTER rather than taking up server space.

Thank you @mbsdivine for posting the solution as it will sure help others. Was scratching my head on how to reproduce the issue but overlooked the file path update. I'll update the post.


I am very new to OpenShift, and this article caught my eye. Although I am inexperienced with setting up a gear like this, it seems to me that it would be easier for friends to connect to the server if it were setup using remote forwarding. Is this accurate? If so, how would I go about setting it up?

I'm not sure if I understand what you mean with "remote forwarding". Can you elaborate?

Sure! In the post, it was mentioned that "To get this to work we are going to have to SSH port-forward either from your laptop to the server or vice versa (both configurations are supported on OpenShift)." Later in the article, it says that "We are going to be using local forwarding, not remote forwarding."

Forgive me if I misinterpreted those statements, but I took this to mean that an alternate setup could be performed where instead of running the RHC command on the client and then having the client's requests tunneled through port 22, one could have the server's packets tunneled through port 22 so that a client could just connect to the server using IP:22. Is this possible? Would I run the same RHC command, but on the server, or would a different method be necessary?

Thanks for the clarification. However, the misunderstanding there is that the documentation linked ( describes both methods, but only local forwarding applies in this scenario where the various clients want to connect to the server.

Alright. Thank you for clarifying!

I am trying to do this with craftbukkit. Here is my start hook:

# The logic to start up your application should be put in this
# script. The application will work only if it binds to
nohup bash -c "exec 'java' '-jar' 'craftbukkit.jar' '-Xms256M' '-Xmx490M' '-nogui' &>
${OPENSHIFT_DIY_LOG_DIR}minecraft.log" &> /dev/null &

But when I start it and try and port forward, this happens:

$ rhc port-forward -a minecraft

Checking available ports...
There are no available ports to forward for this application. Your application may be stopped.

How do I fix this? My guess is something needs changing in the start hook.

I haven't tried this, but if you set server-ip and port in to the values of $OPENSHIFT_INTERNAL_IP and $OPENSHIFT_INTERNAL_PORT, and the server started correctly, you should be able to run port-forward. You might want to check your application logs to see if the later is true.

Hmm.. The port and IP are correct but the minecraft.log is not looking how you would expect.. Here it is:

[ logs]\> tail minecraft.log
--nojline                               Disables jline and emulates the
                                          vanilla console
-o, --online-mode <Boolean:             Whether to use online authentication
-p, --port, --server-port <Integer:     Port to listen on
-s, --max-players, --size <Integer:     Maximum amount of players
  Server size>
-v, --version                           Show the CraftBukkit Version
-w, --level-name, --world <World name>  World name

I don't know why it's doing this. I've been running local minecraft servers for ages and never seen this.

EDIT: This seems to have issues, so I'm not entirely sure how to set up CraftBukkit.

CraftBukkit disregards the IP in, so one must declare the correct IP as an argument when starting CraftBukkit. Here is my start hook for use with CraftBukkit 1.4.7-R0.1:

java -Xms256M -Xmx490M -jar craftbukkit.jar -o true -h 

I too am having difficulties getting a craftbukkit server working. Here is the line in my start file:

nohup bash -c "exec 'java' '-Xms256M' '-Xmx490M' '-jar' 'craftbukkit.jar' '--noconsole' '--online-mode' 'false' '--log-limit' '10000' '--size' '4' '--log-pattern' '${OPENSHIFT_DIY_LOG_DIR}server.log' '--server-port' '${OPENSHIFT_INTERNAL_PORT}' '--server-ip' '${OPENSHIFT_INTERNAL_IP}' &> ${OPENSHIFT_DIY_LOG_DIR}minecraft.log" &> /dev/null &  

Note that --online-mode is purposefully false so I can use BungeeCord in front of it. (The plain minecraft.jar works fine this way so I don't think that's the issue.)

Problem solved with a newer version of craftbukkit. I am trying the latest development version here:

Thank you for posting the solution!

On step 7 the path can't be found. I don't even know where to look for it or anything. Any help?

--edit-- Nevermind, I found the directory.

Thanks for the update.

For anyone doing this, I highly recommend setting up a "common key pair" and distributing it, along with a batch file (and PLINK if you're running on Windows), to anyone who will use your server. I wrote a small C# application to enable and disable the tunneling for my players, and this save a ton of time! It's also possible to change the permissions of the common user so that they can't do anything except tunnel, but I don't know how to do that, so I left the permissions alone.

Fantastic tutorial! I set up a CraftBukkit server with an app to help my players connect to it more easily. This is a great guide, and for a little work you can customize your server much more than you can with most MC hosting services.