Hello! My name is TnT and you may remember me from such how-to's as How to improve Minecraft Server Performance, and others that I'll probably write in the future, cause I find this shit fun. Today we are going to walk you through installing a fully functional Minecraft Server (latest version), running the latest Bukkit (Craftbukkit) mod (nightly build), using the latest x64 Java. You want to run x64 java so you can allocate as much RAM as your physical hardware allows, if you should so choose. You will not need the Gnome GUI and everything here will be laid out as newb friendly as possible. (If you think I can clarify something, please ask.) Step 1: Download Ubuntu Server 10.10 x64 and install. Installing Ubuntu itself goes a little outside the scope of this writeup, but its fracking easy. Base install is fine, but you should include OpenSSH server right away (I forgot.) If you forgot, once Ubuntu's booted up, run this command to install SSH Code: sudo apt-get install openssh-server Step 2: SSH into your Ubuntu server. First task is to install x64 Java. Downloading java through command line sucks, because Oracle is like that. If you're using Windows as your desktop, you can use winscp to upload the file to your Ubuntu machine in the temp directory (/tmp). Below we will create a new directory for your java install, move to that directory, copy the file from the /tmp directory (where you uploaded it via winscp), make that file executable, and then run the file for install. Code: sudo mkdir /opt/java sudo mkdir /opt/java/64 cd /opt/java/64 sudo cp /tmp/jre-6u24-linux-x64.bin . sudo chmod 755 ./jre-6u24-linux-x64.bin sudo ./jre-6u24-linux-x64.bin Now we need to set this java as the default java to use. Code: sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/64/jre1.6.0_24/bin/java" 1 Step 3: Download and "install" craftbukkit. Below we will create a new directory for craftbukkit, change ownership to the user you want to run your server as, move to that directory, download craftbukkit and rename it. Code: sudo mkdir /opt/craftbukkit sudo chown <username>:<group> /opt/craftbukkit cd /opt/craftbukkit wget "http://ci.bukkit.org/job/dev-CraftBukkit/Recommended/artifact/target/craftbukkit-0.0.1-SNAPSHOT.jar" mv craftbukkit-0.0.1-SNAPSHOT.jar craftbukkit.jar Step 4: Write some simple startup scripts (personally, I use vi, but you can use whatever). Simple vi commands: i (insert), dd (delete current line), x (delete character), and esc to stop current command. :w (write), :wq (write and quit). Code: vi start.sh Script should look like this: Code: #!/bin/sh java -d64 -Xincgc -Xmx1024M -jar craftbukkit.jar nogui Now make that file executable: Code: chmod 755 start.sh Note: You can just run this command from the command prompt, but it's nice to have the script. (-Xincgc for 512M and over. Otherwise use -Xms<value>) Step 5: Startup your Minecraft server. Code: ./start.sh You will generate a new world, and all files needed to run a Minecraft server. The result is you now have a fully functional Minecraft server running the latest version of Craftbukkit. For more advanced features (running your world on a ramdisk, setting different values for java RAM allocation, etc, see this post on reddit). Advanced Stuff: Updating Craftbukkit upon launch and Remote Machine Backups. Updating Craftbukkit upon Launch: To update Craftbukkit upon launching your server, change your start.sh to reflect the following: Code: #!/bin/sh wget "http://ci.bukkit.org/job/dev-CraftBukkit/Recommended/artifact/target/craftbukkit-0.0.1-SNAPSHOT.jar" rm craftbukkit.jar mv craftbukkit-0.0.1-SNAPSHOT.jar craftbukkit.jar java -d64 -Xincgc -Xmx1024M -jar craftbukkit.jar nogui Remote Backups Using Rsync: This requires you have a separate backup server running an SSH server. First you want to setup SSH keys, so your authentication is seamless. How To Setup SSH keys. (It will ask for a password, leave this blank) Code: cd ~ ssh-keygen -t rsa Now, you want to copy the resulting .pub file to the remote machine using ssh-copy-id. Code: ssh-copy-id -i .ssh/id_rsa.pub remotehostusername@example.com Now you should be able to ssh without a password into that remote host. Code: ssh remotehostusername@example.com Great, SSH keys are all setup. Close your connection to the remote host by typing exit. Now, write a script to perform the rsync operation. Code: cd /opt/craftbukkit vi backupscript.sh The script should look like this: Code: #!/bin/bash active=`pidof rsync` if [ -z $active ]; then /usr/bin/rsync -avz --progress --rsh='ssh -p22' /opt/craftbukkit remotehostuser@example.com:/remote/backup/directory else echo "Backup already running, aborting operation." exit 0 fi exit 0 Now we need to add that as a cron job. Code: crontab -e To backup every 30 minutes, this is the line you should add: Code: 30 * * * * /opt/craftbukkit/backupscript.sh
do a Code: ls -la /opt/craftbukkit and paste the results I see my mistake. Do this: Code: chown <username>:<group> /opt/craftbukkit Your group will be the same as your username.
Followed your steps.. everything works great until I go to run the server: Code: chris@chris-GN553AA-ABA-m9040n:/opt/craftbukkit$ ./start.sh --2011-01-15 17:26:55-- http://artifacts.lukegb.com/artifactory/plugins-snapshot/org/bukkit/craftbukkit/0.0.1-SNAPSHOT/craftbukkit-0.0.1-SNAPSHOT.jar Resolving artifacts.lukegb.com... 67.228.153.21 Connecting to artifacts.lukegb.com|67.228.153.21|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 981594 (959K) [application/java-archive] Saving to: `craftbukkit-0.0.1-SNAPSHOT.jar' 100%[======================================>] 981,594 717K/s in 1.3s 2011-01-15 17:26:56 (717 KB/s) - `craftbukkit-0.0.1-SNAPSHOT.jar' saved [981594/981594] Exception in thread "main" java.lang.NoClassDefFoundError: craftbukkit/jar Caused by: java.lang.ClassNotFoundException: craftbukkit.jar at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266)[/B] Could not find the main class: craftbukkit.jar. Program will exit. Is something just wrong with this build? or is maybe the renaming breaking it?
like im using Cent0s on a linux vps so yeah : [minecraft@Woe ~]$ ls -la /home/minecraft/craftbukkit.jar -rw-rw-r-- 1 minecraft minecraft 979110 Jan 16 00:21 /home/minecraft/craftbukkit.jar what do i do know? i still get permission denied when do./start.sh
I do this currently for my server. Run both of these commands and paste the output. Code: java -version cat /opt/craftbukkit/start.sh --- merged: Jan 15, 2011 10:48 PM --- Can you do an ls -la on /home/minecraft/start.sh please?
Code: chris@chris-GN553AA-ABA-m9040n:~/minecraft/bin$ java -version java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.2) (6b20-1.9.2-0ubuntu2) OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode) chris@chris-GN553AA-ABA-m9040n:~/minecraft/bin$ cat /opt/craftbukkit/start.sh #!/bin/sh wget "http://artifacts.lukegb.com/artifactory/plugins-snapshot/org/bukkit/craftbukkit/0.0.1-SNAPSHOT/craftbukkit-0.0.1-SNAPSHOT.jar" rm craftbukkit.jar mv craftbukkit-0.0.1-SNAPSHOT.jar craftbukkit.jar java -Xms4096M -Xmx4096M craftbukkit.jar nogui Thanks for the quick reply
sure here you go:[minecraft@Woe ~]$ ls -la /home/minecraft/start.sh -rw-rw-r-- 1 minecraft minecraft 57 Jan 16 00:28 /home/minecraft/start.sh
Try updating your Java, you're a few versions behind. Also, you're using OpenJDK, not Sun Java, so you may be having problems there. Here is mine: Code: tnt@Dozer:~$ java -version java version "1.6.0_23" Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)
It's weird.. I've downloaded the correct java.. (twice, hah) - and I did the sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/64/jre1.6.0_23/bin/java" 1 to make it "use that java" - and still afterwards when I do the java -version I get the same results as before... gonna try rebooting
thankx --- merged: Jan 15, 2011 11:20 PM --- WHAT?? When i tryed to run it know this happens" Exception in thread "main" java.lang.NoClassDefFoundError: craftbukkit-0/0/1-SNAPSHOT/jar Caused by: java.lang.ClassNotFoundException: craftbukkit-0.0.1-SNAPSHOT.jar at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:319) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:264) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332) Could not find the main class: craftbukkit-0.0.1-SNAPSHOT.jar. Program will exit.
Thanks! Will do.. but now it looks like the other guy in this thread has the same error... maybe it's just a bug in the build. kmod runs fine... :X
java version "1.6.0_17" OpenJDK Runtime Environment (IcedTea6 1.7.5) (rhel-1.16.b17.el5-x86_64) OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode) [minecraft@Woe ~]$ cat /opt/craftbukkit/start.sh cat: /opt/craftbukkit/start.sh: No such file or directory [minecraft@Woe ~]$ cat /home/minecraft/start.sh #!/bin/sh java -Xms2030M -Xmx2560M craftbukkit-0.0.1-SNAPSHOT.jar nogui
New build is out - (#41), but the other guy is also using OpenJDK, and I've heard that can be a real pain with Minecraft.
Hey guys, Minecraft and CraftBukkit need Sun Java. If you're using OpenJDK's JRE it's not going to work.
Same advice as I gave OneManArmy. Uninstall your OpenJDK and install Sun Java. OpenJDK can be a real pain with Minecraft.
Just a side note... at the end of the install this time around I did this: sudo update-alternatives --set java /opt/java/64/jre1.6.0_23/bin/java to make it the default java installation and now it's good to go. - sort of: Code: Exception in thread "main" java.lang.NoClassDefFoundError: craftbukkit/jar Caused by: java.lang.ClassNotFoundException: craftbukkit.jar at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: craftbukkit.jar. Program will exit. chris@chris-GN553AA-ABA-m9040n:/opt/craftbukkit$ java -version java version "1.6.0_23" Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)
I haven't ran RedHat in a long time, or centos either. you can try following this site, (command below) or maybe try uninstalling using yum. Code: rpm -e java-1.6.0-openjdk --- merged: Jan 15, 2011 11:45 PM --- Can you give me an ls -la on your /opt/craftbukkit dir?
Sho: Code: chris@chris-GN553AA-ABA-m9040n:/opt/craftbukkit$ ls -la total 1944 drwxr-xr-x 2 chris chris 4096 2011-01-15 18:38 . drwxr-xr-x 6 root root 4096 2011-01-15 17:18 .. -rw-r--r-- 1 chris chris 981890 2011-01-15 18:00 craftbukkit-0.0.1-SNAPSHOT.jar.1 -rw-r--r-- 1 chris chris 981890 2011-01-15 18:00 craftbukkit.jar -rwxr-xr-x 1 chris chris 261 2011-01-15 17:52 start.sh -rw------- 1 chris chris 12288 2011-01-15 17:23 .start.sh.swp
Code: Exception in thread "main" java.lang.NoClassDefFoundError: craftbukkit/jar Caused by: java.lang.ClassNotFoundException: craftbukkit.jar at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: craftbukkit.jar. Program will exit. chris@chris-GN553AA-ABA-m9040n:/opt/craftbukkit$ ls -la total 984 drwxr-xr-x 2 chris chris 4096 2011-01-15 18:52 . drwxr-xr-x 6 root root 4096 2011-01-15 17:18 .. -rw-r--r-- 1 chris chris 981890 2011-01-15 18:00 craftbukkit.jar -rwxr-xr-x 1 chris chris 261 2011-01-15 17:52 start.sh -rw------- 1 chris chris 12288 2011-01-15 17:23 .start.sh.swp
Run this: Code: pwd If the output is not /opt/craftbukkit, change to the /opt/craftbukkit directory: Code: cd /opt/craftbukkit Then run your ./start.sh again. Please paste the full output, including your initial command.
Code: chris@chris-GN553AA-ABA-m9040n:/opt/craftbukkit$ pwd /opt/craftbukkit chris@chris-GN553AA-ABA-m9040n:/opt/craftbukkit$ ./start.sh --2011-01-15 19:02:01-- http://artifacts.lukegb.com/artifactory/plugins-snapshot/org/bukkit/craftbukkit/0.0.1-SNAPSHOT/craftbukkit-0.0.1-SNAPSHOT.jar Resolving artifacts.lukegb.com... 67.228.153.21 Connecting to artifacts.lukegb.com|67.228.153.21|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 981890 (959K) [application/java-archive] Saving to: `craftbukkit-0.0.1-SNAPSHOT.jar' 100%[======================================>] 981,890 713K/s in 1.3s 2011-01-15 19:02:03 (713 KB/s) - `craftbukkit-0.0.1-SNAPSHOT.jar' saved [981890/981890] Exception in thread "main" java.lang.NoClassDefFoundError: craftbukkit/jar Caused by: java.lang.ClassNotFoundException: craftbukkit.jar at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: craftbukkit.jar. Program will exit. chris@chris-GN553AA-ABA-m9040n:/opt/craftbukkit$
http://www.java.com/en/download/manual.jsp --- merged: Jan 16, 2011 12:17 AM --- I SEE IT! Change this: Code: java -Xms4096M -Xmx4096M craftbukkit.jar nogui To This: Code: java -Xms4096M -Xmx4096M -jar craftbukkit.jar nogui Sorry guys, I fucked up the initial instructions. They've been fixed.