|
|
| (13 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| == Windows Operating System == | | == Minecraft server view-distance and lag notes == |
|
| |
|
| My tips for running Minecraft on Windows machines.
| | If your processor, network connection, and RAM are sufficient then the bottle neck for performance is very likely server storage (hard drive or SSD) speed. You reduce server storage input/output (I/O) by reducing view-distance. View-distance determines how much of the Minecraft world a player sees (the fog in the distance is the cut off of view-distance). Raise view-distance and all players see farther (clients can reduce their view-distance in video options). Lower view-distange see closer. View-distance is used in the calculation of mob spawns, higher means increased mob numbers, lower produces less mob spawns. This section of information is about elimination of lag, skipping ticks, system time change, and server overload issues. Read on for more details. |
|
| |
|
| * Update video driver
| | Minecraft software: '''Minecraft server jar version 1.8.9 Vanilla (no mods)''' |
| * Update Java software at [http://java.com Java] website
| |
| * Allocate more memory only if you get "out of memory errors"
| |
|
| |
|
| === Allocate More Memory to Minecraft ===
| | Server operating system: Linux Fedora Core Release 23 64-bit |
|
| |
|
| Thought I'd share my success at memory allocation changes with those who are interested.
| | Server hardware specs: |
| | * CPU: Intel Core i5-6600 6M Skylake Quad-Core 3.3 GHz |
| | * Mobo: SABERTOOTH Z170 MARK 1 |
| | * RAM: 32GB (4x8GB) 288-Pin DDR4 SDRAM DDR4 2133 (PC4 17000) |
| | * Video: Built-in Intel |
| | * Drive: Samsung 950Pro SSD |
| | * PSU: Coolmaster GX 750W |
|
| |
|
| '''Note:''' I only changed my memory allocations on my machine due to in-game memory crashes every 90 to 120 seconds when exploring outside. Once I allocated 768m I haven't had a memory crash. This memory allocation started happening to my machine since 1.7 beta.
| |
|
| |
|
| I was trying various configurations to allocate memory but my command window would open up then immediately close or Java Virtual Machine (JVM) would not launch, etc.
| | ''The key to this setup is the very fast Samsung Pro 950 SSD (M.2 form factor using NVMe).'' |
|
| |
|
| I have Win7 Ultimate 64-bit, 12 GB RAM, with current version of Java installed.
| |
|
| |
|
| I created a batch file & updated my PATH variable with directory of current Java version. | | I've been hosting a private friends / family vanilla Minecraft server since 2010. The server routinely supports 8 to 10 simultaneous connected users. Users are connected via Gigabit LAN and Gigabit WAN (Google Fiber 1Gbps synchronous). |
|
| |
|
| Batch file contains (use your own c:\path2minecraft.exe here):
| |
| <pre>javaw -Xms768m -jar "c:\minecraft\Minecraft.exe"</pre>
| |
|
| |
|
| Added this to PATH (don't forget the semi-colon to separate this path from previous one):
| | The server jar file is launched with -Xmx1g -Xms1g arguments. |
| <pre>;C:\Program Files (x86)\Java\jre7\bin</pre>
| |
|
| |
|
| '''Add to PATH steps: For Win7 Ultimate I right click Computer > Properties > Advanced System Settings > Advanced Tab > Environmental Variables > System Variables > highlight PATH then click EDIT. Add semi-colon then PATH to current version of Java then press Okay.'''
| |
|
| |
|
| ''Side Note: The same machine runs minecraft flawless in Fedora Core 15 & 16 without memory modifications. Only the lack of Ventrilo support on Linux causes me to use Windows to run minecraft.''
| | Operating system: Fedora Core Release 23 (use Linux based OS as server storage I/O is superior than Windows based OS). |
|
| |
|
| I've read about other people starting minecraft.exe with -Xmx parameter but I could not get various options to work, even though I have 12 GB RAM.
| |
|
| |
|
| == Fedora Core Linux Operating System ==
| | After many hours of play testing / changing view-distance over the years with different server storage below are the settings that clients would experience zero lag. |
|
| |
|
| My tips for running Minecraft on Fedora Core 14, 15 & 16 systems.
| |
|
| |
|
| * Update video driver | | * The server originally had a 7200 RPM hard disk drive. '''''view-distance set to 6 to avoid lag issues.''''' |
| ** I use NVidia video cards. See my Linux [[NVidia]] driver installation page | | * Switched to SATA connected SSD. '''''The view-distance set to 8 to avoid lag issues.''''' |
| * Update Java software at [http://java.com Java] website
| | * Switched to M.2 form NVMe SSD (Samsung Pro950). '''''The view-distance set to 16. No lag issues.''''' |
| ** Launch Java from command line by pointing to current version of Java (or update your PATH variable) | |
| ** Example [client start]: <code>/usr/java/latest/bin/java -jar minecraft.jar</code>
| |
| ** Example [server start]: <code>/usr/java/latest/bin/java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui</code>
| |
| '''Note: Above commands assume you are in same directory as minecraft .jar files, otherwise, specify path to .jar files''' | |
|
| |
|
| == Ubuntu Operating System ==
| |
|
| |
|
| If you launch minecraft client and see an error message with ".minecraft/bin/natives/liblwjgl.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)" then follow these steps:
| | Note that the above systems never had CPU or RAM issues. |
|
| |
|
| === Install Lightweight Java Game Library ===
| |
|
| |
|
| # Go to http://lwjgl.org/download.php
| | To take advantage of OS having faster storage I/O and Minecraft server software I upgraded to Z170 chipset that supports booting to M.2 form factor SSD using NVMe (the Samsung Pro 950 256GB). The Minecraft directories and files are on the same partition as the OS (previous versions I used separate drives for OS and Minecraft). |
| # Click the link to download the newest stable release
| |
| # Download lwjgl-x.x.x.zip (lwjgl-2.8.4.zip was latested on 8-21-2012)
| |
| # In your home directory Ctrl + H to show hidden files
| |
| # Go to .minecraft/bin directory and copy matching .jar files from the jar folder in the lwjgl directory. I copied jinput.jar, lwjgl.jar, and lwjgl_util.jar.
| |
| # Go to .minecraft/bin/native directory and copy matching .so files from the native/linux folder in the lwjgl directory. I copied all six files libjinput-linux64.so, liblwjgl64.so, libopenal64.so, libjinput-linux.so, liblwjgl.so, and libopenal.so.
| |
|
| |
|
| Minecraft should now work correctly!
| |
|
| |
|
| == Linux Mint ==
| | I haven't tried a view-distance above 16 because everyone is really pleased with the results with one exception. The number of mob spawns is 2 to 3 times worse than before so nobody wants to have a higher view-distance for fear of even more mob spawning. Attacking pig man zombies with this hardware and software setup is very dangerous! |
|
| |
|
| === Mint 16 with KDE Desktop === | | == Windows Operating System == |
|
| |
|
| '''Setup current Oracle Java 64-bit (Java version 7 update 51 as of this writing):'''
| | My tips for running Minecraft on Windows machines. |
| # [http://java.com/en/download/linux_manual.jsp?locale=en Download latest version of Linux x64]
| |
| # Create directory you want to install Java. As root <code>mkdir /usr/java/</code>
| |
| # Change to directory <code>cd /usr/java</code>
| |
| # Move the jre-7u51-linux-x64.tar.gz file to the /usr/java directory.
| |
| # Uncompress and unpack the tarball to install Java. <code>tar zxvf jre-7u51-linux-x64.tar.gz</code>
| |
| #* The Java files are installed in a directory called /usr/java/jre1.7.0_51/
| |
| # Delete .tar.gz file <code>rm /usr/java/jre-7u9-linux-64.tar.gz</code>
| |
|
| |
|
| '''Setup minecraft server:'''
| | * Update video driver |
| # Create minecraft directory. As root <code>mkdir /minecraft</code>
| | * Update Java software at [http://java.com Java] website |
| # Change ownership to user. As root <code>chown username:username /minecraft</code>
| | * Allocate more memory only if you get "out of memory errors" |
| # Swith to username then download [http://minecraft.net/download minecraft_server.jar] to /minecraft directory
| |
| # Launch minecraft server using Oracle's 64-bit Java: <code>/usr/java/jre1.7.0_51/bin/java -Xmx1024m -Xms1024M -jar minecraft_server.jar nogui</code>
| |
| # Type /help at Minecraft prompt to get a list of server commands.
| |
| # I stop server here and customize the server.properties folder to what you want. Then restart server.
| |
|
| |
|
| '''After you setup your directories change the ownership of the directories and all files in /usr/java & /minecraft to non-privileged user.'''
| | === Allocate More Memory to Minecraft === |
|
| |
|
| Example with user and group named "bigfoot".
| | Thought I'd share my success at memory allocation changes with those who are interested. |
| <pre>chown -R bigfoot:bigfoot /minecraft
| |
| chown -R bigfoot:bigfoot /usr/java</pre>
| |
|
| |
|
| '''Using the minecraft_server.jar in nogui mode does not require any changes to your video card drivers''' | | '''Note:''' I only changed my memory allocations on my machine due to in-game memory crashes every 90 to 120 seconds when exploring outside. Once I allocated 768m I haven't had a memory crash. This memory allocation started happening to my machine since 1.7 beta. |
|
| |
|
| ==== Example start up of first Minecraft server ====
| | I was trying various configurations to allocate memory but my command window would open up then immediately close or Java Virtual Machine (JVM) would not launch, etc. |
| This example I used an existing server.properties file and simply changed the name of test world to "wildlands".
| |
| <pre>
| |
| bigfoot@sweetcandy:/minecraft > /usr/java/jre1.7.0_51/bin/java -Xmx1024m -Xms1024M -jar minecraft_server.jar nogui
| |
| [11:59:12] [Server thread/INFO]: Starting minecraft server version 1.7.4
| |
| [11:59:12] [Server thread/INFO]: Loading properties
| |
| [11:59:12] [Server thread/INFO]: Default game type: SURVIVAL
| |
| [11:59:12] [Server thread/INFO]: Generating keypair
| |
| [11:59:12] [Server thread/INFO]: Starting Minecraft server on *:25565
| |
| [11:59:12] [Server thread/INFO]: Preparing level "wildlands"
| |
| [11:59:13] [Server thread/INFO]: Preparing start region for level 0
| |
| [11:59:14] [Server thread/INFO]: Preparing spawn area: 5%
| |
| [11:59:15] [Server thread/INFO]: Preparing spawn area: 12%
| |
| [11:59:16] [Server thread/INFO]: Preparing spawn area: 20%
| |
| [11:59:17] [Server thread/INFO]: Preparing spawn area: 29%
| |
| [11:59:18] [Server thread/INFO]: Preparing spawn area: 38%
| |
| [11:59:19] [Server thread/INFO]: Preparing spawn area: 47%
| |
| [11:59:20] [Server thread/INFO]: Preparing spawn area: 57%
| |
| [11:59:21] [Server thread/INFO]: Preparing spawn area: 67%
| |
| [11:59:22] [Server thread/INFO]: Preparing spawn area: 77%
| |
| [11:59:23] [Server thread/INFO]: Preparing spawn area: 86%
| |
| [11:59:24] [Server thread/INFO]: Preparing spawn area: 96%
| |
| [11:59:24] [Server thread/INFO]: Done (12.118s)! For help, type "help" or "?"
| |
| </pre>
| |
| Type "help or ?" at prompt to show commands
| |
| <pre>
| |
| ?
| |
| [11:59:30] [Server thread/INFO]: --- Showing help page 1 of 7 (/help <page>) ---
| |
| [11:59:30] [Server thread/INFO]: /achievement give <stat_name> [player]
| |
| [11:59:30] [Server thread/INFO]: /ban <name> [reason ...]
| |
| [11:59:30] [Server thread/INFO]: /ban-ip <address|name> [reason ...]
| |
| [11:59:30] [Server thread/INFO]: /banlist [ips|players]
| |
| [11:59:30] [Server thread/INFO]: /clear <player> [item] [data]
| |
| [11:59:30] [Server thread/INFO]: /debug <start|stop>
| |
| [11:59:30] [Server thread/INFO]: /defaultgamemode <mode>
| |
| </pre>
| |
| I always issue "save-all" then "stop" command when taking server offline.
| |
| <pre>
| |
| save-all
| |
| [11:59:36] [Server thread/INFO]: Saving...
| |
| [11:59:36] [Server thread/INFO]: Saved the world
| |
| stop
| |
| [11:59:38] [Server thread/INFO]: Stopping the server
| |
| [11:59:38] [Server thread/INFO]: Stopping server
| |
| [11:59:38] [Server thread/INFO]: Saving players
| |
| [11:59:38] [Server thread/INFO]: Saving worlds
| |
| [11:59:38] [Server thread/INFO]: Saving chunks for level 'wildlands'/Overworld
| |
| [11:59:38] [Server thread/INFO]: Saving chunks for level 'wildlands'/Nether
| |
| [11:59:38] [Server thread/INFO]: Saving chunks for level 'wildlands'/The End
| |
| </pre>
| |
|
| |
|
| === MATE Desktop ===
| | I have Win7 Ultimate 64-bit, 12 GB RAM, with current version of Java installed. |
|
| |
|
| | I created a batch file & updated my PATH variable with directory of current Java version. |
|
| |
|
| === Cinnamon Desktop (with Mint 14 & 15) ===
| | Batch file contains (use your own c:\path2minecraft.exe here): |
| | <pre>javaw -Xms768m -jar "c:\minecraft\Minecraft.exe"</pre> |
|
| |
|
| '''Setup current Oracle Java 64-bit (Java version 7 update 9 as of this writing):''' | | Added this to PATH (don't forget the semi-colon to separate this path from previous one): |
| # [http://java.com/en/download/linux_manual.jsp?locale=en Download latest version of Linux x64]
| | <pre>;C:\Program Files (x86)\Java\jre7\bin</pre> |
| # Create directory you want to install Java. As root <code>mkdir /usr/java/</code>
| |
| # Change to directory <code>cd /usr/java</code>
| |
| # Move the jre-7u9-linux-64.tar.gz file to the /usr/java directory.
| |
| # Uncompress and unpack the tarball to install Java. <code>tar zxvf jre-7u9-linux-x64.tar.gz</code>
| |
| #* The Java files are installed in a directory called /usr/java/jre1.7.0_09/
| |
| # Delete .tar.gz file <code>rm /usr/java/jre-7u51-linux-x64.tar.gz</code>
| |
|
| |
|
| '''Setup minecraft server:''' | | '''Add to PATH steps: For Win7 Ultimate I right click Computer > Properties > Advanced System Settings > Advanced Tab > Environmental Variables > System Variables > highlight PATH then click EDIT. Add semi-colon then PATH to current version of Java then press Okay.''' |
| # Create minecraft directory. As root <code>mkdir /minecraft</code>
| |
| # Change ownership to user. As root <code>chown username:username /minecraft</code>
| |
| # Swith to username then download [http://minecraft.net/download minecraft_server.jar] to /minecraft directory
| |
| # Launch minecraft server using Oracle's 64-bit Java: <code>/usr/java/jre1.7.0_09/bin/java -Xmx1024m -Xms1024M -jar minecraft_server.jar nogui</code>
| |
| # Type /help at Minecraft prompt to get a list of server commands.
| |
| # I stop server here and customize the server.properties folder to what you want. Then restart server.
| |
|
| |
|
| '''Using the minecraft_server.jar in nogui mode does not require any changes to your video card drivers''' | | ''Side Note: The same machine runs minecraft flawless in Fedora Core 15 & 16 without memory modifications. Only the lack of Ventrilo support on Linux causes me to use Windows to run minecraft.'' |
|
| |
|
| Example of successful start:<pre>/minecraft $ /usr/java/jre1.7.0_09/bin/java -Xmx1024m -Xms1024M -jar minecraft_server.jar nogui
| | I've read about other people starting minecraft.exe with -Xmx parameter but I could not get various options to work, even though I have 12 GB RAM. |
| 208 recipes
| |
| 27 achievements
| |
| 2012-12-01 13:16:34 [INFO] Starting minecraft server version 1.4.5
| |
| 2012-12-01 13:16:34 [INFO] Loading properties
| |
| 2012-12-01 13:16:34 [INFO] Default game type: SURVIVAL
| |
| 2012-12-01 13:16:34 [INFO] Generating keypair
| |
| 2012-12-01 13:16:35 [INFO] Starting Minecraft server on *:25565
| |
| 2012-12-01 13:16:35 [INFO] Preparing level "hillville"
| |
| 2012-12-01 13:16:35 [INFO] Preparing start region for level 0
| |
| 2012-12-01 13:16:36 [INFO] Preparing spawn area: 54%
| |
| 2012-12-01 13:16:36 [INFO] Done (1.499s)! For help, type "help" or "?"</pre>
| |
| | |
| === CentOS setup on CloudAtCost ===
| |
| | |
| '''Install screen (if not already)''' | |
| <pre>
| |
| # yum install screen
| |
| </pre>
| |
| | |
| '''Add a user'''
| |
| <pre>
| |
| useradd -c "Minecraft user" -m mineuser
| |
| </pre>
| |
| | |
| '''Create script'''
| |
| | |
| Create file in /etc/init.d/ directory called minecraft and copy and paste the below script.
| |
| | |
| <pre>
| |
| #!/bin/bash
| |
| # /etc/init.d/minecraft
| |
| # version 0.3.9 2012-08-13 (YYYY-MM-DD)
| |
|
| |
| ### BEGIN INIT INFO
| |
| # Provides: minecraft
| |
| # Required-Start: $local_fs $remote_fs screen-cleanup
| |
| # Required-Stop: $local_fs $remote_fs
| |
| # Should-Start: $network
| |
| # Should-Stop: $network
| |
| # Default-Start: 2 3 4 5
| |
| # Default-Stop: 0 1 6
| |
| # Short-Description: Minecraft server
| |
| # Description: Starts the minecraft server
| |
| ### END INIT INFO
| |
|
| |
| #Settings
| |
| SERVICE='minecraft_server.jar'
| |
| OPTIONS='nogui'
| |
| USERNAME='mineuser'
| |
| WORLD='world'
| |
| MCPATH='/home/mineuser/minecraft'
| |
| BACKUPPATH='/home/minecraft/backup/minecraft.backup'
| |
| MAXHEAP=2048
| |
| MINHEAP=2048
| |
| HISTORY=1024
| |
| CPU_COUNT=1
| |
| INVOCATION="java -Xmx${MAXHEAP}M -Xms${MINHEAP}M -XX:+UseConcMarkSweepGC \
| |
| -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=$CPU_COUNT -XX:+AggressiveOpts \
| |
| -jar $SERVICE $OPTIONS"
| |
|
| |
| ME=`whoami`
| |
| as_user() {
| |
| if [ $ME == $USERNAME ] ; then
| |
| bash -c "$1"
| |
| else
| |
| su - $USERNAME -c "$1"
| |
| fi
| |
| }
| |
|
| |
| mc_start() {
| |
| if pgrep -u $USERNAME -f $SERVICE > /dev/null
| |
| then
| |
| echo "$SERVICE is already running!"
| |
| else
| |
| echo "Starting $SERVICE..."
| |
| cd $MCPATH
| |
| as_user "cd $MCPATH && screen -h $HISTORY -dmS minecraft $INVOCATION"
| |
| sleep 7
| |
| if pgrep -u $USERNAME -f $SERVICE > /dev/null
| |
| then
| |
| echo "$SERVICE is now running."
| |
| else
| |
| echo "Error! Could not start $SERVICE!"
| |
| fi
| |
| fi
| |
| }
| |
|
| |
| mc_saveoff() {
| |
| if pgrep -u $USERNAME -f $SERVICE > /dev/null
| |
| then
| |
| echo "$SERVICE is running... suspending saves"
| |
| as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER BACKUP STARTING. Server going readonly...\"\015'"
| |
| as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-off\"\015'"
| |
| as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-all\"\015'"
| |
| sync
| |
| sleep 10
| |
| else
| |
| echo "$SERVICE is not running. Not suspending saves."
| |
| fi
| |
| }
| |
|
| |
| mc_saveon() {
| |
| if pgrep -u $USERNAME -f $SERVICE > /dev/null
| |
| then
| |
| echo "$SERVICE is running... re-enabling saves"
| |
| as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-on\"\015'"
| |
| as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER BACKUP ENDED. Server going read-write...\"\015'"
| |
| else
| |
| echo "$SERVICE is not running. Not resuming saves."
| |
| fi
| |
| }
| |
|
| |
| mc_stop() {
| |
| if pgrep -u $USERNAME -f $SERVICE > /dev/null
| |
| then
| |
| echo "Stopping $SERVICE"
| |
| as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER SHUTTING DOWN IN 10 SECONDS. Saving map...\"\015'"
| |
| as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-all\"\015'"
| |
| sleep 10
| |
| as_user "screen -p 0 -S minecraft -X eval 'stuff \"stop\"\015'"
| |
| sleep 7
| |
| else
| |
| echo "$SERVICE was not running."
| |
| fi
| |
| if pgrep -u $USERNAME -f $SERVICE > /dev/null
| |
| then
| |
| echo "Error! $SERVICE could not be stopped."
| |
| else
| |
| echo "$SERVICE is stopped."
| |
| fi
| |
| }
| |
|
| |
| mc_update() {
| |
| if pgrep -u $USERNAME -f $SERVICE > /dev/null
| |
| then
| |
| echo "$SERVICE is running! Will not start update."
| |
| else
| |
| as_user "cd $MCPATH && wget -q -O $MCPATH/versions http://s3.amazonaws.com/Minecraft.Download/versions/versions.json"
| |
| snap=`awk -v linenum=3 'NR == linenum {print; exit}' "$MCPATH/versions"`
| |
| snapVersion=`echo $snap | awk -F'\"' '{print $4}'`
| |
| re=`awk -v linenum=4 'NR == linenum {print; exit}' "$MCPATH/versions"`
| |
| reVersion=`echo $re | awk -F'\"' '{print $4}'`
| |
| as_user "rm $MCPATH/versions"
| |
| if [ "$1" == "snapshot" ]; then
| |
| MC_SERVER_URL=http://s3.amazonaws.com/Minecraft.Download/versions/$snapVersion/minecraft_server.$snapVersion.jar
| |
| else
| |
| MC_SERVER_URL=http://s3.amazonaws.com/Minecraft.Download/versions/$reVersion/minecraft_server.$reVersion.jar
| |
| fi
| |
| as_user "cd $MCPATH && wget -q -O $MCPATH/minecraft_server.jar.update $MC_SERVER_URL"
| |
| if [ -f $MCPATH/minecraft_server.jar.update ]
| |
| then
| |
| if `diff $MCPATH/$SERVICE $MCPATH/minecraft_server.jar.update >/dev/null`
| |
| then
| |
| echo "You are already running the latest version of $SERVICE."
| |
| else
| |
| as_user "mv $MCPATH/minecraft_server.jar.update $MCPATH/$SERVICE"
| |
| echo "Minecraft successfully updated."
| |
| fi
| |
| else
| |
| echo "Minecraft update could not be downloaded."
| |
| fi
| |
| fi
| |
| }
| |
|
| |
| mc_backup() {
| |
| mc_saveoff
| |
|
| |
| NOW=`date "+%Y-%m-%d_%Hh%M"`
| |
| BACKUP_FILE="$BACKUPPATH/${WORLD}_${NOW}.tar"
| |
| echo "Backing up minecraft world..."
| |
| #as_user "cd $MCPATH && cp -r $WORLD $BACKUPPATH/${WORLD}_`date "+%Y.%m.%d_%H.%M"`"
| |
| as_user "tar -C \"$MCPATH\" -cf \"$BACKUP_FILE\" $WORLD"
| |
|
| |
| echo "Backing up $SERVICE"
| |
| as_user "tar -C \"$MCPATH\" -rf \"$BACKUP_FILE\" $SERVICE"
| |
| #as_user "cp \"$MCPATH/$SERVICE\" \"$BACKUPPATH/minecraft_server_${NOW}.jar\""
| |
|
| |
| mc_saveon
| |
|
| |
| echo "Compressing backup..."
| |
| as_user "gzip -f \"$BACKUP_FILE\""
| |
| echo "Done."
| |
| }
| |
|
| |
| mc_command() {
| |
| command="$1";
| |
| if pgrep -u $USERNAME -f $SERVICE > /dev/null
| |
| then
| |
| pre_log_len=`wc -l "$MCPATH/logs/latest.log" | awk '{print $1}'`
| |
| echo "$SERVICE is running... executing command"
| |
| as_user "screen -p 0 -S minecraft -X eval 'stuff \"$command\"\015'"
| |
| sleep .1 # assumes that the command will run and print to the log file in less than .1 seconds
| |
| # print output
| |
| tail -n $[`wc -l "$MCPATH/logs/latest.log" | awk '{print $1}'`-$pre_log_len] "$MCPATH/logs/latest.log"
| |
| fi
| |
| }
| |
|
| |
| #Start-Stop here
| |
| case "$1" in
| |
| start)
| |
| mc_start
| |
| ;;
| |
| stop)
| |
| mc_stop
| |
| ;;
| |
| restart)
| |
| mc_stop
| |
| mc_start
| |
| ;;
| |
| update)
| |
| mc_stop
| |
| mc_backup
| |
| mc_update $2
| |
| mc_start
| |
| ;;
| |
| backup)
| |
| mc_backup
| |
| ;;
| |
| status)
| |
| if pgrep -u $USERNAME -f $SERVICE > /dev/null
| |
| then
| |
| echo "$SERVICE is running."
| |
| else
| |
| echo "$SERVICE is not running."
| |
| fi
| |
| ;;
| |
| command)
| |
| if [ $# -gt 1 ]; then
| |
| shift
| |
| mc_command "$*"
| |
| else
| |
| echo "Must specify server command (try 'help'?)"
| |
| fi
| |
| ;;
| |
|
| |
| *)
| |
| echo "Usage: $0 {start|stop|update|backup|status|restart|command \"server command\"}"
| |
| exit 1
| |
| ;;
| |
| esac
| |
|
| |
| exit 0
| |
| </pre>
| |
| | |
| '''Change variables in script to your values!'''
| |
| | |
| Change the USERNAME, WORLD, MCPATH, BACKUPPATH, MAXHEAP, and MINHEAP to the values you want to use. MAXHEAP and MINHEAP I make the same value and represent the amount of memory you want to allocate to Minecraft server.
| |
| | |
| '''Change permissions on the script'''
| |
| | |
| <code># chmod a+x /etc/init.d/minecraft</code>
| |
| | |
| '''Add script to chkconfig'''
| |
| | |
| <code># chkconfig --add minecraft</code>
| |
| | |
| '''Switch to Minecraft user and setup minecraft directory'''
| |
| | |
| <code># su - mineuser</code>
| |
| | |
| <code>$ mkdir minecraft</code>
| |
| | |
| '''Change to directory:'''
| |
| | |
| <code>$ cd minecraft</code>
| |
| | |
| '''Download the minecraft server file (this link is for 1.8 version):'''
| |
| | |
| <pre>$ wget https://s3.amazonaws.com/Minecraft.Download/versions/1.8/minecraft_server.1.8.jar</pre>
| |
| | |
| '''Rename the minecraft server file:'''
| |
| | |
| <code>$ mv minecraft_server.1.8.jar minecraft_server.jar</code>
| |
| | |
| ''Note: The SERVICE='minecraft_server.jar' setting in script must match the name of the minecraft server file. I prefer to use generic name of minecraft_server.jar so when you upgrade from server version 1.y to 1.x you do not need to change any other scripts or configurations.''
| |
| | |
| '''Use service command to start and stop minecraft'''
| |
| | |
| <code>service minecraft (start | stop)</code>
| |
| | |
| '''To use screen'''
| |
| | |
| View screen:
| |
| | |
| <code>screen -r</code>
| |
| | |
| Exit screen:
| |
| | |
| <code>CTRL+a+d</code>
| |
| | |
| '''Start minecraft'''
| |
| <pre>
| |
| [mineuser@localhost ~]$ service minecraft start
| |
| Starting minecraft_server.jar...
| |
| minecraft_server.jar is now running.
| |
| [mineuser@localhost ~]$ screen -r
| |
| | |
| [16:27:24] [Server thread/INFO]: Starting minecraft server version 1.8
| |
| [16:27:24] [Server thread/WARN]: To start the server with more ram, launch it as "java -Xmx1024M -Xms1024M -jar minecraft_server.jar"
| |
| [16:27:24] [Server thread/INFO]: Loading properties
| |
| [16:27:24] [Server thread/WARN]: server.properties does not exist
| |
| [16:27:24] [Server thread/INFO]: Generating new properties file
| |
| [16:27:24] [Server thread/WARN]: Failed to load eula.txt
| |
| [16:27:24] [Server thread/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.</pre>
| |
| | |
| '''Stop minecraft and edit eula.txt'''
| |
| | |
| Stop server so you can do the one time eula.txt agreement.
| |
| | |
| <pre>$ service minecraft stop
| |
| Stopping minecraft_server.jar
| |
| minecraft_server.jar is stopped.
| |
| | |
| [mineuser@localhost ~]$ cd minecraft/
| |
| [mineuser@localhost minecraft]$ ls
| |
| eula.txt logs minecraft_server.jar server.properties
| |
| [mineuser@localhost minecraft]$ vi eula.txt</pre>
| |
| | |
| Change eula=false to eula=true
| |
| | |
| '''Now start then stop minecraft'''
| |
| | |
| Start server to generate server.properties file then stop server to edit.
| |
| | |
| <pre>
| |
| [mineuser@localhost minecraft]$ service minecraft start
| |
| Starting minecraft_server.jar...
| |
| minecraft_server.jar is now running.
| |
| [mineuser@localhost minecraft]$ service minecraft stop
| |
| Stopping minecraft_server.jar
| |
| minecraft_server.jar is stopped.
| |
| [mineuser@localhost minecraft]$ vi server.properties</pre>
| |
| | |
| '''Final start'''
| |
| | |
| <pre>[miner@localhost minecraft]$ service minecraft start
| |
| Starting minecraft_server.jar...
| |
| minecraft_server.jar is now running.</pre>
| |
| | |
| | |
| '''Using screen'''
| |
| | |
| <pre>
| |
| [miner@localhost minecraft]$ screen -R
| |
| | |
| | |
| [16:34:04] [Server thread/INFO]: Starting minecraft server version 1.8
| |
| [16:34:04] [Server thread/INFO]: Loading properties
| |
| [16:34:04] [Server thread/INFO]: Default game type: SURVIVAL
| |
| [16:34:04] [Server thread/INFO]: Generating keypair
| |
| [16:34:05] [Server thread/INFO]: Starting Minecraft server on *:25565
| |
| [16:34:05] [Server thread/INFO]: Preparing level "world"
| |
| [16:34:05] [Server thread/INFO]: Preparing start region for level 0
| |
| [16:34:06] [Server thread/INFO]: Preparing spawn area: 8%
| |
| [16:34:07] [Server thread/INFO]: Preparing spawn area: 58%
| |
| [16:34:08] [Server thread/INFO]: Done (2.624s)! For help, type "help" or "?"</pre>
| |
| | |
| == Other Linux Links ==
| |
| | |
| [http://minecraft.gamepedia.com/Server.properties server.properties] settings
| |
|
| |
|
| [http://minecraft.gamepedia.com/Tutorials/Server_startup_script Server start up script]
| | == How-to Minecraft Guides == |
|
| |
|
| [http://arstechnica.com/gaming/2012/09/blocks-with-friends-how-to-run-your-own-minecraft-server/3/ Running your own Minecraft server] | | [[How To setup Minecraft server on Windows OS|How-to setup Minecraft server on Windows OS]] |
|
| |
|
| [http://www.minecraftwiki.net/wiki/Setting_up_a_server#Linux_instructions Setting up server on Linux] from Minecraft wiki | | [[How-to edit server.properties file on Linux]] |
|
| |
|
| == Mods == | | === Backing up your Minecraft world === |
|
| |
|
| Don't use mods at the moment.
| | This guide is written for: |
| | * Linux operating systems |
| | * uses /minecraft for Minecraft's root directory |
| | * starts and ends with Minecraft server running |
| | * connected to Linux server via SSH |
| | * connected to Minecraft server console |
| | * using byobu open source text-based window manager and terminal multiplexer |
| | * using Linux user anon with permissions on /minecraft and sub-directories and files |
| | * backups are stored in /minecraft/backups |
| | * removing old backups |
|
| |
|
| | Backup steps: |
| | # Check no players are connected. Command: <code>/list</code> |
| | # Save Minecraft world files. Command: <code>/save-all</code> |
| | # Stop Minecraft server app. Command: <code>/stop</code> |
| | # Switch to alternate terminal. Across the top of the SSH session, you will see <code>0:-*</code> for single terminal or <code>0:-* 1:--</code> for multiple terminals (the # represents each terminal, there can be many). The <code>*</code> indicates the terminal you are viewing. If single terminal, press F2 to create and switch to a new terminal. If multiple terminals, press F4 to move forward one terminal (F3 to move backward). |
| | # Verify you are using anon user. Prompt should start with <code>anon@</code> on Ubuntu Linux. You can also type <code>whoami</code> and the return should be <code>anon</code>. |
| | # Switch to Minecraft root directory. Command: <code>cd /minecraft</code> |
| | # Show Minecraft worlds by listing directories and files in current directory. Command: <code>ls -l</code> |
| | # Backup each world separately. |
| | ## We will backup a world called '''realms''' in this example. <span style="color:red">Note: You will use the world name that is applicable to your current backup, don't always use '''realms'''.</span> |
| | ## You should see a '''realms''' directory from the previous command output. |
| | ## This command will archive (create single file) and compress simultaneously so each world backup will be of a single file. |
| | ## Use same command with different file names for each world backup. |
| | ## Command template: <code>tar -cvzf newFileNameYYYYMMDD.tar.gz fileOrDirectoryToArchiveAndCompress/</code> where newFileName=worldName, fileOrDirectoryToArchiveAndCompress=realms, YYYY=2022, MM=01, and DD=03 if current date is January 3, 2022. |
| | ## Command example: <code>tar -cvzf realms20220103.tar.gz realms/</code> |
| | ## The command should output the archival process and return to prompt when no errors are encountered. |
| | # Validate new backup exists. |
| | ## Command: <code>ls -l</code> |
| | ## Verify a file exists matching your new file name, or <code>realms20220103.tar.gz</code> in our example. |
| | # Do the archive and compress command for each Minecraft world you want to backup. |
| | # Move backups to /minecraft/backups. Command: <code>mv ./*.tar.gz ./backups/</code> |
| | # Validate backups are in /minecraft/backups. Command: <code>ls -l ./backups</code> |
| | ## You should see the backups you created in the output <span style=blue"color:">plus any pre-existing backups</span>. |
| | # Remove older backups when you have more than 3 of each world to save storage space. |
| | ## Only backup worlds that have been played on since last backup. |
| | ## Remove old backups. Command: <code>rm backups/water_world20220202.tar.gz</code> Copy and paste the file name after you type rm backups/ (highlight to copy and press middle mouse to paste should work) or use autocomplete (tab). |
| | # Switch to Minecraft terminal. F3 to move backward or F4 to move forward. |
| | # Start up Minecraft world like normal. |
|
| |
|
| <center>[[Gaming|To Gaming]]</center> | | <center>[[Gaming|To Gaming]]</center> |
Minecraft server view-distance and lag notes
If your processor, network connection, and RAM are sufficient then the bottle neck for performance is very likely server storage (hard drive or SSD) speed. You reduce server storage input/output (I/O) by reducing view-distance. View-distance determines how much of the Minecraft world a player sees (the fog in the distance is the cut off of view-distance). Raise view-distance and all players see farther (clients can reduce their view-distance in video options). Lower view-distange see closer. View-distance is used in the calculation of mob spawns, higher means increased mob numbers, lower produces less mob spawns. This section of information is about elimination of lag, skipping ticks, system time change, and server overload issues. Read on for more details.
Minecraft software: Minecraft server jar version 1.8.9 Vanilla (no mods)
Server operating system: Linux Fedora Core Release 23 64-bit
Server hardware specs:
- CPU: Intel Core i5-6600 6M Skylake Quad-Core 3.3 GHz
- Mobo: SABERTOOTH Z170 MARK 1
- RAM: 32GB (4x8GB) 288-Pin DDR4 SDRAM DDR4 2133 (PC4 17000)
- Video: Built-in Intel
- Drive: Samsung 950Pro SSD
- PSU: Coolmaster GX 750W
The key to this setup is the very fast Samsung Pro 950 SSD (M.2 form factor using NVMe).
I've been hosting a private friends / family vanilla Minecraft server since 2010. The server routinely supports 8 to 10 simultaneous connected users. Users are connected via Gigabit LAN and Gigabit WAN (Google Fiber 1Gbps synchronous).
The server jar file is launched with -Xmx1g -Xms1g arguments.
Operating system: Fedora Core Release 23 (use Linux based OS as server storage I/O is superior than Windows based OS).
After many hours of play testing / changing view-distance over the years with different server storage below are the settings that clients would experience zero lag.
- The server originally had a 7200 RPM hard disk drive. view-distance set to 6 to avoid lag issues.
- Switched to SATA connected SSD. The view-distance set to 8 to avoid lag issues.
- Switched to M.2 form NVMe SSD (Samsung Pro950). The view-distance set to 16. No lag issues.
Note that the above systems never had CPU or RAM issues.
To take advantage of OS having faster storage I/O and Minecraft server software I upgraded to Z170 chipset that supports booting to M.2 form factor SSD using NVMe (the Samsung Pro 950 256GB). The Minecraft directories and files are on the same partition as the OS (previous versions I used separate drives for OS and Minecraft).
I haven't tried a view-distance above 16 because everyone is really pleased with the results with one exception. The number of mob spawns is 2 to 3 times worse than before so nobody wants to have a higher view-distance for fear of even more mob spawning. Attacking pig man zombies with this hardware and software setup is very dangerous!
Windows Operating System
My tips for running Minecraft on Windows machines.
- Update video driver
- Update Java software at Java website
- Allocate more memory only if you get "out of memory errors"
Allocate More Memory to Minecraft
Thought I'd share my success at memory allocation changes with those who are interested.
Note: I only changed my memory allocations on my machine due to in-game memory crashes every 90 to 120 seconds when exploring outside. Once I allocated 768m I haven't had a memory crash. This memory allocation started happening to my machine since 1.7 beta.
I was trying various configurations to allocate memory but my command window would open up then immediately close or Java Virtual Machine (JVM) would not launch, etc.
I have Win7 Ultimate 64-bit, 12 GB RAM, with current version of Java installed.
I created a batch file & updated my PATH variable with directory of current Java version.
Batch file contains (use your own c:\path2minecraft.exe here):
javaw -Xms768m -jar "c:\minecraft\Minecraft.exe"
Added this to PATH (don't forget the semi-colon to separate this path from previous one):
;C:\Program Files (x86)\Java\jre7\bin
Add to PATH steps: For Win7 Ultimate I right click Computer > Properties > Advanced System Settings > Advanced Tab > Environmental Variables > System Variables > highlight PATH then click EDIT. Add semi-colon then PATH to current version of Java then press Okay.
Side Note: The same machine runs minecraft flawless in Fedora Core 15 & 16 without memory modifications. Only the lack of Ventrilo support on Linux causes me to use Windows to run minecraft.
I've read about other people starting minecraft.exe with -Xmx parameter but I could not get various options to work, even though I have 12 GB RAM.
How-to Minecraft Guides
How-to setup Minecraft server on Windows OS
How-to edit server.properties file on Linux
Backing up your Minecraft world
This guide is written for:
- Linux operating systems
- uses /minecraft for Minecraft's root directory
- starts and ends with Minecraft server running
- connected to Linux server via SSH
- connected to Minecraft server console
- using byobu open source text-based window manager and terminal multiplexer
- using Linux user anon with permissions on /minecraft and sub-directories and files
- backups are stored in /minecraft/backups
- removing old backups
Backup steps:
- Check no players are connected. Command:
/list
- Save Minecraft world files. Command:
/save-all
- Stop Minecraft server app. Command:
/stop
- Switch to alternate terminal. Across the top of the SSH session, you will see
0:-* for single terminal or 0:-* 1:-- for multiple terminals (the # represents each terminal, there can be many). The * indicates the terminal you are viewing. If single terminal, press F2 to create and switch to a new terminal. If multiple terminals, press F4 to move forward one terminal (F3 to move backward).
- Verify you are using anon user. Prompt should start with
anon@ on Ubuntu Linux. You can also type whoami and the return should be anon.
- Switch to Minecraft root directory. Command:
cd /minecraft
- Show Minecraft worlds by listing directories and files in current directory. Command:
ls -l
- Backup each world separately.
- We will backup a world called realms in this example. Note: You will use the world name that is applicable to your current backup, don't always use realms.
- You should see a realms directory from the previous command output.
- This command will archive (create single file) and compress simultaneously so each world backup will be of a single file.
- Use same command with different file names for each world backup.
- Command template:
tar -cvzf newFileNameYYYYMMDD.tar.gz fileOrDirectoryToArchiveAndCompress/ where newFileName=worldName, fileOrDirectoryToArchiveAndCompress=realms, YYYY=2022, MM=01, and DD=03 if current date is January 3, 2022.
- Command example:
tar -cvzf realms20220103.tar.gz realms/
- The command should output the archival process and return to prompt when no errors are encountered.
- Validate new backup exists.
- Command:
ls -l
- Verify a file exists matching your new file name, or
realms20220103.tar.gz in our example.
- Do the archive and compress command for each Minecraft world you want to backup.
- Move backups to /minecraft/backups. Command:
mv ./*.tar.gz ./backups/
- Validate backups are in /minecraft/backups. Command:
ls -l ./backups
- You should see the backups you created in the output plus any pre-existing backups.
- Remove older backups when you have more than 3 of each world to save storage space.
- Only backup worlds that have been played on since last backup.
- Remove old backups. Command:
rm backups/water_world20220202.tar.gz Copy and paste the file name after you type rm backups/ (highlight to copy and press middle mouse to paste should work) or use autocomplete (tab).
- Switch to Minecraft terminal. F3 to move backward or F4 to move forward.
- Start up Minecraft world like normal.
To Gaming