June 18, 2024

Create Your Own Minecraft Server Controller in Linux with Crafty

A screenshot of a Minecraft world with a logo of the Craft Controller on top of it.

Crafty is a highly versatile control panel for Minecraft servers in Linux. Similar to a web panel, Crafty provides an easy-to-use interface for you to create, manage, and configure your own custom Minecraft server. This article will show you how you can install and deploy Crafty on your own Ubuntu server.

Do you know: you can host your own Minecraft server?

Why Host Minecraft Servers through Crafty?

One of the selling points of Crafty is that it provides a user-friendly platform where you can do anything with your Minecraft server. It removes all the hiccups of downloading dependencies and creating config files to run your Minecraft instance.

Aside from that, Crafty can also automatically manage multiple Minecraft servers at once. For example, you can run 1.12, 1.14, and 1.16 servers with little configuration. This makes it an attractive option if you want to provide a multi-version Minecraft experience for your players.

Lastly, Crafty only requires Docker, Docker Compose, and Nginx to deploy on your server. As such, it doesn’t require a lot of technical expertise to get started with the program. Further, Crafty’s use of Docker also means that it will not create any additional files inside your root filesystem.

Preparing the System for Crafty

Assumption: In this guide, we will install Crafty on an Ubuntu 22.04 LTS server accessible on the internet.

Install Docker

The first step in deploying Crafty is to fetch and install the repository for Docker and Docker Compose. To do that, download the signing key from the Docker project:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg<br>sudo chmod a+r /etc/apt/keyrings/docker.gpg

Create a new repository file inside “/etc/apt/sources.list.d/”:

sudo nano /etc/apt/sources.list.d/docker.list

Paste the following line of code inside your new repository file:

deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable

Reload your system’s repository listings and upgrade all of your current packages:

sudo apt update && sudo apt upgrade

Install Docker and Docker Compose along with their dependencies:

sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-buildx-plugin nginx

Make sure that the “core” snap package is available and running in your system:

Fetch the Certbot snap package from the Electronic Frontier Foundation:

sudo snap install certbot --classic

Fetching and Installing Crafty

Go to your home directory, then create all of the necessary folders for Crafty:

cd ~ && mkdir crafty
cd ./crafty && mkdir -p ./{backups,logs,servers,config,import}

Create a new “docker-compose.yml” file using your favorite text editor:

nano ./docker-compose.yml

Paste the following block of code inside your new file:

version: '3'

services:
  crafty:
    container_name: crafty
    image: registry.gitlab.com/crafty-controller/crafty-4:latest
    restart: always
    environment:
        - TZ=Etc/UTC 
    ports:
        - "8000:8000"
        - "8443:8443"
        - "8123:8123"
        - "19132:19132/udp"
        - "25500-25600:25500-25600"
    volumes:
        - ./backups:/crafty/backups
        - ./logs:/crafty/logs
        - ./servers:/crafty/servers
        - ./config:/crafty/app/config
        - ./import:/crafty/import

Save your new “docker-compose.yml” file, then run the following command to build your Crafty container:

sudo docker compose up -d

Once done, check if your Docker setup is working properly by listing all the running containers in your system:

A terminal showing the Crafty container running on the system.

Creating an SSL Reverse Proxy for Crafty

At this point, you have a running instance of Crafty on your computer broadcasting on multiple ports. To access this securely, you need to create an SSL reverse proxy using Nginx.

Start by creating a new “A” DNS record for your Crafty instance. In this case, I am using “crafty” as a subdomain and pointing it to the IP address of my server.

A screenshot showing the Crafty subdomain assigned to the machine's IPv4 address.

Go back to your Crafty server, then create a new site configuration file using your favorite text editor:

sudo nano /etc/nginx/sites-available/crafty-web

Paste the following block of code inside your new config file:

server {
 
        server_name SUBDOMAIN.YOUR-ROOT.DOMAIN;
 
        location / {
                proxy_pass https://127.0.0.1:8443;
                proxy_http_version 1.1;
                proxy_redirect off;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header X-Forwarded-Proto https;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $host;
 
                proxy_buffering off;
                client_max_body_size 0;
                proxy_connect_timeout  3600s;
                proxy_read_timeout  3600s;
                proxy_send_timeout  3600s;
                send_timeout  3600s;
        }
}

Replace the value of the “server_name” variable with your custom subdomain.

A terminal highlighting the modified "server_name" variable on Crafty's site config file.

Link your site config file to your Nginx daemon’s “sites-enabled” folder:

sudo ln -s /etc/nginx/sites-available/crafty-web /etc/nginx/sites-enabled/

Make sure that your Nginx instance is running, then reload its state:

sudo systemctl enable --now nginx.service
sudo systemctl restart nginx.service

Register your machine using your email address to the Electronic Frontier Foundation:

sudo certbot register --agree-tos -m YOUR@EMAIL.ADDRESS

Request for a new SSL certificate for your subdomain:

sudo certbot --nginx -d SUBDOMAIN.YOUR-ROOT.DOMAIN

Check if your Crafty instance is accessible to your web browser by navigating to your subdomain.

A screenshot showing the Crafty Controller login screen running on the subdomain.

Tip: learn how you can fix the common “404” error in Nginx.

Adding and Managing a Minecraft Server in Crafty

With your Crafty instance up and running you can now deploy your first Minecraft server. To do that, you need to first find your instance’s password.

Go back to your server’s terminal session, then open the “default-creds.txt” file:

nano ./config/default-creds.txt

Copy the value of the “password:” variable to your clipboard.

A terminal highlighting the default random password for the Crafty instance.

Navigate to your Crafty instance’s login page, type “admin” on the username then paste your password on the password textbox.

Click the Servers category on the dashboard’s sidebar, then select Create New Server.

A screenshot highlighting the

Click the Server Type dropdown box, then select Vanilla.

A screenshot highlighting the

Select the version of Minecraft that you want to host, then provide the name of your server on the Server Name textbox.

Click Build Server! to download the jar file for your Minecraft version.

A screenshot highlighting the

Click your server name on the Crafty dashboard, then press Start to create your new Minecraft world.

A screenshot highlighting the

Confirm that your new server is working properly by logging in to your Minecraft account.

A screenshot showing the Crafty Minecraft server showing up in the server browser.

Good to know: learn some of the best Minecraft seeds that you can use with your multiplayer world.

Adding Operator Accounts through Crafty

Operator (OP) Accounts are an important part of every Minecraft server. They allow you to control and manage the world directly from the game itself. Accordingly, Crafty offers a convenient interface where you can add and remove privileges from player accounts.

To create an OP account, click Servers, then your server name on the dashboard’s sidebar.

Click Player Management on the dashboard screen.

A screenshot highlighting the "Player Management" category on the server's control panel.

Find the name of the account that you want to promote to OP status, then click the yellow OP button.

A screenshot highlighting the

Test if your player account is an OP user by logging in to your Minecraft server, and then running the following command in the game chat:

Doing this will change the default mode for your OP account from survival to creative which will remove its health and hunger bar.

A screenshot showing a player character in the Crafty Minecraft server in Creative Mode.

Note: You can return your OP account to survival mode by running: /gamemode 0 on the in game chat.

Backing Up Your Minecraft Server Files

Maintaining an up-to-date backup of your world is vital for reducing the downtime of your server. To this end, Crafty provides the tools for you to quickly save your world’s dimension files to your host server’s filesystem.

Go to your server’s control panel, then click Backup.

A screenshot highlighting the "Backup" category on the server's control panel.

Type “3” on the Max Backups textbox. This will ensure that the Crafty will only keep the three latest backups of your server.

Tick both Compress Backup and Shutdown server for the duration of backup checkboxes.

Click Save to commit your new settings, then press Backup Now! to create the first backup of your server.

A screenshot showing the backup settings for the custom Crafty Minecraft server.

Aside from manual backups, you can also create scheduled backups for your Minecraft servers. To do that, click the Schedule category on your server’s dashboard.

A screenshot highlighting the "Schedule" category on the server's control panel.

Click Create New Schedule, then provide a name for your scheduled task. In my case, I will name it Automatic Backup.

Press the Action dropdown box, then select Backup Server.

A screenshot highlighting the

Set a reasonable interval and time for your scheduled backup. For instance, you can set it to back up your world once a day at 3 AM in the morning.

Click Save to commit and enable your scheduled backup for your Minecraft server.

A screenshot showing a complete custom scheduled task for backups in Crafty.

Deploying and hosting your own server controller using Crafty is just one of the things that you can do in a wonderful blocky world. Learn how you can speed up and increase the frame rate of your game by installing OptiFine for Minecraft.

Image credit: Crafty Controller Gitlab. All alterations and screenshots by Ramces Red.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Ramces Red

Ramces is a technology writer that lived with computers all his life. A prolific reader and a student of Anthropology, he is an eccentric character that writes articles about Linux and anything *nix.

Leave a Reply

Your email address will not be published. Required fields are marked *