Jump to content

Installing Minecraft on a Linux Server

Recommended Posts

Linux Server Box

There are a couple things you're going to need in-order to properly run a command line, or terminal, over a linux server box. 




  • Linux server box(All command lines in this tutorial are operational on CentOS) (See "Finding a Host" Section!!)
  • Knowledge of any FTP client
  • Knowledge of basic command line navigation (As long as you have a basic understanding to what "terminal" is then you should be fine)


What you need to download:


  • Some form of SSH Client (I prefer putty)
  • Some form of FTP client (I prefer Filezilla)
  • The newest version of craftbukkit. (Always pick the best build for your version of minecraft.) [Recommended > Beta >Development]


What is SSH?

SSH or Secure Shell Hosting is where you remotely connect to other computers where you can perform a large range of tasks through a command line. Think of it like your CMD on your computer, yet has more functionality and is way more advanced. SSH is commonly used in dedicated servers allowing for full function of the server. If you're interested in getting a dedicated server, it is important that you look at this section. However, SSH isn't limited to just dedicated hosting.


What is FTP?

FTP or File Transfer Protocol is where you can remotely delete, modify, create, or add files to the physical server. With the FTP client Filezilla, you can see your files as they would look like on your computer. You can simply drag and drop things from your computer to the FTP.


Finding a Host

It is important when looking for a minecraft host that you get the right stuff for your money. SSH can apply to all types of servers but I recommend getting a dedicated server. If you're willing to dish out a decent amount of money for a good minecraft server then you should do so. If you plan on ever running a serious minecraft server, dedicated server is the only way to go. Most dedicated servers can handle over 100 players. My personal favorite host is allgamer. 


Connecting to your SSH Server


(Step 1)
Alright, first what you want to do is open up your SSH client (putty)

(Step 2)
In the Hostname[or IP address] section put the IP to your server. If the port is blank or has any other port than 22, change it to 22. Port 22 is your default SSH port. Remember: It is not your Minecraft Port. And click 'Open'.


(Step 3)
Type the username provided usually by email from your hosting company and press enter.


(Step 4)
Copy the password provided usually by email from your hosting company and right click on the screen. This is the pasting method to SSH terminal. You will not see any changes because the input of your password on the screen do not generate characters for security purposes. Press enter.


(Step 5)
You're now in root. But, for security purposes, (and good practice), we're going to make a user and use that instead of using root. Why?


Note: Do not log into that user until I've told you so. Stay in root.


Alright, so do the following command:

adduser -p <yourpassword> <yourusername>


Look at you being a Unix expert and whatnot. Oui


So, we're done with this part.


Creating your start.sh

Now creating your start.sh can be tricky, but you MUST look at this tutorial completely if you want to run your server. First let's start by explaining what a "start.sh" is. It is important that you look over this section carefully.


What is a "start.sh"?
A start.sh is the execution starter that is recognized by your SSH client. When initiated, it starts the process of starting your server on a thread. When creating your start.sh it's important that you know the total amount of RAM on your server box. If you don't know, you need to find out. Refer back to your webhost to see.


(Step 1)
Open up your FTP (Filezilla). You should see this at the top:

(Step 2)
In the host put the IP of your server. In the username put the username given in the receive email and put the password. In the port put 21. 21 is the default port for FTP. Then click the 'QuickConnect' button.


Congratulations, you are now connected to your servers FTP!


(Step 3)
First, you want to find a suitable directory for your server to be in. With my old server, I just did /server So, what you do is right click on your folder that says "/" And click the create directory tab. Name the folder(directory) "server".


(Step 4)
In your empty server folder. Drag and drop your craftbukkit.jar file into it. Be sure to rename your craftbukkit.jar to craftbukkit.jar. You don't have to, it just makes it easier for later on.


(Step 5)
On your desktop make a new notepad and name it start.sh then open it. The following is an example start.sh. Do not copy it exactly, because it won't be right.
java -server -Xms6G -Xmx10G -jar craftbukkit.jar
Xms shows how much RAM you want to allocate for your server.
Xmx is your total RAM.


You do not ever want to allocate all of your RAM to your minecraft server. The reason being is, there are more processes running on that system than minecraft. You need to make space for them too. I usually put 3/4 RAM allocated to my minecraft server but that's only if I'm running the minecraft server on the box. Remember, you want atleast 2GB to be safe, but I recommend more.


(Step 6)
By now, you should have the start.sh completed, and saved. Also, you should have your craftbukkit.jar on the FTP. Place the start.sh onto the FTP in the same folder as the craftbukkit.jar and exit the FTP.


Congratulations, you have successfully created your start.sh!


Starting your Minecraft Server

Alright, starting your minecraft server can be pretty easy or you can make it entirely hard. If you followed each of the following steps to the exact specifications and methods, you shouldn't have a problem. 


Understanding your SSH security
Navigating through command-line there is a couple things that you should take note of.


  • If you don't know what you're doing. Don't do it.
  • If it's not broken, don't fix it.
  • Consult multiple guides for consistency. Some guides may be outdated or wrong. Check with multiple guides before you go and test something.


The reason why I'm saying all of this is because, you can seriously mess up your HD by doing stuff that you're not suppose to be doing. Like for example using all of your memory all of the time. This will cook your HD. Not good. So, it's important that you know what you're doing before you actually do it.


(Step 1)
Make sure you've done your start.sh, you've placed the craftbukkit.jar in your FTP. Once you have done this, connect to your root account. (See "Connecting to your SSH Server" section.)


(Step 2)
Installing java is pretty easy actually, and it's kinda obvious why you need it.

yum install java

It is recommended that you install Sun Java however, it's a long painful process.


(Step 3)
Now, if you plan on running, say a test server of some sort, it's important to have "Screens". Screen is an application that you can get for your linux SSH client which will allow you to have multiple sessions for your terminal. You can easily get screens by doing the following:


yum -y install ncurses-devel texinfo pam-devel libtool

This one downloads all the dependencies that are required to run Screen.


yum install screen

And this actually installs the application.


The reason why having screen's is a good thing is because this not only more options to your terminal, but it also, allows other users to be able to connect to the terminal.


When people are connected to a terminal, they cannot run on the same socket, therefore it will inadvertently kick the other user off the SSH server. With Screens, you can know when someone is using the server console and when it is free to use, it also is easier to kill processes with it aswell. 


(Step 4)
Alright, now that you have java and screens installed. You want to type the following command 

screen -list

And you should see something like this:


Quick commands:

  • screen -S NAMEHERE "This creates a session for you."
  • screen -rd NAMEHERE "This will detach anyone from the session and log you onto it."
  • ALT + A, ALT + D "This will detach you from the session, alternatively, you can do screen -d"
  • screen -list "This will show all sessions on this terminal that are active and dead."
  • kill -9 NUMBERHERE "In screen -list, it should show a 4-8 digit number before the sockets. This will stop that session forcefully."
  • screen -wipe "This will clear all dead sockets on the terminal."


(Step 5)

Alright it's time to start using your user account but before we do, you need to give yourself permission to use everything minecraft related. You shouldn't ever need to be in root to use your minecraft server


Note: Be sure to change the username in the commands with the one you set up previously (See Step #5 in Connecting to your SSH Server)


Type (This will create a group):

groupadd minecraft

Then type (This will add your username to the group):

usermod -a -G minecraft <whicheverusernameyouused>

Type this (This gives your user exclusive rights to your minecraft folder):

chown -R <whicheverusernameyouused>:minecraft /server

Type this (Give group members read and execute privileges):

chmod -R g=rx /server

Type this (Give user read/write/execute privileges):

chmod -R u=rwx /server

You're probably wondering in these two last commands how it finds the user and group. Well, it's because when you did this: 


chown -R <whicheverusernameyouused>:minecraft /server

You gave yourself ownership of that folder


(Step 6)
Now it's time to relog and connect via your username. (The one you created Step #5 of Connecting to your SSH Server).


(Step 7)
In your SSH command line, you will have to get the directory of the things you're trying to do.




This will allow you to do anything within the confines of the directory "/server". You have to do this every time you log into the SSH client. so it's important that you get religious when performing these tasks.


(Step 8)
Now last, you want to type


You should have started your minecraft server.


[Common Problems]
If it's saying you don't have permission, do the following command -

chmod -R 770 /start.sh



It says you must be running on a different port:


Means you either still have the thread up for a minecraft server and are using the port.

netstat -o -n -a | findstr 0.0:25565

... Or you didn't properly set it up in config.yml in your minecraft server folder. Connect to the FTP and check out your bukkit config.yml in your server folder, and see if the connection port is 25565, this is the default port for a minecraft server. You know, the port that allows you just put the mc.awesomeminecraftserver.net and not have the ugly :25234 at the end.

  • Like 1

Share this post

Link to post
Share on other sites
728x90 Rotation 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now