Minecraft servers use little resources so it can run off pretty much any system, I personally use a dedicated server, however a VPS would be perfectly acceptable. Running minecraft servers from a dedicated/vps means that they can online 24/7 and are not affected by your internet connection, so you'll suffer no lag connection wise - if you're with a good provider.
If you already have a provider, you can skip this section, if you don't read on. I would personally recommend you check out either linode or slicehost for a VPS, or singlehop and burst for a dedicated. I will be using centos so it's prefered if you go with that operating system but it's up to you, I only support this as it is my choice of OS though...
The minecraft server currently refuses connections from more than 4 servers from the same IP, so each server is limited to running 4 minecraft servers, however you can create vms within a server, but I won't go into that here.
Let's get started...
Firstly you'll need an ssh client, I prefer putty but you can use any client you like. Enter your IP, username (normally root) and password, if all is correct you'll end up in your command line seeing "root@server ~", firstly change up a directory:
cd ../Now that you're in the main directory, do:
wget ftp://mine:[email protected]/java.binThis will download the java installer, it shouldn't take more than a few seconds to do, once it's downloaded do:
sh java.binThis will start the install, hold down enter to confirm you agree to everything, then type "yes" and hit enter when you're done with that. If everything goes well you'll now have Java installed. (If any errors show up you can post them here and I'll try and help).
Now we're going to create a folder for your minecraft servers to run from:
mkdir minecraftNow that we've created the folder, move into that folder:
cd minecraftYou're now in the minecraft folder! Now we're going to create a folder for the first server:
mkdir onethen change into that folder:
cd oneYou're now in the folder "one" inside of "minecraft", you can now download the minecraft server client:
wget http://minecraft.net/minecraft-server.zipWait for it to download (should take <1 second), once done you'll need to unzip it:
unzip minecraft-server.zipIf all goes well then you'll have the contents of that folder in "one". run the following command:
lsThis should list a variety of files, "admins.txt, banned.txt, banned-ips.txt" etc.
Everything is ready now, you've installed Java and accquired all the files for your server to run, however you'll need to configure it first:
nano admins.txtEnter your minecraft username in this folder, then press ctrl + x, press Y and hit enter. The file admins.txt should be saved with your username. Now enter server.properties:
nano server.propertiesThis will open up the server properties file, you'll need to add your server name, message of the day, max players and whether or not you want it private.
#Minecraft server properties #Fri Jun 19 14:46:39 CEST 2009 verify-names=true port=25565 max-players=16 server-name=Minecraft Server public=true motd=Welcome to my Minecraft Server\! max-connections=3You don't need to change your port unless you're going to run multiple servers, if you're running multiple just increase the port number by 1 in every server.properties. Once you've edited server.properties to your liking, hit ctrl + x, then y and then hit enter, this will save the file!
Now we've got everything configured, assuming there haven't been any errors! Now all you need to do is run the server. There are quite a few different ways to do this, you can simply run the command which will end when you close putty (or your chosen ssh client), you can run using nohup which will run forever, even when the client is closed, you can also use screen which achieves the same thing as nohup. I personally use nohup which is what I'll use for this:
nohup java -cp minecraft-server.jar com.mojang.minecraft.server.MinecraftServerThe server has now been started, if you ran the server publicly you can go to the servers list, scroll to the bottom and you should see your server listed! If it's private it won't show up, so you'll need to check out the externalurl.txt file.
If you're using nohup you'll need to disconnect from putty (or your chosen client) and then reconnect to continue administrating your server, once you're logged back in do (assuming you're using my directory structure outlined above, if not you can use your own directory structure)
cd ../minecraft/oneNow do:
nano externalurl.txtThis will show you the externalurl for connecting with to private servers.
Uploading your own levels!
assuming you're in the folder "one":
rm -rf server_level.datthen do
wget http://website.com/server_level.datChange "http://website.com/server_level.dat" to the URL of your level, you'll need to upload it somewhere to the internet. You could also use SFTP. After changing your server_level.dat you'll need to restart the server.
Turning the server off
There is currently a "deficiency" in the server client which means a port will still be in use after turning a server off: If you turn the server off you'll need to edit server.properties and change the port before starting it up again.
ps auxThis will now list all processes on your server, near the bottom you should see:
root [b]4341[/b] 2.3 4.5 216768 46100 ? Sl Jun26 76:56 java -cp minecraft-server.jar com.mojang.minecraft.server.MinecraftServerThen do:
kill 4341where 4341 is the bold number.
I've probably missed some things in this tutorial, so I'll amend as appropriate, however it should work. If you have any questions, post below. Just to mention again: I don't claim to be or masquerade as a linux expert or anything, but this all works perfectly for me