# Set up a Minecraft server

Source: https://docs.quake.ai/resources/deployments/minecraft-server
Markdown: https://docs.quake.ai/resources/deployments/minecraft-server.md

---

# Set up a Minecraft server

Stand up a Minecraft Bedrock dedicated server on a Quake AI instance. You configure security groups for SSH and game ports, install the server binary, and run it as a systemd service reachable from the internet.

<PricingCompanion
  components={[
    { kind: "primitive", required: true, label: "Minecraft server instance", vm: { flavor: "s1a.medium" } },
  ]}
/>

## Prerequisites

- A Quake AI account with an active project
- An SSH key pair uploaded to your project ([How to add an SSH key](/docs/tools/add-ssh-key))
- An SSH client on your local machine

Windows users can use [PuTTY](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) or [set up a Linux CLI environment](/docs/tools/windows-cli-environment).

## Step 1: Create a security group

Create a set of rules for a virtual firewall (called a **security group**) for data into and out of your network.

1. From the Cloud console, select **Networks** > **Security Groups**.
2. Select **Create Security Group**. In this example, you'll create a security group named `SSHMinecraft`.

![Create security group](/images/docs/articles/minecraft-server/minecraft-1.png)

## Step 2. Add rules to the security group

Create and add the rules that allow data ingress and egress for the firewall.

From the **Security Groups** screen, you'll create rules to enable:

- SSH access to the VM instance
- access to ports on the VM instance for the Minecraft server

### Step 2.1 Add SSH access

![Create rules](/images/docs/articles/minecraft-server/minecraft-2.png)

1. Select **Create Rule** from the `SSHMinecraft` security group.
2. Fill in the following fields:
- **Protocol**: `SSH`
- **Direction**: `Ingress`
- **Ether Type**: `IPv4`
- **Source**: `All Traffic`

### Step 2.2 Add 1st Minecraft port

![Create rules](/images/docs/articles/minecraft-server/minecraft-3.png)

1. Select **Create Rule** from the `SSHMinecraft` security group.
2. Fill in the following fields:
- **Protocol**: `Custom UDP Rule`
- **Direction**: `Ingress`
- **Ether Type**: `IPv4`
- **Port Type**: `Custom`
- **Port**: `19132`
- **Source**: `All Traffic`

### Step 2.3 Add 2nd Minecraft port

![Create rules](/images/docs/articles/minecraft-server/minecraft-4.png)

1. Select **Create Rule** from the `SSHMinecraft` security group.
2. Fill in the following fields:
- **Protocol**: `Custom UDP Rule`
- **Direction**: `Ingress`
- **Ether Type**: `IPv4`
- **Port Type**: `Custom`
- **Port**: `19133`
- **Source**: `All Traffic`

## Step 3. Create VM instance

Create a virtual machine (VM) instance.

1. Select **Compute** > **Instances** > **Create Instance**.
2. In the **Base Config** tab, fill in the following fields:
    - **Name**: `my-server`
    - **Availability Zone**: select the zone closest to your location
3. For **Specification**, select the **Shared Resources** tab, then select `s1a.micro` for the flavor. This is the smallest flavor available and a good pick to get started. If you decide you need to increase the performance of the VM, you can always change it later.

![Create VM: Base Config tab with flavor selection](/images/docs/articles/minecraft-server/minecraft-5.png)

4. Select `Ubuntu 24.04` for the operating system. Select **Next: Network Config**.

![Create VM: image selection](/images/docs/articles/minecraft-server/minecraft-6.png)

5. Select `PublicEphemeral` from the **Public Networks** tab. This option attaches your VM instance to a network that is accessible to the internet.

![Create VM: Network Config tab](/images/docs/articles/minecraft-server/minecraft-7.png)

6. Select the security group you previously created (`SSHMinecraft`) to attach to the VM instance.
7. Select **Next: System Config**. For login type, select **Keypair**. For **Keypair** (the SSH keypair you'll use to access the VM instance), you can either add an existing SSH key or create a new one by selecting **Create Keypair**. See [creating and using SSH keypairs](/docs/tools/add-ssh-key) for generating or importing keys before launch.

![Create VM: System Config tab with keypair selection](/images/docs/articles/minecraft-server/minecraft-9.png)

8. Select **Next: Confirm Config** to review your VM instance creation. Select **Confirm**.

![Create VM](/images/docs/articles/minecraft-server/minecraft-10.png)

9. Wait a few seconds until your VM instance changes to the `Active` state, and you see an IP address in the **Fixed IP** column. Note this IP: it is the address of your server in Minecraft and the address you SSH to for setup.

![Active](/images/docs/articles/minecraft-server/minecraft-11.png)

## Step 4. Download the Minecraft server

The Bedrock dedicated server ships as a `.zip` archive. This guide uses version `1.21.73.01`. To find the current release, visit [the Bedrock server download page](https://www.minecraft.net/en-us/download/server/bedrock) and choose the Ubuntu server option. Downloading the server means you accept the [Minecraft End User License Agreement](https://www.minecraft.net/en-us/eula).

You'll fetch the archive directly on the VM instance in Step 5, which avoids the browser download button. If you prefer to download through the browser, select `Agree` on the download page, then select **Download** to save the `.zip` archive to your local machine and transfer it in Step 5.

## Step 5. Set up the Minecraft server on the VM instance

1. Connect to the VM instance over SSH, then download the server archive. Replace `YOUR_SERVER_IP` with the VM instance IP address from the **Fixed IP** column on the **Instances** page.

```bash
ssh ubuntu@YOUR_SERVER_IP
```

Set the version, then fetch the archive with `curl`. The default `wget` user agent returns `403 Forbidden`, so pass a browser user agent:

```bash
MINECRAFT_VERSION=1.21.73.01
curl --http1.1 -A 'Mozilla/5.0' -o ~/bedrock-server-${MINECRAFT_VERSION}.zip \
  "https://www.minecraft.net/bedrockdedicatedserver/bin-linux/bedrock-server-${MINECRAFT_VERSION}.zip"
```

If you downloaded the archive through the browser in Step 4, copy it from your local machine instead, then continue:

```bash
scp bedrock-server-1.21.73.01.zip ubuntu@YOUR_SERVER_IP:~/
```

2. Install `unzip`, extract the server into `/opt/minecraft`, and create the service account that runs it:

```bash
sudo apt -y update
sudo apt -y upgrade
sudo apt -y install unzip

sudo mkdir -p /opt/minecraft
sudo useradd minecraft
sudo unzip ~/bedrock-server-*.zip -d /opt/minecraft
sudo chown -R minecraft:minecraft /opt/minecraft
```

3. Create the systemd service. Run the following command to write the unit definition to `/etc/systemd/system/minecraft.service`:

```bash
sudo tee /etc/systemd/system/minecraft.service > /dev/null <<'EOF'
[Unit]
Description=MineCraft server
After=network.target

[Service]
ExecStart=/opt/minecraft/bedrock_server
Restart=always
User=minecraft
Environment=LD_LIBRARY_PATH=/opt/minecraft
WorkingDirectory=/opt/minecraft

[Install]
WantedBy=multi-user.target
EOF
```

4. Reload systemd, then enable and start the service:

```bash
sudo systemctl daemon-reload
sudo systemctl enable minecraft
sudo systemctl start minecraft
```

5. Check the status of your server by running the following in the terminal.

```bash
sudo systemctl status minecraft
```
![Status](/images/docs/articles/minecraft-server/minecraft-12.png)

You'll see a message such as the one below, showing that the server is active.

```bash
ubuntu@my-server:~$ sudo systemctl status minecraft
● minecraft.service - MineCraft server
     Loaded: loaded (/etc/systemd/system/minecraft.service; enabled; preset: enabled)
     Active: active (running) since Tue 2025-04-15 16:52:35 UTC; 3s ago
   Main PID: 2599 (bedrock_server)
      Tasks: 14 (limit: 1111)
     Memory: 146.1M (peak: 146.4M)
        CPU: 1.323s
     CGroup: /system.slice/minecraft.service
             └─2599 /opt/minecraft/bedrock_server

Apr 15 16:52:37 my-server bedrock_server[2599]: [2025-04-15 16:52:37:399 INFO] IPv4 supported, port: 19132: Used for gameplay and LAN discovery
Apr 15 16:52:37 my-server bedrock_server[2599]: [2025-04-15 16:52:37:400 INFO] IPv6 supported, port: 19133: Used for gameplay
Apr 15 16:52:37 my-server bedrock_server[2599]: [2025-04-15 16:52:37:428 INFO] Server started.
Apr 15 16:52:37 my-server bedrock_server[2599]: [2025-04-15 16:52:37:429 INFO] ================ TELEMETRY MESSAGE ===================
Apr 15 16:52:37 my-server bedrock_server[2599]: [2025-04-15 16:52:37:429 INFO] Server Telemetry is currently not enabled.
Apr 15 16:52:37 my-server bedrock_server[2599]: [2025-04-15 16:52:37:429 INFO] Enabling this telemetry helps us improve the game.
Apr 15 16:52:37 my-server bedrock_server[2599]: [2025-04-15 16:52:37:429 INFO]
Apr 15 16:52:37 my-server bedrock_server[2599]: [2025-04-15 16:52:37:429 INFO] To enable this feature, add the line 'emit-server-telemetry=true'
Apr 15 16:52:37 my-server bedrock_server[2599]: [2025-04-15 16:52:37:429 INFO] to the server.properties file in the handheld/src-server directory
Apr 15 16:52:37 my-server bedrock_server[2599]: [2025-04-15 16:52:37:429 INFO] ======================================================
ubuntu@my-server:~$
```

6. Connect to your Minecraft server and start playing. For example, from the iPhone Minecraft edition, select **Play**, then **Servers** > **Add Server**. Give your server a name and add the IP address of your VM instance running your Minecraft server. Leave the default port of `19132`.
7. Select **Add Server**.

![Add server](/images/docs/articles/minecraft-server/minecraft-13.jpeg)

8. Find your server from the list and select **Play**.

![Play](/images/docs/articles/minecraft-server/minecraft-14.jpeg)

If you ever need to view your minecraft server logs, run the following command.

```bash
sudo journalctl -u minecraft
```

## Clean up

Stop the service, delete the instance from **Compute** > **Instances**, and remove the security group when you no longer need the server:

```bash
sudo systemctl stop minecraft
sudo systemctl disable minecraft
```
