This guide provides instructions for setting up a Minecraft Bedrock server on Oracle Cloud's Always Free tier. It covers everything from creating a virtual machine (VM) on Oracle Cloud Infrastructure to configuring the server with Docker and managing the server using common commands. After finishing this guide, you'll be able to control your server with Admincraft!
- Create a new instance with those settings:
Placement
- Availability domain: AD-1
Image and shape
- Image: Canonical Ubuntu 22.04
- Image build: 2024.06.26-0 (or any newer one)
- Shape: VM.Standard.A1.Flex
- OCPU count: 2
- Network bandwidth (Gbps): 2
- Memory (GB): 12
Primary VNIC information
- Virtual cloud network -> Choose one or create for later editing
- Subnet -> Choose one or create for later editing
Add SSH keys
Generate a key pair for me -> Download and store safely!
Boot volume
- Use in-transit encryption
-
Once created, take a note of the server IP, you will need it to connect to your server.
-
In
Networking > Virtual cloud networks > your network > Subnet Details
, selectSecurity List Details
and pressAdd Ingress Rules
:
- Source CIDR: 0.0.0.0/0
- IP Protocol: UDP
- Destination Port Range: 19132
- Description: Minecraft port
- Source CIDR: 0.0.0.0/0
- IP Protocol: TCP
- Destination Port Range: 8080
- Description: Admincraft WebSocket port
- Login via MobaXterm or the tool of your choice by using the IP, SSH Keys and username (ubuntu if you choose an Ubuntu image).
- Once connected, execute those commands to open the needed ports for Minecraft and Admincraft WebSocket:
sudo iptables -I INPUT 6 -m state --state NEW -p udp --dport 19132 -j ACCEPT
sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 8080 -j ACCEPT
sudo netfilter-persistent save
-
Edit the docker-compose.yml file:
- Change the
services.websocket.environment.SECRET_KEY
variable for a strong password you will use to control the server with Admincraft. - Change any other variables you like in
services.minecraft
, like theLEVEL_NAME
orLEVEL_SEED
, you can see a full list here.
- Change the
-
Make sure to edit the backups-config/config.yml file, the
worlds
setting should match the one you have introduced in the settingLEVEL_NAME
in the docker-compose.yml. You can also change the backups frequency as you like.
NOTE: If you want to enable SSL, follow the next chapter before continuing (recommended)!
- Upload the docker-compose.yml file and the backups-config folder to the home folder of your server.
- Run
sudo docker compose up -d
to start your server for the first time. - You should now be able to connect to your server with Minecraft and with Admincraft!
NOTE: If you enabled the setting
ALLOW_LIST = true
in the docker-compose.yml, you will need to whitelist the users you want to be able to connect with the commandwhitelist add username
.
- Edit the certs/makecerts.sh by changing the variable
COMMON_NAME=YOUR_IP_HERE
for your server IP. - Upload the certs folder to the home folder of your server.
- Make the script executable, format it for Linux, and run it to generate the certificates:
cd certs
chmod +x makecerts.sh
sed -i 's/\r$//' makecerts.sh
./makecerts.sh
-
Ensure that the
services.websocket.environment.USE_SSL
variable in the docker-compose.yml file is set to true. -
The
server.crt
certificate can be downloaded directly from the server to avoid Man-in-the-Middle attacks. If using a safe network, it can download it from https://IP:8080/getcert ignoring the security warnings.
- Open Admincraft and use the server IP and the SECRET_KEY you set in the previous steps. If you enabled SSL, also provide the
server.crt
. - Admincraft should connect automatically and display the server logs. If there is any issue you will be prompted with an error pop-up.
To update the Minecraft server to the latest version, simply restart it from the Admincraft Control Panel, or execute this command in the server:
sudo docker compose restart
See all available commands here.
sudo docker compose up -d
sudo docker compose up
sudo docker compose stop
sudo docker compose restart
sudo docker compose rm -fsv
sudo docker rm -vf $(sudo docker ps -aq)
sudo docker rmi -f $(sudo docker images -aq)
sudo rm -rf minecraft/
sudo docker compose logs -f
sudo docker compose logs --tail 2
sudo docker compose logs admincraft -f
sudo docker compose logs websocket -f
Send minecraft commands from outside the container (this is exactly how Admincraft controls the server)
sudo docker exec minecraft send-command <commandname>
sudo docker exec minecraft send-command whitelist add moaibeats
sudo docker exec minecraft send-command give moaibeats coal 20
sudo docker exec minecraft send-command time set 2000
sudo docker attach minecraft
whitelist add moaibeats
give moaibeats coal 20
sudo docker exec -ti minecraft /bin/bash
The system consists of three main containers running in a Docker environment:
-
Minecraft Bedrock Server (
minecraft
):- Exposes the Minecraft server to the internet through port
19132/udp
. - Accepts incoming connections from Minecraft clients.
- SSH access is enabled for the backup process, and the Minecraft server data is stored in a mounted volume.
- Server configuration is set in the
docker-compose.yml
file, allowing for customization of settings such as world seed, level name, and gameplay modes.
- Exposes the Minecraft server to the internet through port
-
Admincraft WebSocket Server (
websocket
):- Accessible via port
8080
, allowing secure control of the Minecraft server using Admincraft. - The WebSocket server authenticates incoming connections using JWT (JSON Web Tokens), with the
SECRET_KEY
stored in environment variables. - Once authenticated, users can issue Minecraft server commands, which are executed in real time within the Minecraft container.
- Additionally, certain Docker-level commands (like restarting the server) can be executed through the WebSocket interface, but these are restricted to predefined key commands for security reasons.
- Accessible via port
-
Backup Server (
backup
):- Connects to the Minecraft server every few hours via SSH to back up world data.
- The backup server uses a mounted volume to store backup files in a dedicated folder, ensuring Minecraft server data can be restored if needed.
- Backup configurations, including the backup schedule and the target Minecraft server, are stored in the
backups-config/config.yml
file.