How to set up a Minecraft Server on Linux

Screenshot of minecraftOne of the bad things with Minecraft (if there is such a thing), except being addicted is that you can’t easily “click-and-play” online with your friends. In Counter-Strike, for example, you can host a server while you play using only two mouse-clicks – but how do you do you host a Minecraft Server?

Read on to get the full walkthrough of how to set up a Minecraft Server. 

The first step for setting up a Minecraft Server is getting the software (or binaries, if you’d like), which can be found here. The file you want depends on what system you’re going to use, but the JAR-file always works (which is the one we’re using). If you’re not comfortable using  the command line and are using Windows, feel free to get the simple-to-use EXE.

Next step is to set up our environment for our Minecraft Server. As I am using Ubuntu on my netbook, I can’t vouch for that this will work for other types, but I’m pretty sure, so keep that in mind. Bring up a terminal window and type “sudo apt-get install openssh-server”, which will essentially install an SSH-server and give you the ability to remotely manage the Minecraft Server via SSH (you can use PuTTy to connect using Windows).

If you’re like me, loving remote management, you’d also need an FTP server in order to transfer the minecraft_server.jar and to retrieve the installation later for backup purposes. Bring up the terminal and go “sudo apt-get install vsftpd”. This will need a bit of configuration, so after the installation run “sudo nano /etc/vsftpd.conf” and set “anonymous_enable = NO”, remove the “#” from “#local_enable=YES” and “#write_enable=YES”. What this does is that it only allows users on your machine to connect (you login with your usual name and password) and allow them to write files.

You will need to install Java, since both Minecraft  and Minecraft Server uses it. “sudo apt-get install sun-java6-jre” should to the trick. As previously mentioned, I’m not sure what works for you, so if in trouble drop a comment or search for another way to get the runtime environment.

Alright – we’re now set. Open PuTTy, enter the adress and log in. Write “mkdir minecraft” to create a folder named minecraft, this is were we’ll put the Minecraft Server. Open up FileZilla (or another FTP client), log in, and transfer the minecraft_server.jar to ~/minecraft. If you have a world you’d like to import, place that folder inside ~/minecraft and rename it to “world”. Bring up the SSH again and type “java -Xmx1024M -Xms1024M -java minecraft_server.jar nogui” to start the server. -Xmx sets the maximum amount of RAM java (minecraft server) can use, and -Xms sets the lowest amount (although it doesn’t seem to allocate all of it at start). Minecraft Server will now create a new world if you didn’t import one. Feel free to check if it works by joining it.

Just a few more things, almost there: write “stop” to shut down the Minecraft Server. This is important to do since it will make the server save everything to disk, although you could run “save-all” and then quit it however you like but I wouldn’t recommend it. Run “nano server.properties” to edit the config, usually you don’t need to do this, but it could be nice to see what’s available. I only changed “online-mode” to false since I don’t feel the need to authenticate users, mainly because I have a few friends who are running a hacked version. Some of them bought Minecraft after trying it out, so it’s win for us and win for the developers.

Note that Minecraft Server is running on port 25565 by default, changing the port is okay, but then users will have to enter the port when connecting – i.e. “192.168.0.111:xxxx” – using “:” and then the port.

I think that’s it! Happy mining and crafting!

20 Comments to “How to set up a Minecraft Server on Linux”

  1. Bryce says:

    It wont let me throw in Java :( please help!

  2. Oscar says:

    Could you describe your problem? I’m not sure what you mean, but do you mean that there is a problem with installing the Java environment?

  3. Hamer Gaming says:

    I figured it out! sorry I didn’t reply sooner! This is the first tutorial that actually worked for my server to run! Thank you! I will definitely refer you if anyone ever needs this tutorial! Kudos to you! :) It be great on behalf of the entire Hamer Gaming team (All 3 of us :P) if you would drop by our server and say Hi! IP: 173.230.156.184. Thanks again! :)

  4. [...] I wrote a guide on how to install a Minecraft Server on Linux, check it out if you havn’t got your own Minecraft Server [...]

  5. Karim says:

    Hey man good guide but i dont quite get it by the ssh part and putty, thing is a got a ftp server but dont mangage anything with the ssh and putty.

    if u have time n hours please do guide for win7 =) hollah peace!

  6. Oscar says:

    Karim; sure, I could give a quick tour of that when I get home later tonight. What machine and software do you use?

  7. Luke says:

    cant get the java environment…….

  8. Nathan says:

    What IP address do you login to in PuTTy?

  9. Oscar says:

    That depends on where your server is located. If it is on your local network, try logging into your router and look for the IP adress of that machine. If you have a VPS, you will need to ask customer support for details.

    If you have access to a terminal on the computer (which is running the server) type “ifconfig” in a terminal window to get the local IP adress (same as the one you will find if you logon to the router).

  10. Dreamworks says:

    Thanks mate.

  11. John says:

    So to start – I am a mac user and also a minecraft fan. As I wanted to setup a minecraft server on mac I just couldn’t find a proper info on the subject. Until I came upon this site: http://minsrv.com – clearly writen, with some print screens – all neat and understandable :) I bet it can help You. BTW: it is still developing.

  12. Anonymous says:

    use -jar instead of -java

  13. marco says:

    this tutorial is okey.. but i can’t copy any command… so not good to use..

  14. Oscar says:

    Marco: you can, but the highlight is not visible. In any case, typing shouldn’t be that hard since you (probably) have auto-complete if you press TAB.

  15. Cant reach server says:

    Me or my friends of NOBODY can join the server, even though its ported right and the ipv4 adress is right and NOTHING SEEMS TO BE WRONG! :( Please someone help me! Java works fine and the server starts but just nobody can connect and its making me REALLY MAD!

  16. Gabriel says:

    @Cant reach server: Did you open port 25565 (or any other port you are using for your server) on your router?

  17. Anonymous says:

    after you stop the server, how do you run it again?

  18. Jack says:

    Getting Java was tricky, but there are two packages I installed to get it to work: openjdk-7-jre-headless and default-jre. Normal sudo apt-get install works for both. My small workstation only works with 512MB RAM so, I had to modify the params. Great guide! Thanks for your effort.

  19. Lea says:

    What log in do we use? I am so confused…

Leave a Reply