GUIDE: Setting Up And Monitoring A Linux MineCraft Server
Hello, I'm lDucks and this is my guide on how to run a Linux MineCraft server. I ran a server about 8 months. I've been creating plugins since 13 months. A server I managed for over a decade was my experience. Although this guide is not perfect, it may contain errors. I have to reread it several times and have it reread by other people. I hope that this will help others who don’t know how to manage servers.
This guide is a compilation of information I have gathered through my own experiences and my love for CS. Enjoy.
This guide will show you how to set-up and manage a physical server. This guide does not contain anything with regards to running a community or running a website. This is just how to setup and monitor your server and make sure the backend is running smoothly. Obviously if you want to run a server for you and your friends you can run one off your computer or a cheap Minecraft host. But if you wish to run one on larger scales, you will need to do much more work, which I will explain in this guide.
Prerequisites: Linux Server (This is a guide for a Linux server, all the commands on this server are for CentOS but they don't differ much from other Linux distributions) Knowledge of Filezilla or another FTP client Knowledge of basic command line navigation (Windows or Linux, as long as you know what a "terminal" is and how to use its basic commands)
What you need to download: Latest craftbukkit build
This guide is designed to be used in the same order that you will set up the server. It starts with step 1, and ends up with additional information that you will require after setup to ensure your server runs properly.
Picking a Server First of all, if you are opening up a Minecraft server you should expect to put some money into it. Running a server off your own personal computer, even a computer on your network, is not a good idea. To run a server you need to have the correct internet service provider and a proper server setup. I highly recommend that if you want to run a Minecraft server you start it up with a Minecraft host.
What is a Minecraft host? Minecraft has grown so large that there are hundreds dedicated to Minecraft hosting. I won't go into detail about how to run a server using them as they don't have much functionality. Most of them use MCMyAdmin. If you are not requiring constant maintenance (paintball and hunger games), then you can run a server. You don't really need to read any further. A host is available for as little as $30 per month. It will provide everything you need. If you need to create CRON jobs and edit core files, install software or have a faster processing speed, you will need a dedicated server host. you will eventually need to get a dedicated server host. Usually once you get past ~10GB of RAM from an MC host, the prices are more expensive than just renting a dedicated server. Once you have 30 players on your server and are able pull in $100+ per months in donations, you should expand.
For those of you looking for good Minecraft hosts, I have had some good experiences with https://allgamer.net/ - I have supplied a list of Minecraft hosts at the end of this guide.
This is where you should start looking for dedicated servers. A dedicated server isn't made for Minecraft. It is a physical server that you can rent from the datacenter and use as you please. This guide will only cover how to operate a Linux-operated server. Anyone who wants to run a Minecraft server should get a Linux dedicated host. This is a personal preference. There is no reason to choose Linux over a Windows server. This guide, however, will be written only for people with a Linux box. If you don't have a Linux box, you can stop reading now.
Now, when picking a server many people are always concerned about their RAM. I've read in many places that you need about 1GB of RAM for every 10-20 slots on your server. This is a reasonable estimate to base your calculations on, but RAM is only one thing you need to be concerned about. Your HDD must be large enough. You also need to ensure your processor is powerful enough and your internet speed is sufficient.
I had a very nice box when I was running my server: i73770 4 Core @3.4 Ghz with 32 GB RAM and 64 GB SSD, 32GB HHDD.
This is enough to run a server for 200+ people. When renting a box, take this into account. Choopa might be a good choice for you. Before you choose a host to use, I recommend you do some research. You will find a list at the end of the guide.
I recommend a 16GB RAM, 16-32GB HDD, and 16GB SSD. There are so many processors, that any processor you get will likely do the job. These numbers are inflated and you don't need as much. If you are on a budget, you may be able to go lower. I recommend these numbers to ensure that you have enough work space.
How to Set Up Your Server. Now that your box is set up, you might be wondering how to get it started. You don't know how to open Windows Explorer and execute the run.bat file from Bukkit. Sadly, it is a bit more complicated than that. First upload your craftbukkit file to your server. I normally used the directory /home/SERVERNAME.
Create a new file called start.sh.
This code should be placed on the page: DO NOT CODE THIS CODE EXACTLY. Code: Java -server Xms10GXmx16G-jar craftbukkit.jar
Every box is unique so you may need to adjust the amount of RAM you give to your server. As you can see, we have allocated the server 10GB extended memory and 16GB maximum heap size. DO NOT ALLOCATE ALL of your RAM. If you have an 8GB storage device, you should give it the following: -Xms4G or -Xmx6G. If you have a 16GB storage device, you should give it the following: -Xms8G or -Xmx12G. You can play around with the numbers. Make sure that you have at most 2GB of space left unallocated, and that Xmx is not larger than Xms. There will be other applications running on your machine, so make sure to leave enough space. There are many options available depending on how your processor handles the server. This is not important, but it's worth doing some research if you need to change things.
Upload this start.sh to the /home/SERVERNAME. You can do this with Filezilla, I'm assuming that if you're setting up a server you know how to use Filezilla (or any other FTP client) so I am not going to get into detail about that.
How do I run the script? Well, let me explain. I'm going show you how PuTTy works. This is why I use this method. It is much simpler than teaching you how connect to a terminal. PuTTY is perfect for anything you'll want to do on your server box.
Download PuTTy here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Open PuTTy. Enter the hostname. You will need to enter the IP address of your Minecraft server. If you don’t know what it means, you can get it by logging in to your account on the serverhost’s website or by contacting the serverhost. You can also enter a URL to connect to your Minecraft server.
Next, you will need to enter the port. If you haven't changed the port it should be port 22. Click the "SSH" option. This is NOT the port number for your Minecraft server. It is the SSH Port.
You can now open the connection. Click "Open"
Once you do that, you'll be prompted for login. Your login name should be root if you weren't told otherwise. If you don’t know what your host is, you can reach them. After typing root press enter. Next, enter the password you received from your host. Next, click on enter. As you type your password, it won't appear in the browser.
You need to ensure you have certain items installed on your box. You will need to have a lot of things such as Java, MySQL, htop and iptraf. This guide will help you understand how to do it.
Installing Programs Here is command line for installing every program you will need. It is important to keep in mind that not all Linux boxes use exactly the same format. These commands are for CentOS boxes. Although most people use Ubuntu, and I do, at the time that I wrote this, CentOS was my current operating system. The commands for installing are similar. You can use the following command line if you are using CentOS. You can use the "apt–get" command to install Ubuntu. I suggest that you research your distribution to find the right commands.
First enter the following command to make sure you can use the rpm extension: Code: yum install rpm
32bit systems will require you to search for the RPMs yourself. These links are for 64bit systems.
iptraf: Code: yum install http://scriptmantra.info/sources/iptraf-3.0.0-5.el5.x86_64.rpm
htop: Code: yum install http://205.196.123.160/j785fw1gc80g/al1aaacqodltr1i/Htopbuild0056.yashua.rf.x86_64.rpm
These guides can be found on Google for Java and MySQL installation. I won't waste time rewriting them.
JAVA: http://www.wikihow.com/Install-Java-on-Linux MYSQL: http://www.thegeekstuff.com/2008/07/howto-install-mysql-on-linux/
Starting MySQL Enter the following command line to start MySQL: Code: /etc/init.d/mysqld
Turning on the Server Now I assume you are ready to turn it on and install plugins. In order to do this you need to open a "screen" (instance).
However, screen does not come preinstalled and you will need to install it. Type: Code: yum install screen
If the above command does not work, please follow the next step. Once you have it installed, you can open a screen.
Click this link to find the version you need. Then, enter these two lines into the terminal:
Code: yum.yum -y texinfo pam.devel.libtool yum URL_TO_RPM
Now, the screen is installed.
To open a screen, you will need to enter the following code into the command line Code screen -S SERVERNAME
Obviously, replace servername with the name of your server. It is important that your screen name matches the name of your server. This is so you can easily find out which server is running for each instance. Once you have done that, you should see a page like this. I'm going to call my screen "WARCHICKEN" for now.
Now, you're on the screen. You want to now run your start script. First, you need to open the file.
You type: Code: cd /home/SERVERNAME
We chose this path because it is what we used earlier in the guide.
Now you want to type: Code: ./start.sh
This will start your server. This will start your server.
It means that your start.sh file was not modified to 770. It's All About Ed Please use this command to do so:
Code: chmod 770 /home/SERVERNAME/start.sh
This screen will allow you to enter commands as the servers after the server is turned on. Hold CTRL+A+D to detach.
If you want to reconnect you can type Code: screen -r WARCHICKEN screen -rd WARCHICKEN
-r means to connect. -rd means to connect and kick anyone who is attached. One person can view a screen simultaneously
You can also use Code: screen-list
To list all open screens, type: Code: kill -9 You can kill any screen by typing Code: kill -9
The PID is the number left of the screenname.
This number will change each time you reopen a window. If your server crashes and you lose control of the screen, close it and reopen it.