For a while now, I have been told by my nine year old son Emmett (right, dueling Darth Vader) that his social life was suffering because all of his friends at school are playing Minecraft but he wasn’t. While I was unmoved by Emmett’s peer pressure arguments, I had heard through other sources that Minecraft ends up being a pretty fun and creative game for kids. Further, that it can serve as a catalyst for kids to write their first line of code.

So I decided to download the trial and set up a multiplayer server to play with Emmett and seven year old sister Grace (right, hugging apples). Three hours after logging in, none of us had moved, except to turn our heads and shout ridiculous commands and advice to one another. It turns out that multiplayer Minecraft with a few of your favorite small people can be pretty entertaining. What’s more, Emmett and Grace have both started work programming their own Minecraft mods, where they’re learning skills to pay the bills. Ward Cleaver I am not, but I think I’m going to call that a win.

Today, the three of us play on a Minecraft multiplayer server I set up on a VPS. I have it set up to administer remotely in a variety of ways to both lightly troll and protect the Whinnery kids, but one of the more novel features of the admin setup is the ability to issue in-game admin commands to the server via SMS text messages. If you’re game, I’ll show you how to set up a similar Minecraft server with Node.js, running on a VPS from our friends at Digital Ocean .

If you’d like to try this out, you can sign up for Digital Ocean and use the promo code “twilio10” to receive $10 in credits to run your server.

What You’ll Do

Create a Digital Ocean Linux server to run a Minecraft multiplayer server

Install all the prerequisite software on the server

Write a Node.js script to manage a Minecraft server child process and keep it running indefinitely

Pass administrative commands to the running Minecraft server

Create a Node.js web application that can receive text messages through Twilio

Use SMS commands to administer the Minecraft server process

What You’ll Need

Just The Code, Please

Don’t need any help, just the code? Check out the final version of this script here.

Setting Up Our Server

To begin with, we’ll need a machine that we can reach on the public Internet with enough horsepower to run a Minecraft multiplayer server. The instructions in this tutorial assume you are running an Ubuntu Linux server. There are a variety of ways to get a Linux server on the Internet, but a Digital Ocean VPS is easy to set up and configure. Log into your Digital Ocean account, and we’ll create one now:

The first decisions you’ll need to make for your server are what to call it (anything you like) and, more importantly, how much RAM to provision for the server. Conventional wisdom dictates that a Minecraft server process needs about a gigabyte of RAM to run, but for the small load my kids and I put on the server, I’ve found that 512 MB is sufficient. However, you’ll still need a bit of memory headroom to run the rest of the system, so we’ll create a droplet with 1 GB of RAM. If you can swing it, 2 GB is probably better:

As you scroll down the page, you can select a region that is closest to you and your players, and ignore the “Available Settings” for now. The next bit you care about is selecting a system image. Under the “Applications” tab, choose the system image that has Node.js pre-installed:

Now, click the big green “Create Droplet” button. In a few moments, you’ll have a shiny new Linux server created for you! By default, the root user’s password will be e-mailed to your Digital Ocean account’s contact e-mail. Once your server is created, it will be assigned an IP address on the public Internet:

Next, you’ll need to SSH into your server as the root (super admin) user to run a few commands. On OS X, you can open the Terminal app and enter the following command (replace “ipaddress” with your server’s IP address):