Basic Minecraft Server on Joyent

Update Dec 19, 2013

Minecrab - Minecraft Hosting on Joyent.

A recent hackathon at Joyent has led to Minecrab - a full set of scripts for running Minecraft on Joyent.
Read the blog here.


March 3 2013
Assuming you have already set up a Joyent account and an ssh key, and know how to use the nano text editor.
This install takes about 15 minutes to get to a working high-performance basic Minecraft server with firewall and whitelist.
Update 27 June 2013 - See Greg Gaskill's blog http://greggaskill.us/2013/06/minecraft-on-smartos and repository https://github.com/aboron/minecraft-smartos-smf  for more information about setting up a SmartOS service manifest for Minecraft Craftbukkit.


Provision a SmartOS Machine from the JoyentCloud.


Log into your JoyentCloud account.

Provision a Machine

Provision a Machine Step 1 - select a base64 SmartOS Image.
[I selected the us-west-1 datacenter, but pick the closest one to you]



Step 2 - Select a Size. For this case our settings are for
Medium 2Gb RAM, 2CPU. (If you choose Small - you will
have to lower the Java ram settings on the start.sh script.)



Step 3 - Confirm and Customize - Name your Machine Here



Provisioning takes about 1min, 50 seconds and your machine is live.
The IP address for this example is 8.19.35.121 - this is where
you will ssh into as root.










SSH into your Machine and Set it up.

or set up your own SmartOS host machine (no kvm required) and install pkgin.

From a Linux machine, I initially set up my ssh key for Joyent from.
(Windows can use PuTTY for setting up ssh keys and for ssh access)
The passphrase is used in this case for authentication.

[estate@greg ~]$ ssh -i joyenthogue-rsa-key.blueprint.org root@8.19.35.121
The authenticity of host '8.19.35.121 (8.19.35.121)' can't be established.
RSA key fingerprint is 3a:00:f8:12:c7:5b:6a:70:36:27:73:84:cd:2c:08:44.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '8.19.35.121' (RSA) to the list of known hosts.

Enter passphrase for key 'joyenthogue-rsa-key.blueprint.org':
Last login: Sun Mar  3 07:44:15 2013 from 58.182.4.249
   __        .                   .
 _|  |_      | .-. .  . .-. :--. |-
|_    _|     ;|   ||  |(.-' |  | |
  |__|   `--'  `-' `;-| `-' '  ' `-'
                   /  ; SmartMachine base64 1.8.4
                   `-'  http://wiki.joyent.com/jpc2/SmartMachine+Base

[root@612044b5-21bf-4854-8d70-57ecd9698d2e ~]#


Once you are in, INSTALL java, wget, nano with pkgin:

#pkgin install sun-jre6-6.0.26

# java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)


#pkgin in wget

#pkgin in nano

Now you can install the Minecraft *.jar with the following commands:

#cd /opt/local
#mkdir minecraft
#cd minecraft
#wget https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar

This is a very basic startup shell script - but make sure that the java command is all on one line.
Start up the nano editor, with the file start.sh.


#nano start.sh

_________type or paste contents -backspace so that java command is all on one long line.

#!/bin/bash
cd /opt/local/minecraft
java -d64 -server -Xms1G -Xmx1792M -Djava.security.egd=file:/dev/random -XX:-UseVMInterruptibleIO -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=4 -XX:+AggressiveOpts  -jar minecraft_server.jar nogui
___________________________________________________________________________________
The nano result should look like this, java command all on one line.


___________________save with [ctrl-o]

Enable the shell script to be executed.
#chmod +x start.sh



Set up the FIREWALL

#svcadm disable ipfilter

#nano /etc/ipf/ipf.conf
__________________________contents to add/modify for SSH and Minecraft ports incoming only.
pass out from 8.19.35.69 to any keep state
pass in quick from any to 8.19.35.69 port=25565
pass in quick from any to 8.19.35.69 port=22


It should look like this...
_________________________save with [ctrl-o]


#svcadm enable ipfilter
#svcadm restart ipfilter


When ipfilter is enabled - you cannot get a ping response from the machine.
When ipfilter is disabled - you get a ping response from the machine.


START YOUR MINECRAFT SERVER


[root@612044b5-21bf-4854-8d70-57ecd9698d2e /opt/local/minecraft]# svcadm enable ipfilter
[root@612044b5-21bf-4854-8d70-57ecd9698d2e /opt/local/minecraft]# ls
minecraft_server.jar  start.sh
[root@612044b5-21bf-4854-8d70-57ecd9698d2e /opt/local/minecraft]# ./start.sh
210 recipes
27 achievements
2013-03-03 07:56:10 [INFO] Starting minecraft server version 1.4.7
2013-03-03 07:56:10 [INFO] Loading properties
2013-03-03 07:56:10 [WARNING] server.properties does not exist
2013-03-03 07:56:10 [INFO] Generating new properties file
2013-03-03 07:56:10 [INFO] Default game type: SURVIVAL
2013-03-03 07:56:10 [INFO] Generating keypair
2013-03-03 07:56:10 [INFO] Starting Minecraft server on *:25565
2013-03-03 07:56:10 [WARNING] Failed to load operators list: java.io.FileNotFoundException: ./ops.txt (No such file or directory)
2013-03-03 07:56:10 [WARNING] Failed to load white-list: java.io.FileNotFoundException: ./white-list.txt (No such file or directory)
2013-03-03 07:56:10 [INFO] Preparing level "world"
2013-03-03 07:56:11 [INFO] Preparing start region for level 0
2013-03-03 07:56:12 [INFO] Preparing spawn area: 8%
2013-03-03 07:56:13 [INFO] Preparing spawn area: 15%
2013-03-03 07:56:14 [INFO] Preparing spawn area: 24%
2013-03-03 07:56:15 [INFO] Preparing spawn area: 34%
2013-03-03 07:56:16 [INFO] Preparing spawn area: 46%
2013-03-03 07:56:17 [INFO] Preparing spawn area: 56%
2013-03-03 07:56:18 [INFO] Preparing spawn area: 69%
2013-03-03 07:56:19 [INFO] Preparing spawn area: 80%
2013-03-03 07:56:20 [INFO] Preparing spawn area: 92%
2013-03-03 07:56:20 [INFO] Done (10.357s)! For help, type "help" or "?"



Set up your Minecraft OP & Whitelist


op old_prof_hogue
2013-03-03 07:56:38 [INFO] Opped old_prof_hogue
op Prof_Hogue
2013-03-03 07:56:45 [INFO] Opped Prof_Hogue
whitelist on
2013-03-03 07:57:02 [INFO] Turned on the whitelist
whitelist add old_prof_hogue
2013-03-03 07:57:09 [INFO] Added old_prof_hogue to the whitelist
whitelist add Prof_Hogue
2013-03-03 07:57:16 [INFO] Added Prof_Hogue to the whitelist

ADD the Server IP to your Minecraft Client and Play.

In this case it is
8.19.35.121:25565
- use your IP address and selected Port from the machine you provisioned
If you change port, change the firewall to match!




ċ
Christopher Hogue,
Mar 3, 2013, 2:05 AM
Comments