[Tut] Hosting a Minecraft Server!

Tenchio

New Member
Messages
2
Reaction score
1
Points
0
"I've been reading many post on how to install Minecraft server (most of them are locked) and none explain connection issues or opening ports. Anyways, all those guide explained only how to get the files on your vps and how to run the minecraft_server jar. I had issue with connection to the server after creating it and turns out it was the ports, so I'm making a full guide on installing minecraft server on your vps and fixing issue you may have with Minecraft."

This guide will allows you to fully connect and create a Minecraft on your VPS for CentOS or linux.

Requirements
- Owning a Vps or Linux/CentOS operational system.
- Having YUM
- Internet connection ;P
- SSH Client


Linux/CentOS


  1. Installing Java 7 SDK.
    Code:
    [COLOR=#ff0000]yum install java-1.7.0-openjdk[/COLOR]
  2. Checking if Java was installed correctly.
    Code:
    [COLOR=#ff0000]which java[/COLOR]
  3. Installing Screen to keep your server running while SSH is closed.
    Code:
    [COLOR=#ff0000][I]yum install screen[/I][/COLOR]
  4. Opening port 25565.
    Code:
    [COLOR=#ff0000][FONT=Helvetica]iptables -A INPUT -p tcp --dport 25565 -j ACCEPT[/FONT][/COLOR]
  5. Creating a user
    Code:
    [COLOR=#ff0000][I]useradd [COLOR=#00FF00][COLOR=#008000](username)[/COLOR][/COLOR][/I][/COLOR]
  6. Setting up password for user
    Code:
    [COLOR=#ff0000][I]passwd [COLOR=#008000](username)[/COLOR][/I][/COLOR]
  7. At this point please login to your user account!
  8. Creating a folder for your Minecraft server.
    Code:
    [COLOR=#ff0000]mkdir [COLOR=#008000](Name of minecraft folder)[/COLOR][/COLOR]
  9. Entering your Minecraft server folder.
    Code:
    [COLOR=#ff0000]cd [COLOR=#008000](Name of folder)[/COLOR][/COLOR]
  10. Downloading minecraft_server.jar
    Code:
    [COLOR=#ff0000]wget https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar[/COLOR]
  11. Giving premissions to minecraft_server.jar
    Code:
    [COLOR=#ff0000][I]chmod +x minecraft_server.jar[/I][/COLOR]
  12. Running Screen.
    Code:
    [COLOR=#ff0000]screen[/COLOR]
  13. Starting minecraft server. (1024 is replaced by the amount of ram you want/limited to)
    Code:
    [COLOR=#ff0000][I]java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui[/I][/COLOR]
  14. Stopping your server (while running server)
    Code:
    [COLOR=#ff0000]stop[/COLOR]
  15. Exiting screen by (holding ctrl + a + b)
  16. Editing your server properties
    Code:
    [COLOR=#ff0000]vi server.properties[/COLOR]
  17. Press i to enter Insert Mode.
  18. Press Esc to exit Insert Mode.
  19. Press or paste :x to save and exit.
  20. Re-entering Screen Mode
    Code:
    [COLOR=#ff0000][I]screen -r[/I][/COLOR]
  21. Restarting server
    Code:
    [COLOR=#ff0000][I]java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui[/I][/COLOR]

Now when ever you need to edit,start, or stop the server just login to your new account for minecraft!


FAQ


  • Can't connect to server.
    Code:
    [COLOR=#FF8C00]Redo step 8 and 9[/COLOR]
  • How do I add more ram?
    Code:
    [COLOR=#FF8C00]Either upgrade your vps or read over step 11[/COLOR]
  • How do I use tekkit or craftbukkit?
    Code:
    [COLOR=#FF8C00]Use WinSCP and navigate to your minecraft folder and replace the minecraft_server.jar with tekkit/craftbukkit jar and renaming it to minecraft_server.jar[/COLOR]
  • must have mode 777 error
    Code:
    [COLOR=#FF8C00]Enter [/COLOR][COLOR=#ff0000]chmod g+s /usr/bin/screen[/COLOR][COLOR=#FF8C00] in SSH client[/COLOR]

If you have any issue with this guide please leave a message below and I'll fix it once I see it.
 
Last edited:

Skizzerz

Contributors
Staff member
Contributors
Messages
2,929
Reaction score
118
Points
63
Decent guide, although you should NOT be running minecraft as root. If someone finds a vulnerability (bukkit plugin or whatnot) that allows for command execution, you just left your entire system wide-open. You should make a dedicated unprivileged user for running the server and su to that user before starting java. Your iptables commands are a bit off as well; using iptables -A will append to the existing chain so you don't need to save the rules (also iptables-save doesn't do what you think it does -- it's for saving the current rules into a file or whatnot for later restoration via iptables-restore; it doesn't actually "apply" rules changes or anything), but that does not persist across server restarts. I would also recommend using "nano" as the text editor in the guide for its ease-of-use over vi/vim for newbies. Finally, that light blue is hard to read.
 

Tenchio

New Member
Messages
2
Reaction score
1
Points
0
Decent guide, although you should NOT be running minecraft as root. If someone finds a vulnerability (bukkit plugin or whatnot) that allows for command execution, you just left your entire system wide-open. You should make a dedicated unprivileged user for running the server and su to that user before starting java. Your iptables commands are a bit off as well; using iptables -A will append to the existing chain so you don't need to save the rules (also iptables-save doesn't do what you think it does -- it's for saving the current rules into a file or whatnot for later restoration via iptables-restore; it doesn't actually "apply" rules changes or anything), but that does not persist across server restarts. I would also recommend using "nano" as the text editor in the guide for its ease-of-use over vi/vim for newbies. Finally, that light blue is hard to read.

Thanks the for information. I just start on the vps yesterday and this guide. I'm not fully used to linux yet, so I don't really know that much. I will fix the guide to create a user, fix up iptables, and remove the iptables-save.
 
Last edited:

theboyetronic32

New Member
Messages
1
Reaction score
0
Points
0
Just randomly stumbled upon this topic.

I would like to add

Code:
yum install nano

Nano is a more friendly editor for the average user,
few essential keys
CTRL-X - exit
CTRL-O - Save (writeout)
CRTL-W - Find (as opposed to CTRL-F in windows apps)
Also, a SSH client shortcut, CTRL-INSERT, this essentially performs a "CTRL-V".

If you will be sharing access to the VPS with another admin
Code:
screen -x
As opposed to
screen -r
will allow multiple connections to the screen session as opposed to just one

FAQ,

running
Code:
free -m/CODE]
This command will show you how much RAM your system has free, useful for deciding how much ram to allocate,
my usual method for determaining the max amount of ram you will need is leave to take what is free, and take away about 100MB as to allow for loading other apps, (ensure services such as MySQL are running in the backround, and for MySQL, usually add an extra 50MB to free RAM).

Also, I would like to add as an overall guide, where possible, configure bukkit plugins to use MySQL, most of the plugins either use a h2 database, which is perfectly fine, or they use what is refered to as a "flatfile" which is practically just a text document, but caching the file and reading it as needed by the plugin consumes a lot of ram, and is known to cause crashes.
However, some plugins do handle this perfectly fine.
 

essenza

New Member
Messages
1
Reaction score
0
Points
1
ye I believe iptables-save saves all the rules to a file.

iptables-restore replaces all rules with those in a file.

iptables save keeps the rules after reboot...

Free hosting
 
Last edited:
Top