Here are a few setup tips if you're running into issues firing up a Minecraft Bedrock server on Ubuntu Linux.
First of all, you'll want to download the server software from https://minecraft.net/en-us/download/server/bedrock/. It will come in ZIP format and you can uncompress it and move it to your Linux server however you like.
The first issue that you'll likely run into after trying to execute LD_LIBRARY_PATH=. ./bedrock_server
is a permission denied error. This is because the "bedrock_server" script hasn't been setup to execute.
Error Message
-bash: ./bedrock_server: Permission denied
Command to fix the error
chmod +x ./bedrock_server
The next issue that you're likely to run into is that as soon as you leave the terminal your server shuts down. Further, if you try to run it in the background with &
at the end of your command the server starts up but never gets to the point where it accepts incoming connections. To get around this the easiest thing to do is to use the "screen" program which will allow you to start the server and then end your terminal session leaving it running.
Method 1: Install screen
sudo apt-get update
sudo apt-get install screen
Now that screen has been installed you can invoke it by entering screen
. This will seemingly leave you at a bash prompt. The difference is, when you start the bedrock server with LD_LIBRARY_PATH=. ./bedrock_server
you can then leave your terminal session and it will continue running which is what most people want.
The console for the bedrock server allows you to enter some commands that you might need, like setting up operators with "op". In order to get back to the screen that's running your server you can invoke screen -ls
and then use screen -r *name of the screen*
to re-attach to it.
Terminal
x@mc-server:~$ screen -ls
There is a screen on:
2885.pts-0.mc-server (01/05/2019 06:35:59 PM) (Detached)
1 Socket in /run/screen/S-pi.
x@mc-server:~$ screen -r pts-0.mc-server
In the above I got a listing of the screens then used screen -r pts-0.mc-server
to reconnect to that screen. If you only have one screen it will match the prefix so screen -r pts
would have also worked in my case.
Method 2: systemd
Another route to go is to use the systemd
service pipeline for which you can use the systemctl
command to start and stop your service (this is probably preferred because it will automatically restart your service after a specified amount of time if your game server crashes).
Note that you will need to change the directory in the .service
file to point to the location of your minecraft server
cd /etc/systemd/system
sudo nano minecraft.service
Contents of minecraft.service
[Unit]
Description=Minecraft Server
[Service]
# The below line you will have to change to your directory
WorkingDirectory=/srv/minecraft
# The below line you will have to change to the location of your server executable
ExecStart=/srv/minecraft/bedrock_server
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=mc
User=ubuntu
[Install]
WantedBy=multi-user.target
Commands to interact with your service
# Enable the service to start with Linux
systemctl enable minecraft
# Checks the services status to see if it's running, whether it's had an error, etc.
systemctl status minecraft
# Starts the service
systemctl start minecraft
# Stops the service
systemctl stop minecraft