GUIDE Setting Up And Monitoring A Linux MineCraft Server

From Mozilla Foundation
Jump to: navigation, search

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. There may be some errors in this guide. Even after reading it many times and having it reviewed by others, I still have to correct any errors that I find. I hope this helps people out there who don't know how to run servers.



All information in this guide is based on my own experiences and learnings from CS. Enjoy.



This guide will show you how to set-up and manage a physical server. This guide doesn't address the running of a community, or running a website. This guide focuses on how to set up your server and keep it running smoothly. If you are looking to run a server for your friends, you can either use a cheap Minecraft host or your computer. 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 to a Linux Server. The commands are for CentOS.



Download the latest craftbukkit build



This guide will help you set up your server in the correct order. It starts at step 1 and ends with additional information after setup to ensure that your server is running correctly.



First, pick a server. If you plan to open a Minecraft Server, you should expect some investment. 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 hosting company? Minecraft has grown to the point that there are hundreds upon hundreds of companies dedicated to hosting it. I won't get into how to manage a server from them, as they don’t have much functionality. Most use MCMyAdmin. If you're running a server that doesn't require constant maintenance (paintball or hunger games, for example), then this is the right place. then you really don't need to read much past this. You can get a host for ~$30 a month that will do everything you need and more. However, you can't make a server that requires editing core files, creating CRON jobs or installing software. You will eventually need a dedicated host server. Once you've used 10GB RAM from an MChost, renting a dedicated host is usually more affordable than renting. Once you get past ~30 players on your server and you're able to pull in $100+ per month in donations, you need to 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 start looking for dedicated servers. A dedicated server is not designed for Minecraft. It is a whole server that you can rent at a datacenter to use as much as you want. In this guide I will only be going over how to run a Linux operated server. Anyone looking to host a Minecraft server would benefit greatly from a dedicated Linux host. minecraft server hosting This is a personal preference. A Windows server is fine, but there are no particular reasons to choose Linux. This guide will only be applicable to those who have a Linux machine. You can stop reading this guide if your Linux box is not available.



Now, when picking a server many people are always concerned about their RAM. According to many sources, you will need approximately 1GB RAM for every 10-20 slots of your server. This is a great estimate, but it is important to remember that RAM is just one aspect of what you need. You need to make certain your HDD is sufficiently large, your processor is efficient, and your internet speeds remain fast enough.



When I was running a server I had a very nice box: i7 3770 4 Core @ 3.4 Ghz, 32 GB RAM, 64 GB SSD, 32GB HDD.



This is enough to run a server for 200+ people. This is something to consider when renting a box. A good host you may want to look into would be Choopa. I would recommend that you research other hosts before you decide on one to use. I have supplied a list of hosts at the end of this guide.



I recommend that you get a 16GB RAM box, 16 - 32GB HDD, 16 – 32GB SSD. There are so many processors, that any processor you get will likely do the job. These numbers are highballing it and you don't exactly need that much. If you are on a budget, you may be able to go lower. I would only recommend these numbers so you have some working space.



Setting Up Your Server Now that you have your box you may be wondering how to start it. You don't know how to open Windows Explorer and execute the run.bat file from Bukkit. Unfortunately, it is more complicated than that. First, upload your craftbukkit files to your server. I normally used the directory /home/SERVERNAME.



Next, create a file called "start.sh".



You should place this code on that webpage: DO NOT COPY THIS COMMUNITIES CODE: java –server -Xms10G. Xmx16G. jar craftbukkit.jar



Every box is different so you will need a different amount of RAM to provide to your server. We have given the server 10GB of extended RAM and 16GB for maximum heap size. DO NOT ALLOCATE ALL THE RAM. If you have an eightGB box, you should give the box -Xms4G, -Xmx6G, and if you have 16GB, -Xms8G, and –Xmx12G. Play around with the numbers, make sure you have at least 2GB not allocated, and keep Xmx bigger than Xms. Other things are going to be running on your box besides the Minecraft server, so leave some extra space. There are many other options you can choose from depending on how you want the server to be handled by your processor. This is not important, but it's worth doing some research if you need to change things.



Upload this start.sh into the /home/SERVERNAME. This can be done using Filezilla. I'm going to assume that you already know how to use Filezilla or any other FTP client if you're setting it up a server.



How do I run the script? Well, let me explain. I will show you how to use PuTTy. The reason I am using this method is because it is much easier than teaching you how to connect through a terminal. PuTTY is great for everything you need to do on your server.



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 the IP of your Minecraft server, you can log into your account at the server host's website. Or contact your serverhost. You can also enter a URL to connect to your Minecraft server.



Next, you need to enter in the port. If you haven't changed the port it should be port 22. Next, click on the option "SSH". This is NOT the port number for your Minecraft server. It is the SSH port.



You can now open the connection. Click "Open"



When you do that, you will be prompted to login. Your login name should be root if you weren't told otherwise. If you don't know the name of your host, you can contact them. After you have typed root, hit enter. Next, enter your password that you have received from the host. Next, click on enter. Your password will not show up as you type it.



Now, you need to make sure that you have certain things 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 This command line will allow you to install every program that you need. Remember that not all Linux boxes have the same format. These commands are for a CentOS box. While I know that most people use Ubuntu (and I do), at the time this article was written, I was using CentOS. The commands to install are not too different. For CentOS, you can use this command line. You can also use the "aptget" command if you are using Ubuntu. I suggest you look into your distribution for the right commands.



To verify that you can use rpm extensions, first enter the code: Code: yum - install rpm



You'll need to manually find the RPMs if you're running 32bit. The iptraffa and htop links I provide are for 64bit boxes.



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



You can find the guides for installing MySQL and Java by doing a quick Google search. I won't waste my 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 the Server on Well now I assume you're ready to turn this baby on and start installing plugins. To do this, you will need to open a screen (instance).

Screen does not come pre-installed. You will need to install it. Type: Code: yum install screen

If the above command fails to work, proceed to the next step. After you've installed it, you can now open a new screen.



Go to this link and find the version for your distribution. Next, enter these lines into your 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 type the following into the command line Code: screen -S SERVERNAME



Replace servername with your server's name. It is important that your screen name matches the name of your server. This is so that you can easily identify which server is running on each instance. Once you do this a page should open up like this. My screen will be called "WARCHICKEN" at this point.



Now, you're on the screen. Now, you want to run your start script. You first have to open the file that it is in.



You type: Code: cd /home/SERVERNAME



Since that is the path we decided to use earlier in this guide.



Now you want to type: Code: ./start.sh



This will launch your server. If you get the following message:



It means that your start.sh file was not modified to 770. Please use the following command to do this:



Code: chmod 770 /home/SERVERNAME/start.sh



After the server is on, you can use this screen to enter commands as the server. Hold CTRL+A+D to detach.



To reconnect, type Code: screen-r WARCHICKEN screen-rd WARCHICKEN



-r means to connect. -rd means to connect and kick anyone who is attached. Only one person can view the screen at a given time



You can also use Code: screen-list



You can list all the open screen. To kill a screen, type: 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 you will need to close the screen and then open it again.