Today I am going to explain how i got minecraft working and running on my NethServer…
Dependencies.
- Java
- screen
- Server Version I prefer spigot
- compiling your server.
Optional things that usually help out but because of conflict I don’t use…
The above optional tools help manage minecraft servers very well the downside is that thy install a ton of stuff and I am afraid of breaking my nethserver… Maybe later on when I get a server free I will do some testing with this…
First you need java… If you need different types of java etc… You can read the article i use to set java up the first time it generally leads me in the right direction. click here
My Java installation Directions…
cd ~
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jre-8u60-linux-x64.rpm"
Now you will need to install java.
sudo yum localinstall jre-8u60-linux-x64.rpm
Nano Installation…
Nano is the best editor since sliced bread… I cannot stand vi it drives me nuts… I install nano immediately on any machine I work on or use its just a personal preference thing…
sudo yum install nano
Htop is also a useful tool in any linux environment you work with…
Here is the article I am not going to cover it in detail…
Click Here
Screen Installation.
Now lets install screen if its not already installed by default… In my case i found it already installed but screen is very important for Minecraft server hosting…
sudo yum install screen
Now here is the tricky part…
Open your gui from your web browser.
Example: https://domainname.com:980
Enter your username and password
Now on the left hand side look for Users under the Management section.
Click Create New at the top…
Example user:
Username: minecraft
First Name: minecraft <In my opinion these fields should be optional not required.
Last Name: minecraft <In my opinion these fields should be optional not required.
At the top click Services.
Uncheck Mailbox, Password Expiration, Shared Folders (Samba)
Now here is the bad part… For some reason if you uncheck Remote Shell (ssh) you can not su to that username and perform actions like a normal server… You have to leave Remote Shell (SSH) Check marked.. Bad Security idea… But unfortunately it has to be done…
Hit submit…
Now look in the list for the username minecraft you should notice its greyed out thats important you need to create a password for the user… So click the down arrow next to edit and change your password… Click submit
Okay now moving on to the fun stuff…
Log into your server as the user minecraft
Their is two ways to do this first way is if your already in the server as root type the following su minecraft
If your not already in the server just log into the server as minecraft through ssh… Personally I do not like this because in my opinion ssh should not be enabled for the user but the gui does not give you this option…
“Rant over”
After getting into the server you want to run the command.
cd ~
This puts you in the minecraft user home directory…
to confirm this run the command pwd
in the terminal to display where you are.
It should look some thing like this…
[minecraft@webserver ~]$ pwd
/var/lib/nethserver/home/minecraft
[minecraft@webserver ~]$
Now Lets get the software need to get this show on the road…
Lets make a directory and were going to call it spigotwork
mkdir spigotwork
Now lets cd ./spigotwork
type pwd
to verify your location.
Example listed below…
[minecraft@webserver ~]$ mkdir spigotwork
[minecraft@webserver ~]$ ls
spigotwork
[minecraft@webserver ~]$ cd spigotwork/
[minecraft@webserver spigotwork]$ pwd
/var/lib/nethserver/home/minecraft/spigotwork
[minecraft@webserver spigotwork]$
To get spigot build tool click here Right click on Buildtools.jar and copy link address.
Now back in your terminal… wget "then link address"
example with ls command.
[minecraft@webserver spigotwork]$ wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
[minecraft@webserver spigotwork]$ ls
BuildTools.jar
Now we compile spigot through the BuildTools.jar file.
Example command.
[minecraft@webserver spigotwork]$ java -jar BuildTools.jar
This will take a moment depending on your processor speed and bandwidth available… Typically takes me about 30 seconds roughly in my environment…
While all that is compiling and getting your server.jar file ready now would be a good time to go back to the web gui and enable your firewall ports…
Under Gateway look for Firewall Objects click it. Click on services and then create new.
Name: minecraft
Protocol: TCP/UDP
Port: 25565 <Default Minecraft port.
click submit
Under Gateway look for firewall rules click it and create rule at bottom.
Enabled check marked
Action Accept
Source Any
Destination Any < I tried other settings would not work for some reason…
Service minecraft
Click submit
Now back to the terminal you should by now have every thing completed lets look and see what files are in the folder now by typing ls command.
[minecraft@webserver spigotwork]$ ls
apache-maven-3.2.5 BuildTools.log.txt craftbukkit-1.10.2.jar work
BuildData Bukkit Spigot
BuildTools.jar CraftBukkit spigot-1.10.2.jar
[minecraft@webserver spigotwork]$
Lets now copy Spigot-1.10.2.jar to spigot.jar this makes life a little easier when working with shell scripts and screen…
cp spigot-1.10.2.jar spigot.jar
Now lets cd … back a directory and mkdir server
Example below
[minecraft@webserver spigotwork]$ cd ..
[minecraft@webserver ~]$ mkdir server
[minecraft@webserver ~]$ cp ./spigotwork/spigot.jar ./server/
[minecraft@webserver ~]$ cd server/
[minecraft@webserver server]$
Lets now create our first shell script called start.sh
nano start.sh
An inside this example would be…
#!/bin/sh
java -Xms2G -Xmx2G -jar spigot.jar
The above Memory can be adjusted according to what you wish to use…
Now lets create the screen script to run all this…
nano screenstart.sh
Example config would be…
#!/bin/sh
screen -S minecraft -d -m bash ./start.sh
minecraft = The username of the account important!!
Now lets give everything read write permissions…
chmod +rwx ./screenstart.sh ./start.sh
That should be it to get your minecraft server started and running you will need to go in and edit the config files place your plugins etc as well as maintain the latest version of spigot.jar via running the Buildtools.jar every once in awhile… Good luck on your minecraft hosting…