Set up a Cloud-based Minecraft Server for Modding with Scriptcraft

Note: THIS CAN GET A BIT COMPLEX, especially if you’re trying to do it with multiple kids. If all you want is a server you can share with friends, I have a page on sharing your local Minecraft server over the Internet. Only use this if you definitely want a cloud-based server.

What You’ll Need

The things you’ll need are three. Three are the things you’ll need.

1: A working copy of Minecraft for PC/Mac

You can get this from Minecraft.net. It is considered a separate purchase from Minecraft PE or Minecraft for consoles, so it may set you back $26.95 if you don’t have it already. Sorry.

2: A Cloud9 Account

Cloud9 is an IDE (Integrated Development Environment) in the cloud for a variety of coding languages. We’ll use it for coding our mods as well as connecting to our Minecraft server in the cloud. Basic accounts are free and you’ll only need a basic account for this. Visit Cloud9 to sign up for your free account.

3: A Digital Ocean Account

Digital Ocean makes it easy to spin up servers in the cloud when you need them. We’ll use Digital Ocean to spin up your Minecraft server. Digital Ocean does cost money and does require a credit card to sign up, but if you use this referral link to sign up, you’ll get an immediate $10 credit which should be enough for 6 weeks or more using the server management tips I’ll provide.

If you don’t have a credit card or cannot afford to pay monthly fees for your server, please use the instructions for setting up a local Minecraft server on your own machine. The modding is basically the same for either a cloud set-up or local, but a cloud-based minecraft server doesn’t depend on you having good hardware and is easier to open up to friends to play on.

If you’ve got the things you need, let’s proceed.

Setting Up your Droplet

If you’ve got your account set up and your $10 credit, now it’s time to create your droplet (which is what Digital Ocean calls individual cloud servers).

Pick a Hostname. This is for your reference and is required. I went with GregMinecraft.

Select the $5 a month server. Later I’ll show you how to temporarily scale it up for more power and memory. By scaling up only when you’re playing, then scaling down when you’re not, you’ll get charged at the $5 a month rate when you’re not using your server (so long as you remember to scale down at the end of playing) and only have to pay an extra 0.8 to 2.3 cents per hour while you’re playing scaled up.

Select a region close to you. For example, in Seattle, I’d select San Francisco. The numbers under the regions represent the data centers in the region. If you have a choice of data centers, it won’t make a big difference which one you choose.

Now you’ll select your operating system distribution. The Ubuntu 14.04 is a good, solid choice and the one I’ve tested these instructions against.

Now, scroll down and click the “Create Droplet” button. Digital Ocean will mail you with the IP address and a temporary root password for your server. When the mail arrives, we can go to the next step.

Configuring Your Developer Environment

Login to your Cloud9 account. We’re going to create a workspace for coding your mods and communicating with your server. Each workspace is a small Linux instance, so you get a Linux terminal with lots of tools as part of the space.

Click the “Create Workspace” button to create a workspace. It may offer you the option to create a new one or clone from URL. Create a new one.

A screen will pop up for setting up some details. Give the workspace a name. I went with “MinecraftIDE.”

Select a private workspace. You can set up one private workspace on a free account.

Select Hosted in the “Hosting” options.

Select a “Custom” image. You may have to scroll down to find it.

Click “Create.”

After a moment, you’ll see the workspace created on the left side of the screen (with the name converted to lowercase). Click on it to select it, then click the “Edit Workspace” button.

On startup, you’ll see three main sections in your workspace once it’s open.

1: The file list. This will show your project directory and the files/folders in it.

2: The editor pane. The files you open to edit will appear here.

3: The terminal pane. This provides a Linux terminal for the workspace. You’ll do a lot of work here for the set-up.

In the following instructions when you see something in brackets, like [your name], do not type [your name], but instead actually type your name. If you copy and paste, make sure you replace the brackets.

In the terminal pane of your Cloud9 workspace (pane 3), type:

ssh root@[IP Address]

This will connect your Cloud9 server to your Digital Ocean Server using the secure shell protocol.

When it asks for the password, you can copy and paste in the password from the email. You’ll need to enter it once for the login, then it will ask for it again so you can change it.

When you change your password, here’s a trick I like to use for secure passwords. Make up a nonsense word, then do three variations on it, like:

baborfgagorfdadorf

According to How Secure is My Password it would take 233 million years to brute force that 18-character password. Hackers can’t use a dictionary attack against it.

Say it out loud (bah-borf, gah-gorf, dah-dorf), to make it easier to remember. You can even sing it (we memorize songs more easily than phrases or sentences). One thing I also like to do is practice logging out and logging back in 5 times to get my hands used to typing the password and help me remember it.

DON’T USE THAT EXACT PASSWORD! Make up one of your own. For a little more security, capitalize the middle or end word.

Now, “root” is the commander of your server. Any programs it runs, run with its authority. For security purposes, we don’t want to run your Minecraft server with root’s authority. So we’re going to create a new user. I’m using “mcadmin” as the user name, but for more security, you can use something different. Type…

useradd mcadmin
passwd mcadmin

Now you’ll have to choose a password for mcadmin and enter it, then you’ll be asked to enter it again. Pick a good one.

sudo adduser mcadmin sudo
chsh -s /bin/bash mcadmin

The last two lines are so that mcadmin can get root’s authority when it needs it and also so mcadmin will login with a helper shell that makes life easier in general.

Now type logout and hit enter to logout of your server. You shouldn’t need to login as root again for a while.

Resizing your server

The secret to keeping your costs low is to scale up your server’s processor and RAM resources while you’re going to be playing Minecraft, then scale it back down when you’re not.

When you login to Digital Ocean now you’ll see your new server in your list of “droplets.” If it’s your first, there will just be one. Click the name of your droplet.

Down the left-side of the screen, you’ll see some options. First select Power and power off your droplet. Then select Resize.

Make sure to choose a “Flexible” resize. If you scale up your disk size, you can’t scale back down. You only need more processor and RAM.

In testing sizes, I found that the server ran well at the third size (2 processors, 2 gigabytes of RAM). Select it, then scroll down and click the button to resize your server.

The last step of the resize is to go back to the Power screen and turn your server back on.

IMPORTANT: When you’re done playing, you need to go back to Digital Ocean and follow these instructions in reverse or you’ll be paying the higher rate while you’re not using your server.

SECURITY TIP: If you’re going to be the only one using your server or your friends will only be on it when you are… Don’t power on after you resize back down. Leave your server turned off until you’re going to play with it again. No one can login to a server that’s not turned on.

Installing Oracle Java

Once your server is resized and turned back on, we’ll go back to your Cloud9 workspace. I’ll use mcadmin as the demo user id. If you created a user with a different name, use that user id.

ssh mcadmin@[IP Address]

Now mcadmin needs someplace safe to put his/her stuff, so let’s create a home directory for mcadmin. Because root owns the main /home directory, we’ll need root’s authority. We’ll get that by starting our command with sudo.

sudo mkdir /home/mcadmin/

We’ll be asked to enter mcadmin’s password, and since we gave mcadmin permission to use sudo when we were root, that will be enough.

Then we want to let mcadmin own its home directory.

sudo chown mcadmin /home/mcadmin/

Now we can navigate to that directory.

cd /home/mcadmin/

Now let’s install Java. For Ubuntu, we’ll use its built in installer apt-get and use the steps provided by the good people at WebUpd8.

sudo add-apt-repository ppa:webupd8team/java

That tells apt-get to add another place to look for installer packages. It will ask you to hit enter for an approval. Please do so.

sudo apt-get update

That tells apt-get to get a list of the files available from the places it knows about. This will add the Java installer (and some other stuff) to the list of things it knows about.

sudo apt-get install oracle-java8-installer

And that will install Java 1.8.0_x. During the installation process, you’ll need to agree to the license. Use your arrow keys to move the highlight to the options (“OK”, then “Yes” on a second screen) and press enter.

When the installation is done, you should be able to check the version by typing in…

java -version

As of this writing, it comes back with 1.8.0_45.

Installing your Minecraft server

Before we actually install the server, let’s hook up the file panel in Cloud9 to your /home/mcadmin directory on your Digital Ocean server. That way you can easily access and edit files.

From the Cloud9 File menu, select “Mount FTP or SFTP server.” A window like below will pop up.

Make sure to select “SFTP” instead of FTP. Then fill it out the same way I have, but with your droplet’s IP address and password. Then click “Create.”

When it’s done, your file panel will look like this:

NOW YOU CAN INSTALL YOUR CANARYMOD MINECRAFT SERVER… YAY!

It’s been a long time getting here. To make life easy, I’ve preconfigured the CanaryMod server for you with a customized superflat world that has plenty of room to dig, underground mines to explore, plus large flat expanses. It has Scriptcraft installed, is in creative mode, and is ready for you to play after you add yourself to the operators list and white list.

By downloading it and installing it, you agree to the EULA. Furthermore, you agree that you download and use this at your own risk without any guarantees, and that you hold me and any related parties harmless in the event that anything goes wrong with your downloading or use of this software.

To download it into your home directory, use the following command: wget http://download.yiddish.ninja/CM1.2.1.zip

To unzip it, you’ll need to install the unzipping program.

sudo apt-get install unzip

Then…

unzip CM1.2.1.zip

When that’s done, you’re five steps from playing on your very own server…

1: Get your UUID: Canarymod has been having trouble resolving usernames to their UUIDs and you’ll need your UUID. Go to McUUID.net to get the UUID for your username.

2: Start the server with this command:sh start.bat.
The server will start up and now you’ll have a server command prompt.

3: Make yourself operator:op [your UUID]

4: For security, only people on the whitelist can login to play, so put yourself on the whitelist.:whitelist add [your UUID]

5: Connect your game to your server…

When the game starts, select “Multi-Player” and when it asks what server you want to connect to, select “direct connect.” There you can add the IP address of your droplet and login. You’re now playing on your brand new Minecraft Server with Scriptcaft.

Thank you for this tutorial. You made setting up a Minecraft server quite easy! Everything (almost) is running swimmingly.

Javascript appears to be running well, with three of my scripts functioning as they should. I have two scripts that prompt player input in the command line. The scripts work when the first player inputs text, but when the second player inputs text, the script breaks and the player input is read as text, not a response to a javascript query.

When the scripts work, there is no line item in the console. After it breaks, there is a line item like this: 18.08 12:48:16 [Server] CanaryMod [INFO]: pig.

As I mentioned, Scriptcraft / CanaryMod otherwise seems to be working well on the server.

Have you encountered this issue before? Any insight you have is much appreciated.

No Warranty

I'm human, I'm imperfect, and I make mistakes. There is no guarantee of accuracy, serviceability, functionality, or applicability of anything I write or link to here. By viewing this site, you agree that you are solely responsible for all outcomes related to that act and release me from any liability.