This tutorial will teach you how to set up a dedicated Minecraft instance. I’ll be doing this on a Debian 7.11 x64 VPS from DigitalOcean. My goal in writing this tutorial is to give a quick, step-by-step walkthrough that will let you get a secure “Vanilla” Minecraft server up and running in under 30 minutes.
To follow along, you’ll need an SSH client. For the quickest and easiest, i’d highly suggest puTTy. If you really want to immerse yourself in a Linux environment even from Windows, check out Cygwin – i’ll make a walkthrough on how to configure it later on.
Root puTTy connection
Let’s get started. Open up puTTy or your preferred SSH client and enter your connection details. Initially, we’ll be connecting as the root
account to get things configured.
Your screen should look similar to to the image to the right.
After password reset, you should see this screen.
Next, hit enter, and you’ll get a prompt telling you that the hosts key is not cached in the registry. We’ll come back to this in the future, but for now, click “Yes” and you’ll end up with a login screen. Enter the password for your root account and hit enter, then follow the prompts to change your password.
Finally, you’re on your server. Now the fun stuff begins.
Let’s run a few commands (the parts in bold):
First, update all existing (system default) repositories and programs to the most recent version available in your repositories.
root@1:~# apt-get update
root@1:~# apt-get install nano
Next, we’ll install Python 3. We won’t actually use it in this tutorial, but we’ll come back to it!
root@1:~# apt-get install python3
Once that’s completed, we need to add some new repositories, then install Java 8.
root@1:~# echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
root@1:~# echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
root@1:~# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
root@1:~# apt-get update
root@1:~# apt-get install oracle-java8-installer
root@1:~# java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
Assuming the output of the java -version command looks good, we’ll install tmux (equivalent to “screen”).
root@1:~# apt-get -y install tmux
Now that all of our software prerequisites are installed, we’ll want to get off of the root account. Before we can do that, let’s add a group for our admin accounts and other accounts.
root@1:~# sudo groupadd MinecraftAdmins
Add a few users here, one for yourself and one dedicated to running the Minecraft server. You may want to add individual accounts for each of your admins
root@1:~# adduser minecraft
root@1:~# adduser colin
root@1:~# sudo usermod -a -G MinecraftAdmins minecraft
root@1:~# sudo usermod -a -G MinecraftAdmins colin
Add elevated rights for the Minecraft user with visudo.
# Add this line to the visudo page.
Minecraft ALL=(ALL:ALL) ALL
At this point, disconnect as root, and reconnect as your new ‘minecraft’ user.
Now the fun stuff! We’ll organize and download the minecraft server executable. We’ll be downloading version 1.12.2
minecraft@1:~# mkdir ~/servers
minecraft@1:~# mkdir ~/servers/vanilla
minecraft@1:~# cd ~/servers/vanilla
minecraft@1:~# wget https://s3.amazonaws.com/Minecraft.Download/versions/1.12.2/minecraft_server.1.12.2.jar -O minecraft_server.jar
So close! Just a few more steps. Let’s set up a basic launcher script.
minecraft@1:~# nano startServer.sh
You can copy and paste the following into the script, or type it out if you want to!
java -Xms1G -Xmx2G -jar minecraft_server.jar -o true
Save and quit (if you used nano, it’s , then Y.
Make the script you created executable and run it!
minecraft@1:~# chmod +x startServer.sh
The first time we run this, it will fail since we haven’t accepted the EULA yet. Edit the file that was generated in the ~/servers/vanilla directory called “eula.txt”
minecraft@1:~# nano eula.txt
Let’s create a new tmux session and start up the server!
minecraft@1:~# tmux new-session -n vanilla -s vanilla
And it’s up! In the next sections we’ll go over making our server more secure, automating some tasks, backups and a bunch of other stuff.
Thanks for reading and I hope this was helpful, leave a comment if you have issues with any of the steps!