{"id":3464,"date":"2011-11-24T19:08:54","date_gmt":"2011-11-25T03:08:54","guid":{"rendered":"https:\/\/www.ultrasaurus.com\/?p=3464"},"modified":"2011-11-24T19:08:54","modified_gmt":"2011-11-25T03:08:54","slug":"setting-up-ec2-minecraft-server","status":"publish","type":"post","link":"https:\/\/www.ultrasaurus.com\/2011\/11\/setting-up-ec2-minecraft-server\/","title":{"rendered":"setting up ec2 minecraft server"},"content":{"rendered":"
Goal: set up a minecraft server using free EC2 account from OSX
\n[update: FAIL — game play doesn’t work on a micro instance, if we want to use EC2 it looks like we need to use at least a small one. so be careful to adjust the steps below to pick a small instance if you want to play.]<\/p>\n
I learned that there are a lot of minecraft server implementations. I decided to use Craftbukkit server largely because I saw it referenced from a RubyConf talk<\/a> by Tom Enebo<\/a> — might be fun to mod it someday :)<\/p>\n I pieced together information from some helpful tutorials from Ubuntu<\/a> and Robert Sosinski<\/a>.<\/p>\n [Update] By tweaking the memory allocation, we can get it to work (most of the time) with a single player. I found that I can raise the memory allocation for java and use virtual memory, but that it sometimes maxes out the CPU. <\/p>\n Here’s the setting where the game couldn’t be failed (couldn’t fight monsters or build things):<\/p>\n Note: With this it sometimes works:<\/p>\n With this works almost all the time (but we’ve only tested one player):<\/p>\n when the CPU maxes out, I see this in the game console: Goal: set up a minecraft server using free EC2 account from OSX [update: FAIL — game play doesn’t work on a micro instance, if we want to use EC2 it looks like we need to use at least a small one. so be careful to adjust the steps below to pick a small instance if… Continue reading \n
\n
\n
\n
\n
\n
\n
\n# Setup Amazon EC2 Command-Line Tools
\nexport EC2_HOME=~\/.ec2
\nexport PATH=$PATH:$EC2_HOME\/bin
\nexport EC2_PRIVATE_KEY=`ls $EC2_HOME\/pk-*.pem`
\nexport EC2_CERT=`ls $EC2_HOME\/cert-*.pem`
\nexport JAVA_HOME=\/System\/Library\/Frameworks\/JavaVM.framework\/Home\/<\/code><\/li>\n
\nsource ~\/.bash_profile<\/code><\/li>\n<\/ul>\n<\/li>\n
\n
\nec2-run-instances ami-cf33fea6 –instance-type t1.micro –region us-east-1 –key ec2<\/li>\n
\nec2-describe-instances<\/code><\/li>\n
ec2-###-##-##-##.compute-1.amazonaws.com<\/pre>\n<\/li>\n
\nec2-authorize default -p 22
\nec2-authorize default -p 80
\nec2-authorize default -p 25565
\n<\/code><\/li>\n
\nssh -i ec2.pem ubuntu@ec2-###-##-##-##.compute-1.amazonaws.com<\/code><\/li>\n
\nNote: to accept the license, use tab to get to the OK “button” then hit return, then arrow to get to “Yes” and hit return again.
\nTo verify installation:
\n$ java -version
\njava version “1.6.0_26”
\nJava(TM) SE Runtime Environment (build 1.6.0_26-b03)
\nJava HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)<\/li>\n\n
\nwget http:\/\/ci.bukkit.org\/job\/dev-CraftBukkit\/lastSuccessfulBuild\/artifact\/target\/craftbukkit-1.0.0-SNAPSHOT.jar\n<\/pre>\n<\/li>\n
\n#!\/bin\/sh\njava -Xmx613M -Xincgc -jar craftbukkit-1.0.0-SNAPSHOT.jar\n<\/pre>\n<\/li>\n
\nscreen\n.\/start.sh\n<\/pre>\n<\/li>\n<\/ol>\n
#!\/bin\/sh\njava -Xmx613M -Xincgc -jar craftbukkit-1.0.0-SNAPSHOT.jar\n\n$top\n PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND \n 1642 ubuntu 20 0 978m 300m 10m S 12.3 50.7 100:44.96 java \n<\/pre>\n
\nVIRT – 978M of virtual memory
\nRES – 300m resident (physical) memory<\/p>\n
\n\n#!\/bin\/sh\njava -Xmx1024M -Xincgc -jar craftbukkit-1.0.0-SNAPSHOT.jar\n\n 2829 ubuntu 20 0 1336m 271m 10m S 14.0 45.8 0:18.76 java \n<\/pre>\n
\n\n#!\/bin\/sh\njava -Xmx2048M -Xincgc -jar craftbukkit-1.0.0-SNAPSHOT.jar\n\n PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND \n 2893 ubuntu 20 0 2499m 341m 10m S 99.8 57.6 0:27.68 java \n\n 2893 ubuntu 20 0 2499m 341m 10m S 18.2 57.7 1:27.30 java <\/pre>\n
\n22:39:19 [WARNING] Can't keep up! Did the system time change, or is the server overloaded?<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"