Minecraft - Setting up a vanilla Craftbukkit server

Post Reply
User avatar
LHammonds
Site Admin
Site Admin
Posts: 523
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

Minecraft - Setting up a vanilla Craftbukkit server

Post by LHammonds » Sun Jun 01, 2014 12:14 am

Want to setup a vanilla (unmodified) Craftbukkit server? This is how you do it.

NOTE: I am documenting this on a Windows 7 SP1 Ultimate Edition (64-bit) machine. Even though I am using Java 1.7.0_55, you can use any 1.7 or higher version and it will still work.

Prerequisites
  • Oracle Java JRE 1.7.0 Update 55 (64-bit)
  • Craftbukkit 1.7.9-R0.1 (just about any version really)
  • Minecraft Client 1.7.9 (any version that matches the server you are running)
  • Notepad++ 6.6.3 (you can use the normal notepad but this is far superior and free)
Assumptions
  • Java is installed to the default folder: C:\Program Files\Java\jre7\bin
Initial Setup
  1. Create the following folder: C:\Craftbukkit
  2. Download craftbukkit-1.7.9-R0.1.jar and place it in C:\Craftbukkit\
  3. Rename craftbukkit-1.7.9-R0.1.jar to server.jar
  4. Create the following file and place the contents inside it and save:
    C:\Craftbukkit\start-server.bat

    Code: Select all

    @ECHO OFF
    TITLE Craftbukkit
    SET RAM2USE=2048
    CD /D C:\Craftbukkit
     
    REM ** Look for a version of Java 8 that matches the OS (32-bit for 32-bit, 64-bit for 64-bit) **
    IF EXIST "%ProgramFiles%\Java\jre8\bin\java.exe" GOTO JAVA8DEFAULT
     
    REM ** Look for 32-bit version of Java 8 on 64-bit OS **
    IF EXIST "%ProgramFiles(x86)%\Java\jre8\bin\java.exe" GOTO JAVA832BIT
     
    REM ** Look for a version of Java 7 that matches the OS (32-bit for 32-bit, 64-bit for 64-bit) **
    IF EXIST "%ProgramFiles%\Java\jre7\bin\java.exe" GOTO JAVA7DEFAULT
     
    REM ** Look for 32-bit version of Java 7 on 64-bit OS **
    IF EXIST "%ProgramFiles(x86)%\Java\jre7\bin\java.exe" GOTO JAVA732BIT
     
    REM ** Look for a version of Java 6 that matches the OS (32-bit for 32-bit, 64-bit for 64-bit) **
    IF EXIST "%ProgramFiles%\Java\jre6\bin\java.exe" GOTO JAVA6DEFAULT
     
    REM ** Look for 32-bit version of Java 6 on 64-bit OS **
    IF EXIST "%ProgramFiles(x86)%\Java\jre6\bin\java.exe" GOTO JAVA632BIT
     
    :JAVA8DEFAULT
    REM ** This will execute if run on a 32-bit OS with a 32-bit version of Java 8 **
    REM ** This will execute if run on a 64-bit OS with a 64-bit version of Java 8 **
    "%ProgramFiles%\Java\jre8\bin\java.exe" -Xmx%RAM2USE%M -Xms%RAM2USE%M -jar server.jar nogui
    GOTO DONE
     
    :JAVA832BIT
    REM ** This will execute if run on a 64-bit OS with only a 32-bit version of Java 8 **
    "%ProgramFiles(x86)%\Java\jre8\bin\java.exe" -Xmx%RAM2USE%M -Xms%RAM2USE%M -jar server.jar nogui
    GOTO DONE
     
    :JAVA7DEFAULT
    REM ** This will execute if run on a 32-bit OS with a 32-bit version of Java 7 **
    REM ** This will execute if run on a 64-bit OS with a 64-bit version of Java 7 **
    "%ProgramFiles%\Java\jre7\bin\java.exe" -XX:MaxPermSize=128M -Xmx%RAM2USE%M -Xms%RAM2USE%M -jar server.jar nogui
    GOTO DONE
     
    :JAVA732BIT
    REM ** This will execute if run on a 64-bit OS with only a 32-bit version of Java 7 **
    "%ProgramFiles(x86)%\Java\jre7\bin\java.exe" -XX:MaxPermSize=128M -Xmx%RAM2USE%M -Xms%RAM2USE%M -jar server.jar nogui
    GOTO DONE
     
    :JAVA6DEFAULT
    REM ** This will execute if run on a 32-bit OS with a 32-bit version of Java 6 **
    REM ** This will execute if run on a 64-bit OS with a 64-bit version of Java 6 **
    "%ProgramFiles%\Java\jre6\bin\java.exe" -XX:MaxPermSize=128M -Xmx%RAM2USE%M -Xms%RAM2USE%M -jar server.jar nogui
    GOTO DONE
     
    :JAVA632BIT
    REM ** This will execute if run on a 64-bit OS with only a 32-bit version of Java 6 **
    "%ProgramFiles(x86)%\Java\jre6\bin\java.exe" -XX:MaxPermSize=128M -Xmx%RAM2USE%M -Xms%RAM2USE%M -jar server.jar nogui
    GOTO DONE
     
    :DONE
    REM ** This will pause the screen so you can see any error messages after stopping the Minecraft server. **
    PAUSE
    
  5. Double-click start-server.bat and let the server initialize. Once it says "Done" then type "stop" to shutdown the server.
  6. Edit server.properties and change the following values:

    level-seed=686298914
    view-distance=9
    spawn-protection=50
    motd=\u00A7l\u00A74Craft\u00A7cBukkit \u00A7r\u00A7f1.0
  7. Delete the "world," "world_nether" and "world_the_end" folders located in C:\Craftbukkit\
  8. Start the server using start-server.bat and it will generate a new world using the new level seed you configured.
  9. Open Minecraft client and connect to "localhost" or "127.0.0.1"
  10. Once connected to the server, go to the console (black window) and type "op YourInGameName" (example: OP HammondsLegacy)
  11. You can now go back to your Minecraft client and type "/gamemode 1" to enter Creative Mode.
  12. Disconnect from the server and close Minecraft client. On the server console, type "stop" to shut it down cleanly.
Maintenance

It is recommended that you shutdown Minecraft server and reboot the host operating system at least once per day to keep performance levels at maximum. Make sure you issue the "stop" command on the console before rebooting the server to avoid corrupting data files.

It is also recommended to make automated backups at regular intervals. The are many methods and tools you can use for automating these tasks. But the main idea is that you can do your backups while the server is still running by making a "snapshot" of the data as it is running. To do this, issue the following commands on the console:

Code: Select all

say [INFO] Backup started
save-off
save-all
The 1st line lets your currently connected players know that a backup is being made right now. The next line turns off automatic world-saving. The last line has Minecraft write its data in memory to the hard drive.

Once this has been done, you can then copy or synchronize C:\Craftbukkit\*.* to a backup folder. When done copying files, issue the following commands on the console:

Code: Select all

say [INFO] Backup completed
save-on
The 1st line lets your currently connected players know that the backup has completed. The last line tells Minecraft it can take over and write to the hard drive anytime it wants.

Now that you have a copy of your currently-running server in a backup folder, you can then take your time and archive that folder using a program like 7-Zip to compress the contents of that folder and all the sub-folders into a single archive. This will preserve a snapshot of that server at that time even if you refresh the backup folder again with another backup/sync job. How many of these archives you keep is up to you and how much space you have on your system. You might want another job that runs and purges / deletes the older archives based on an age or size you specify.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest