User:ExtremeHeat11/sandbox/Setting up a server/Linux instructions

Linux instructions
This tutorial for how to set up a Minecraft server on Linux was designed for people who don't have a lot of experience with Linux. There is a more advanced tutorial in the forums. This tutorial was tested on Ubuntu 9.10 32-bit but should work with the descendants of Debian.

Downloading
Ensure you have the latest server application software. Look above for instructions.

Installing Java
If you get  (which may be followed by more text) or if you do have another Java version than 1.6 then you need to install or update java. The official Oracle Java is recommended. A few individuals have experienced issues with OpenJDK. Others report that running on OpenJDK is completely fine.

Debian
Ensure that the non-free repository is being scanned by apt. You do this by adding non-free to your  file. e.g.:

deb http://ftp.uk.debian.org/debian/ squeeze main contrib non-free

Update your sources list (as root): apt-get update

Then to install Java, simply type this in terminal and press enter (as root): apt-get install sun-java6-jre

Ubuntu
Unfortunately, some licensing issues have prevented Canonical from allowing repositories to have Sun Java, so you must either download it directly from Oracle, package it, and install it or you could use the PPA provided by webupd8 by following the instructions below.

This guide has been tested on Ubuntu Server 12.10.

Note: You might need to install the package "software-properties-common" by running  and/or "python-software-properties" by running   to use the   command.

Run the following commands in this order to add the PPA, update the source list and then install java:

Then run this to check what version you have installed:

The output should be similar to:

For more information or troubleshooting see this link at webupd8s site

openSUSE
On older versions, you can simlpy type  into a terminal.

On newer versions, there is a tutorial here describing how to install Java.

Arch Linux
Open a terminal and run  as root.

Gentoo
Use:

Other distros
Alternatively, you can visit Java's website directly to download the Java package for Linux. Most distros work with this (either 32 or 64-bit). Instructions for the installation of those different packages are given on the site.

If during installation, it asks for a password, enter your password. If you get asked "Is this OK [Y/N]" Enter Y and press enter if required. Java should now be installed.

Start the Minecraft server
Open the terminal again Applications > Accessories > Terminal Enter the following commands, substituting 'minecraft_server' with the name of the folder you extracted the server to:

Less than 1GB free RAM
If you have less than 1024MB RAM, the above line may cause problems with swapping and out of memory conditions, which makes the game hard to play.

It may look like this:



You are interested in the last number in the third line, 2163 in this case. Subtract some RAM as safety. On this computer, the server may use up to 1536 MB RAM. Now, replace the 1024 in the above example with the calculated number:

Voila, it should run smoothly now

Tip: If you want to spare more memory, you may set the -Xms parameter even lower, say:

The parameter controls how much memory is reserved on startup Your server will start with 32MB RAM and whenever it needs more memory it will allocate some until it reaches the maximum of 512 MB. However, this will result in a little slowdown whenever the allocation is done.

Startup and maintenance script
Alternatively you can manage/automate the startup and shutdown of the Minecraft server using a script such as the ones listed below:


 * Minecraft Server Manager A comprehensive start up script for Minecraft and Bukkit servers (support Debian, such as Ubuntu).
 * MSM can also periodically create World Edit compatible backups.
 * Keeps players informed with configurable in-game messages, such as "Shutting down in 10 seconds!"
 * Expose in-game commands (such as "say", "op" and "whitelist") to the terminal.
 * Tab completion on all commands makes learning easy.
 * Visit Minecraft Server Manager's GitHub page for the full list of features.
 * Server startup script
 * M3tal Warrior' Server Startup Script
 * For Debian (and should work on Ubuntu too); Bukkit and Vanilla compatible
 * Full backup and rollback routines
 * All ingame commands can be invocated
 * Supports using the RAM as server root file system
 * Multiple cron invocations to ease administration
 * Easy autoupdater
 * Easy installer for first timers
 * FreeBSD startup script
 * OpenBSD startup script
 * Ubuntu startup script
 * rfwadmin startup script with web interface (for Linux servers). Nice web interface for quickly saving and loading maps.