How to make a MineCraft server w/ CraftBukkit (Ubuntu/Linux)

Discussion in 'Bukkit Help' started by EggRoll, Jan 23, 2011.

  1. Offline

    EggRoll

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I just setup for a server for someone, and he really still doesn't get it so I'm making this guide (I'll add pictures another time)

    XEN>OPENVZ
    LINUX>WINDOWS

    Try getting a Xen based VPS, not a crappy OpenVZ VPS. Xen is more expensive, but it's better.

    This is Ubuntu 10.04 by the way.
    You can do it on other ubuntu versions, but you'll need a different thing for the sources
    You can also do this on other linux distros, you just need to use different commands and sources.

    Things you'll want to download
    Putty: http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe (Let's you run commands on your server)
    WinSCP: http://winscp.net/eng/download.php#download2 (Let's you manage your files)
    CraftBukkit: http://bamboo.lukegb.com/browse/BUKKIT-CRAFTBUKKIT/ (I don't need to explain this one do I?)


    Server Folder
    You can skip this step if you want if you already know where you want to put your server files

    Step 1:
    Open up WinSCP. Connect to your server.
    IP: Your server's IP
    Username: root
    Password: Whatever you made it

    Step 2:
    You can put your files anywhere, I suggest putting it in home.
    Make a folder name "minecraft"


    Installing Java
    You'll need to add sources to install JAVA (JRE)

    Step 1:
    Make sure you have WinSCP opened and connected to your server

    Step 2:
    Go to the root directory

    Step 3:
    Go to the folder "etc", then "apt".

    Step 4:
    Open up the file sources.list in any word editing program

    Step 5:
    Add the following line at the end:
    Code:
    deb [URL]http://archive.canonical.com/[/URL] lucid partner
    Step 6:
    Open Putty, connect to your VPS. Use the same information you used in WinSCP

    Step 7:
    Run the following command:
    Code:
    apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts -y
    Wait for the download to finish, then you're done installing JAVA

    Step 8: (OPTIONAL BUT RECOMMENDED):
    Install screen and zip using this command:
    Code:
    apt-get install zip screen -y


    Download and Using CraftBukkit

    Step 1:
    Go to your minecraft server folder
    Code:
    /home/minecraft
    Step 2:
    You can either manually download Bukkit and move it into your server or run this command in Putty:
    Code:
    wget http://artifacts.lukegb.com/artifactory/plugins-snapshot-local/org/bukkit/craftbukkit/0.0.1-SNAPSHOT/craftbukkit-0.0.1-SNAPSHOT.jar
    Then rename craftbukkit-0.0.1-SNAPSHOT.jar to craftbukkit.jar

    Step 3:
    I suggest you make a server starter file.
    Make a file named "start.sh" (or whatever you want)

    Step 4:
    Enter this command into putty
    Code:
    chmod +x start.sh
    Step 5:
    Put this into your start.sh file:
    Code:
    screen -A -m -d -S "minecraft" java -Xms1024M -Xmx1024M -jar -server -Djava.net.preferIPv4Stack=true -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseAdaptiveGCBoundary -XX:MaxGCPauseMillis=500 -XX:-UseGCOverheadLimit -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:SurvivorRatio=16 -XX:UseSSE=3 -XXarallelGCThreads=3 -XX:+AggressiveOpts craftbukkit.jar nogui
    ( thank to Alexf for this by the way)

    or you can be boring and use this one:
    "java -Xms1024M -Xmx1024M -jar craftbukkit.jar nogui"

    Replace the 1024's with whatever amount of memory you want MineCraft to use.

    Step 6:
    Type the following into Putty:
    Code:
    ./start.sh
    OR
    Code:
    sh start.sh
    Step 7:
    Your server should now be up, to view console type
    Code:
    screen -x minecraft
    OR
    If you used the second command in Step 5, YOU CAN'T DO THIS. SO HA!

    Your MineCraft server should now be up and running

    I'll do a thing on installing plugins when I get time.

    If you need help, you can find me in CraftBukkit's IRC #bukkit or #craftbook
  2. Offline

    Olas

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Good tutorial! Glad to see Linux getting some love.

    Some basic commands that can help you through the "Downloading and Using Craftbukkit" steps if you using commandline:
    Step 1 (moving directories)
    Code:
    cd /home/minecraft
    Step 2 (renaming files; also used for moving them)
    Code:
    mv craftbukkit-0.0.1-SNAPSHOT.jar minecraft_server.jar
    Step 3 (text editor)
    Code:
    nano
    Insert the content into the editor. Ctr+O to write the file and save as "start.h"

    Very basic stuff, I am sure all of you already knew this, but hopefully this will help someone who is new to Linux.
  3. Offline

    highz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Hi Eggroll
    this was the tutorial where i was searching for but i cant get it working!
    I'm trying to run te sh file but it says:

    "screen -A -m -d -S "minecraft" java -Xms1024M -Xmx1024M -jar -server -Djava.net.preferIPv4Stack=true -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseAdaptiveGCBoundary -XX:MaxGCPauseMillis=500 -XX:-UseGCOverheadLimit -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:SurvivorRatio=16 -XX:UseSSE=3 -XX:parallelGCThreads=3 -XX:+AggressiveOpts craftbukkit.jar nogui"

    isn't a comman

    i replaced the smiley with : P but still it doesn't work
    maybe you can upload that file or place the code on http://pastebin.com


  4. Offline

    EggRoll

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @highz
    Did you use
    "apt-get install screen" ??
  5. Offline

    croxis

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    While slightly beyond the scope of the thread, could you post a small explanation of the java parameters?
  6. Offline

    Drizien

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Might I suggest using a different user then root to run the server. I'm a linux newbie (running a minecraft server on a CentOS linux cloud server nonetheless), though from what I've gathered it's always better not to use root to run stuff from.
    Correct me if I'm wrong though.
  7. Offline

    EggRoll

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @Drizien
    What would make you think of this? It's so much easier, you don't get "PERMISSION DENIED" all the time and you don't have to to use sudo and type in your password every time.
  8. Offline

    Obsidian

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Steps 2-5 can be done more effectively via ssh, using something like vi, emacs, or nano (I prefer nano tbh) -- you can edit the file in commandline using one of the three a lot faster than downloading, editing, and reuploading it.

    e.g.
    Code:
    sudo nano /etc/apt/sources.list
  9. Offline

    Drizien

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @EggRoll
    It's just what I heard. According to some people I know on messenger it has to do with server security. I really have no clue if it's true or not though... apparently not. Thanks for clearing htat up =3
  10. Online

    TnT Trinitrotoluene Maximus Administrator Bukkit Help

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Here's a guide I wrote earlier on how to install CraftBukkit on Ubuntu 10.10 x64.

    http://forums.bukkit.org/threads/ho...kkit-craftbukkit-server-running-java-x64.598/
    --- merged: Jan 24, 2011 3:40 PM ---
    Its true. You should never run your server from root. But hey, I like leaving my servers secure, you may not.
  11. Offline

    damelon

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Great guide, but Drizien is right. Although it's technially fine to run apps as root, a security hole on software ran as root could allow root access. But you should never allow a remote user to login as root. This should be blocked by SSH/SCP. Of any security guide on linux/unix, this is the first thing you should ever do. The moment you put your server on the internet, you will notice brute force attacks against your box almost daily. (See your auth.log) The one account everyone knows exists in a unix/linux box is root. So they already have half of the login. All they have to guess is the password. Most people's passwords aren't that great either. They are either plain text or use l33t speak to make real words, which is just as easy to hack as plain words. If you don't allow remote root logins, they would have to also randomly guess your username, which can be anything. Plus, if your root user gets hacked, you can basically say goodbye to your whole box, not to mention, they can from there they can try to access any network shares you may have on your lan. A user with restricted permissions would deny them that.
  12. Offline

    Drizien

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    =o then I did the right thing! yay!
  13. Offline

    Olas

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    If someone crafty was ever able to find a hole in Minecraft, they could really mess with your stuff if it was running as root. Instead create a new user for Minecraft, and give it permissions for only the stuff it will need.
  14. Offline

    EggRoll

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @damelon
    If anyone uses an easy password they deserve to be rooted.
  15. Online

    TnT Trinitrotoluene Maximus Administrator Bukkit Help

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Anyone who uses root to run an application that should never be run as root deserves to have their systems hacked, no matter how secure you think your password is.
  16. Offline

    croxis

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    There is another good reason why to never expose root to the Internet, and it has nothing to do with passwords. It is theoretically possible that there is a security vulnerability in bukkit, minecraft, or java where it is theoretically possible for someone to gain access to the system without ever needing to find out your password. If minecraft is running as root, then they have root level access to your system. Hello rm -r /*!

    Best practices is to create a user specifically for minecraft server and manage it by init script or equivalent.
  17. Online

    TnT Trinitrotoluene Maximus Administrator Bukkit Help

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    No no no no no! Didn't you read his post? His password is very secure.

    /sarcasm.
  18. Offline

    damelon

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    True. I was mostly commenting on the OP 's comment though about using WinSCP, where he mentioned username: root.

    Any documentation for commercial software you install will usually start with explaining creating new accounts, etc to run their apps. It's no different in this case, or any case for that matter. If it isn't part of the OS itself, it shouldn't need root.
  19. Offline

    computerstreber

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Just a suggestion, but instead of editing the sources.list file, run
    Code:
    sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”
    followed by
    Code:
    sudo apt-get update
    before running
    Code:
    sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
    .

    --- merged: Feb 6, 2011 12:20 AM ---
    By the way... does anyone know what permissions a non-root user would need to run minecraft?
  20. Offline

    cybertrip

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Default user permissions is enough. If you are using SELinux you may need to add an exception.
  21. Offline

    Pixiio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
  22. Offline

    Pixiio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    People who are trying too to. If Putty can't locate java, try sudo apt-get update
  23. Offline

    Hamad

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    i dont have etc/apt in root or anywhere, please help, i have teamviewer
  24. Offline

    ipaqmaster

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I look foward to using this to upgrade my server to linux in the near future.

    Just a question, can I move most of the current server files to the new server? map data, addons etc, (not the program ofc)

    or do I need to make a whole new flash of things?

    Windows xp > linux
  25. Offline

    5tinger

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Did I miss the explanation or was the below parameters not explained?
    Code:
    -server -Djava.net.preferIPv4Stack=true -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseAdaptiveGCBoundary -XX:MaxGCPauseMillis=500 -XX:-UseGCOverheadLimit -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:SurvivorRatio=16 -XX:UseSSE=3 -XXarallelGCThreads=3 -XX:+AggressiveOpts

Share This Page