Skip to content

Sets up a Minecraft Bedrock dedicated server on Ubuntu with options for automatic updates and running at startup

License

Notifications You must be signed in to change notification settings

TheRemote/MinecraftBedrockServer

Repository files navigation

Minecraft Bedrock Server

日本語版 README はこちら

Sets up a Minecraft Bedrock dedicated server on Ubuntu / Debian with options for automatic updates, backups and running automatically at startup.
View installation instructions at: https://jamesachambers.com/minecraft-bedrock-edition-ubuntu-dedicated-server-guide/

If you are looking for a Docker containerized version of the Minecraft Bedrock Dedicated Server, it is available here: https://github.com/TheRemote/Legendary-Bedrock-Container

Features

  • Sets up the official Minecraft Bedrock Server (currently in alpha testing)
  • Fully operational Minecraft Bedrock edition server in a couple of minutes
  • Ubuntu / Debian distributions supported
  • Sets up Minecraft as a system service with option to autostart at boot
  • Automatic backups when server restarts
  • Supports multiple instances -- you can run multiple Bedrock servers on the same system
  • Updates automatically to the latest or user-defined version when server is started
  • Easy control of server with start.sh, stop.sh and restart.sh scripts
  • Adds logging with timestamps to "logs" directory
  • Optional scheduled daily restart of server using cron
  • *NEW* Box64 support for 64 bit ARM (aarch64) which greatly improves emulation speed over QEMU by translating some system calls to native system calls

Quick Installation Instuctions

To run the installation type:
curl https://raw.githubusercontent.com/TheRemote/MinecraftBedrockServer/master/SetupMinecraft.sh | bash

Installation Guide

Minecraft Bedrock Dedicated Server Script Installation / Configuration Guide

Installing Resource Packs / RTX Support

For instructions on how to install resource packs (including optional RTX support), view my step-by-step Minecraft Bedrock Dedicated Server Resource Packs / Optional RTX guide here.

Tested Distributions

  • Ubuntu / Ubuntu Server 22.04
  • Ubuntu / Ubuntu Server 20.04
  • Ubuntu / Ubuntu Server 18.04
  • Debian Stretch / Buster

Tested Platforms

  • All PC X86_64 (WORKING)
  • Udoo X86 (WORKING)
  • Intel Compute Stick (WORKING)
  • Other X86_64 platforms (WORKING)
    • ARM 64bit (WORKING -- speed improved with Box64)
      • Raspberry Pi 64 bit (WORKING -- Box64)
      • Raspberry Pi 32 bit (WORKING -- VERY SLOW -- 64 bit recommended!)
      • Tinkerboard (WORKING, 32 bit is slow, 64 bit uses Box64)

Multiple Servers and Installation Paths

The server supports multiple servers at once. When you run SetupMinecraft.sh again, pick the identical root path as any previous servers. The path structure of the scripts is $ROOTPATH/minecraftbe/yourservername, which is why the "root" path SetupMinecraft.sh asks you for should always be the same.

The individual server folder is determined by the "server name" you enter for your server. If it's an existing server, the scripts will be safely updated. If it's a new server, then a new folder will be created under $ROOTPATH/minecraftbe/newservername.

Keep the installation path the same for all servers and the script will manage all this for you.

Version Override

You can revert to a previous version with the revert.sh script included in your directory like this:
./revert.sh
Set previous version in version_pin.txt: bedrock-server-1.19.10.20.zip
If you have a specific version you would like to run, you can also create version_pin.txt yourself like this:
echo "bedrock-server-1.18.33.02.zip" > version_pin.txt
The version hold can be removed by deleting version_pin.txt. This will allow it to update to the latest version again!

Troubleshooting Note - Oracle Virtual Machines

A very common problem people have with the Oracle Virtual Machine tutorials out there that typically show you how to use a free VM is that the VM is much more difficult to configure than just about any other product / offering out there.
The symptom you will have is that nobody will be able to connect. This is not because of the second set of ports that it shows after startup (that is a nearly 3-4 years now old Bedrock bug and all servers do it).
It is because there are several steps you need to take to open the ports on the Oracle VM. You need to both:
  • Set the ingress ports (TCP/UDP) in the Virtual Cloud Network (VCN) security list
  • *and* set the ingress ports in a Network Security Group assigned to your instance

Both of these settings are typically required before you will be able to connect to your VM instance. This is purely configuration related and has nothing to do with the script or the Minecraft server itself.

I do not recommend this platform due to the configuration difficulty but the people who have gone through the pain of configuring an Oracle VM have had good experiences with it after that point. Just keep in mind it's going to be a rough ride through the configuration for most people.

Here are some additional links:

Troubleshooting Note - Hyper-V

There is a weird bug in Hyper-V that breaks UDP connections on the Minecraft server. The fix for this is that you have to use a Generation 1 VM with the Legacy LAN network driver.
See the following links:

Buy A Coffee / Donate

People have expressed some interest in this (you are all saints, thank you, truly)

  • PayPal: [email protected]
  • Venmo: @JamesAChambers
  • CashApp: $theremote
  • Bitcoin (BTC): 3H6wkPnL1Kvne7dJQS8h7wB4vndB9KxZP7

Update History

  • December 1st 2024
    • Fixed download URL
  • October 1st 2023
    • Fix gpg key import for ARM64 builds
  • January 14th 2023
    • Change connectivity check from google.com to minecraft.net to prevent blocking in some countries
  • September 4th 2022
    • Remove unnecessary code from fixpermissions.sh
  • August 12th 2022
    • Add clean.sh utility script to clean up downloads folder, remove version pinning and force reinstall of current version
    • Enable content log by default which shows errors related to resource/behavior packs
  • August 12th 2022
    • Add clean.sh utility script to clean up downloads folder, remove version pinning and force reinstall of current version
    • Enable content log by default which shows errors related to resource/behavior packs
  • August 10th 2022
    • Moved DirName variable to a custom variable at the top of SetupMinecraft.sh
  • August 4th 2022
    • Script now removes non-alphanumeric characters from the servername variable (to prevent using quotes and other symbols that will break it)
  • August 2nd 2022
    • Add Box64 support for 64 bit ARM (aarch64). 32 bit ARM is not recommended as it cannot use Box64 so it will be much slower than if you install a 64-bit version of your OS on the device.
    • You must be running a 64-bit OS to benefit from the Box64 increased speeds (both Ubuntu and Raspberry Pi OS have 64-bit versions)
    • An easy way to check and make sure you are running 64 bit is to use
      uname -m
      which will return "aarch64" if you are on 64-bit ARM
  • July 24th 2022
    • Use libssl1.1 from repository instead of Ubuntu servers due to it changing every week or two (thanks theblujuice, issue #129)
  • July 21st 2022
    • Increase timeout in minecraftbe.service to help servers with longer backup times from having startup issues
  • July 19th 2022
    • Fix minor syntax error in update.sh
  • July 14th 2022
    • Fix syntax error in new libssl3 install
    • Updated depends.zip for ARM devices (the Docker version is strongly recommended for ARM devices)
  • July 14th 2022
    • Add libssl3 to dependencies
  • July 7th 2022
    • Updated curl fallback installation URL to newest package
    • Punctuation / grammar fixes to README (thanks TheWilbo, pull request #128)
  • June 11th 2022
    • Added allowlist.json and permissions.json default template files to prevent crashes when they are missing (thanks Eike)
  • June 10th 2022
    • Fixed problem in escaping screen command in SetupMinecraft.sh (on the startup check)
  • June 5th 2022
    • Added additional escaping to screen -list commands to prevent similar names from matching the grep query (thanks wheelibin)
    • Changed grep -q command to use single quotes to prevent expansion of additional characters (I still recommend only letters and numbers for the server label/name for the least amount of trouble)
  • May 31st 2022
    • Add check to make sure server.properties exists when unzipping server as without it there will be a startup error
  • May 26th 2022
    • Add revert.sh to SetupMinecraft.sh downloads
    • Add version override documentation
  • May 25th 2022
    • Added version_pin.txt to allow for manual override of running server version. Run ./revert.sh in your server folder to set version n-1 to run on next restart. Delete version_pin.txt when you want to resume automatic updates. (thanks smallsam)
  • May 15th 2022
    • Added screen -wipe to beginning of start.sh to prevent a startup issue that could occur if there was a "dead" screen instance (thanks grimholme)
  • May 9th 2022
    • Updated fallback installation URL for OpenSSL 1.1
  • May 4th 2022
    • Fixed an issue on Debian where the route command (/sbin/route) is not on the default path by adding a check for this
    • Added Ubuntu 22.04 to tested distributions list (I upgraded my desktop OS to this today)
  • April 28th 2022
    • Fixed a line in fixpermissions.sh that could cause picky shells to complain
  • April 24th 2022
    • Added dependency package install for libssl1.1 when it's available in apt
    • Added fallback installation for libssl1.1 to hopefully fix the installer for Ubuntu 22.04/22.10 and other distros using libssl3
    • Fixed a minor 'tail' error message that could occur upon starting the server if no logs were created yet
    • Added DEBIAN_NONINTERACTIVE to some apt commands to try to suppress some interactive dialogs (such as running outdated kernel) that were causing the installer to get stuck
    • Fixed a mistake in new multicore backup causing it to select the wrong compressor
  • April 16th 2022
    • Added multiple CPU core support for backups which should speed up backup process
  • March 19th 2022
    • Removed /sbin qualifier from route command as the PATH variable is now stored at the top of each script by SetupMinecraft.sh (thanks LookedPath, issue #120)
  • March 10th 2022
    • Add new allowlist.json to the unzip whitelist (thanks shaman79, issue #118)
    • Added buy a coffe / donation information (thanks vandersonmota, issue #117)
  • November 2nd 2021
    • Fixed extra / in front of permissions fix script (thanks MarkBarbieri, issue #109)
  • October 31st 2021
    • Fixed missing sudo from fixpermissions line in start.sh (thanks MarkBarbieri, issue #109)
    • Fixed missing -a parameter from /etc/sudoers file addition thanks MarkBarbieri, issue #109)
  • August 1st 2021
    • Updated documentation and root path selection prompt to make it more clear that the root directory should be the same for ALL servers
    • Don't change unless installing to a different disk, and then use the same root path for ALL servers as they will follow the structure $ROOTPATH/minecraftbe/yourservername
    • Choosing a perfect storm of invalid paths has resulted in people's server files being pruned before from being off by one folder sublevel etc. Please follow instructions carefully here and do not change it and make sure you have backups (saved outside of the main Minecraft backups folder) before ever trying to install an additional server or updating existing scripts.
    • Fortunately this person was starting a new server so the pruning didn't get anything serious but I can't stress enough to leave the paths alone unless you're legitimately an expert with a use case like having an entire separate disk for all the Minecraft servers. Use the same root directory every time (preferably the default)!
  • July 27th 2021
    • Cleaned up SetupMinecraft.sh and removed redundant code by organizing code into functions
    • Scripts now fix all server file permissions on startup
    • Added /etc/sudoers.d/minecraftbe file to contain passwordless sudo permission for fixpermissions and sudo systemctl start server
  • July 21st 2021
    • Updated documentation and restart.sh to document how to enable systemd's service showing as "online" after called by restart.sh (useful for people tracking the servers using the systemd service) by adding a line to the sudoers file to allow passwordless sudo for the sudo systemctl start yourservername command. Restart.sh now has commented lines at the bottom along with instructions on how to enable if you need this functionality (most people probably won't)
    • Added error redirection to crontab line to help diagnose failures during scheduled restarts and removed ExecStartPre from the service as it wasn't doing anything (run ./fixpermissions.sh if you need to fix the permissions) and caused compatibility issues with older systemd versions
  • July 17th 2021
    • Added in check to ensure start.sh and other scripts are not being ran as root. If this happens you have to use sudo screen -r to find the screen and the permissions will be wrong since root isn't the owner of the server files
    • If you know you ran the script/server as root (which starts creating files owned by root instead of the regular user) and your server won't start/is wonky run the fixpermissions script from your server folder with ./fixpermissions.sh and it will correct them for you!
  • July 15th 2021
    • Added update.sh convenience script to run SetupMinecraft.sh to update everything to the latest version
    • Added validation loop for directory path -- if you are upgrading from an old version you should use the default directory.
    • Nothing good can come from changing this and I've never seen or heard of it solving a single problem despite being requested for years (especially if you don't understand relative vs fully qualified Linux paths and other pitfalls -- leave it default!).
    • Attempting to solve this problem with safety checks in case this is useful to some people and I just haven't heard about it but it may be removed entirely or turned into a check that you have to download and modify the script to enable if it continues to be a source of strife for people.
    • Updated depends.zip for Raspberry Pis
  • July 4th 2021
    • Added missing sudo line to some prerequistes and removed apt-get install sudo as the script no longer runs as root (install sudo if missing) - thanks Rick Horn
  • July 3rd 2021
    • Added Accept-Encoding: Identity header to curl as a very small % of users are getting an "Access Denied" error without this header (thanks titiscan, pull request #95
    • Added default language header to curl as non-english computers were getting an Access Denied error
    • Script now checks for gawk being present in start.sh. If it's not installed (likely due to reusing old SetupMinecraft.sh files) timestamps will be disabled. This will prevent the server from failing to start. This is avoided by not running an old copy of SetupMinecraft.sh!
    • Removed broken screen -r command at the end of SetupMinecraft.sh as fixing it actually causes lockups -- instead now gives the command (screen -r) to pull up the Minecraft console. Press Ctrl+A then Ctrl+D to hide the console once you're inside it.
    • Added code to prevent SetupMinecraft.sh from being ran as a local file (please use the new method of curl https://raw.githubusercontent.com/TheRemote/MinecraftBedrockServer/master/SetupMinecraft.sh | bash)
  • July 2nd 2021
    • Improved dependency detection and installation
    • Removed wget dependency
    • Added gawk dependency -- this should not have any impact on most systems but on systems that use mawk by default this will fix server startup issues related to timestamps since mawk doesn't support strftime
    • Fixed stop.sh's -t countdown option (thanks da99Beast, issue #76)
    • Fixed a nasty issue where the installation of libcurl3 over the top of libcurl4 was allowed in some configurations (like Ubuntu 18.04) and was clobbering curl (thanks Goretech)
    • Fixed an issue where empty folders could be created in the wrong location if start.sh was not ran from the server folder (thanks CobraBitYou, issue #93
  • July 1st 2021
    • Changed from wget to curl as wget is freezing (but curl works)
    • Added randomization to user agent
  • June 19th 2021
    • Fixed timestamps to display on every line (thanks murkyl)
    • Added chmod command after unzip line to make bedrock_server executable for issue #22 (thanks murkyl)
    • Merged pull request #91 from starkey-01 to add prompt for an alternate installation directory. This has been requested for a while so thanks starkey-01!
    • Merged pull request #88 clarifying instructions to run script as non-root user (thanks sparagi!)
  • May 23nd 2021
    • The fixpermissions.sh script now displays the last 5 lines from the latest log file to aid in troubleshooting. If your server won't start this script often will take care of it and the logs can give useful information otherwise!
  • May 22nd 2021
    • Added setting the path variable to each script to prevent service from failing to start due to not being able to find the right path.
    • Please redownload SetupMinecraft.sh for this update. The script will give you a warning each time you start up that it couldn't set the path variable without the new SetupMinecraft.sh script
    • Added user agent to wget string to prevent update check from failing
    • Added automatic update to SetupMinecraft.sh if it has not been modified for more than 7 days
    • Updated Raspberry Pi dependencies
  • April 22nd 2021
    • Added a safety check to prevent installing on 32 bit (i386 or i686) operating systems. The official Bedrock dedicated server has only been released as a 64 bit (x86_64) binary and attempts at emulation on 32 bit have failed to yield any successful results!
    • Added chmod +x bedrock_server to start.sh as updates seem to be removing executable permissions sometimes
    • Fix removing old backup directory context (thanks murkyl, issue #76)
  • April 20th 2021
    • Fully qualified route command with /sbin/route to alleviate network check breaking some servers
    • Added safety check to prevent using the server label 'minecraftbe' which can break the scripts
    • Added libc6 dependency check as several people have reported libns1.so.1 missing
    • Added curl and libcurl3 dependency as a fallback for older distros to avoid missing libcurl.so errors
    • Added libcrypt1 dependency check
  • April 7th 2021
    • If you are updating from an old version make sure you remove the old SetupMinecraft.sh and redownload the new version from scratch. If you are seeing something like userxname in the systemd service you're using an old version of SetupMinecraft.sh and need to download the latest
    • Updated fixpermissions.sh -- can fix issues with permissions if you are seeing them!
    • Fixed a bug with userxname appearing in start.sh and not being updated to the correct username
    • Fixed an issue that could trigger PAM authentication in start.sh
  • March 16th 2021
    • Fixed a incomplete sudo line in start.sh that was throwing an error (thanks /u/zfa from reddit!)
  • February 1st 2021
    • Added fixpermissions.sh utility script to take ownership of Minecraft server files manually (the systemd startup service does this automatically for you if you are using it)
  • January 31st 2021
    • Added .\ in front of the screen -q checks to prevent similar usernames from tripping up window detection
    • Server now takes ownership of server files on each start to prevent folks a whole heap of trouble and heartache when restoring backups/moving files/etc.
  • December 20th 2020
    • Added experimental QEMU support for 32 bit (i386, i686) similar to how the ARM support works
  • December 18th 2020
    • Added safety check to prevent the script from being ran as root or sudo. This would cause the script to be installed to the /root folder.
    • If you know what you are doing and want to override just edit the check out of SetupMinecraft.sh but otherwise just run it as ./SetupMinecraft.sh normally.
    • Fixed a nasty bug that could cause start.sh and stop.sh to disapper (thanks Paul and James). This was related to log pruning and not having a hard path. If you downloaded the SetupMinecraft script in the past 3 days update and try again here and you'll be set!
  • December 15th 2020
  • December 13th 2020
    • RTX beta is now supported as long as you aren't on the "beta" channel anymore. Unenroll from the RTX beta and downgrade to normal Minecraft. RTX is in normal Minecraft now.
    • Fixed ARM support for Raspberry Pi, Tinkerboard, and others. Be warned, it's still very slow on ARM!
    • Updated depends.zip
  • December 10th 2020
    • Cleaned up documentation
    • Added notice that the RTX beta version of Minecraft's dedicated server has not been released yet. Support will be added the moment it is!
    • Added alpha software notice for Bedrock dedicated server per issue 34
  • November 17th 2020
    • Fixed server autoupdating in start.sh
    • Minecraft.net had made a change where the "--spider" parameter would return a 503 -- removed this to fix automatic updates
  • July 24th 2019
    • Fixed Raspberry Pi support
  • July 10th 2019
    • Fixed OpenSSL error in 1.12 (thanks obviator!)
    • Fixed ports not choosing defaultS if nothing is entered (thanks sweavo!)
  • July 2nd 2019
    • Added libcurl4 Bedrock server dependency to installer script to prevent server startup from failing
  • July 1st 2019
    • Added support for multiple servers
    • Choose the folder name and port for the server in SetupMinecraft.sh (must be unique per server instance)
  • May 23rd 2019
    • Fixed typo in restart.sh where there was a space after stop command preventing the server from closing cleanly
    • Added 10 second sleep after a force close to give the server time to fully close before calling start.sh
    • Fixed server not restarting after scheduled nightly reboot (related to restart.sh bug)
    • Removed some direct (for example paths like /bin/sleep) that were harming cross platform compatibility
  • April 26th 2019
    • Tested new Bedrock dedicated server 1.11.1.2
    • Added startup counter to server instead of waiting a flat 4s to reduce unnecessary waiting
    • Fixed ARM support (64 bit required)
  • April 18th 2019
    • Changed StopChecks++ to StopChecks=$((StopChecks+1)) to improve portability (thanks Jason B.)
    • Added TimeoutStartSec=600 to server to prevent it being killed if taking longer than usual to download server
  • March 7th 2019
    • Added Armbian support
    • Tested with Tinkerboard
    • Fixed portability issue with route vs /sbin/route
  • March 2nd 2019
    • Running the SetupMinecraft.sh script after already installing now updates all scripts and reconfigures the minecraftbe service
    • Script now works on any Debian based distribution (Ubuntu, Debian, Raspbian, etc.)
    • Added *very slow* support for ARM platforms such as Raspberry Pi with QEMU emulation of x86_64
    • Renamed service to minecraftbe to avoid confusion with Java version
  • February 15th 2019
    • Backups now compress into .tar.gz format (saved in backups folder)
    • Startup service waits up to 20 seconds for an internet connection to allow time for DHCP to retrieve an IP address
    • Removed unnecessary sleep time on stop.sh script so it returns as soon as the minecraft server closes
  • February 8th 2019
    • Initial release