Sep 4, 2024 3 min read

MineOS: Essential Tips for Successful Self-Hosting

MineOS: Essential Tips for Successful Self-Hosting
Table of Contents

MineOS is a powerful, lightweight, web-based interface designed to simplify the deployment and management of Minecraft servers. By self-hosting MineOS, you gain full control over your server setup, secure your data, and customize it to fit your unique needs. This guide walks you through the entire process, from installation and configuration to logging, backups, and leveraging its advanced features.

Installing MineOS

πŸ“¦ Docker/Docker Compose Setup

Using Docker is the fastest and most flexible way to deploy MineOS. Below is a docker-compose.yml file configuration to get started.


version: '3.8'

services:

mineos:

image: hexparrot/mineos

container_name: mineos

ports:

- "8443:8443" # Web UI

volumes:

- ./mineos-data:/var/games/minecraft # Persistent data storage

- ./mineos-config:/etc/mineos # Configuration files

restart: unless-stopped

Save the file as docker-compose.yml and run the following commands to deploy MineOS:


mkdir ~/mineos && cd ~/mineos

## Save the docker-compose.yml file in this directory

nano docker-compose.yml

## Deploy the container

docker-compose up -d

## Check the container status after deployment

docker ps -a

With this setup, MineOS will run on https://<your-server-ip>:8443. The persistent data is stored in the mineos-data and mineos-config directories.

πŸš€ Manual Installation

If you prefer to install MineOS manually on a Linux server, follow these steps:

  1. Install required dependencies:

sudo apt update && sudo apt install -y git nodejs npm supervisor

  1. Clone the MineOS repository and set up the application:

git clone https://github.com/hexparrot/mineos-node.git /usr/games/minecraft

cd /usr/games/minecraft

npm install

  1. Configure and start the MineOS web server:

chmod +x service.js

sudo cp mineos.conf /etc/supervisor/conf.d/mineos.conf

sudo supervisorctl reread

sudo supervisorctl update

sudo supervisorctl start mineos

MineOS will now be available at https://<your-server-ip>:8443.

Configuring Nginx as a Reverse Proxy

🌐 Nginx Configuration

To make MineOS accessible via a custom domain, configure Nginx as a reverse proxy using the code below:


sudo nano /etc/nginx/sites-available/mineos

Add the following server block:


server {

listen 80;

server_name yourdomain.com;

location / {

proxy_pass https://127.0.0.1:8443;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

}

Enable the configuration and reload Nginx:


sudo ln -s /etc/nginx/sites-available/mineos /etc/nginx/sites-enabled/

sudo nginx -t

sudo systemctl reload nginx

πŸ”’ SSL/TLS Setup

Secure your MineOS reverse proxy with a free Let's Encrypt SSL certificate:


sudo apt install certbot python3-certbot-nginx

sudo certbot --nginx -d yourdomain.com

Automate certificate renewals with a cron job:


sudo crontab -e

## Add the following line:

0 0 * * * certbot renew --quiet

πŸ› οΈ Testing and Reloading Nginx

Verify your Nginx configuration file and reload the service after updates:


sudo nginx -t

sudo systemctl reload nginx

Logging and Debugging MineOS

πŸ—ƒοΈ Enabling Debug Logs

To enable debug-level logging in MineOS, update the application’s settings:


nano /usr/games/minecraft/config.json

Set "log_level": "debug" and save the file. Restart MineOS to apply changes:


sudo supervisorctl restart mineos

πŸ“„ Viewing Logs

For Docker-based installations, view logs using:


docker logs mineos

For manual installations, access logs in the following file:


tail -f /var/log/mineos.log

πŸ› οΈ Troubleshooting Common Issues

Use the logs to diagnose common errors, such as missing dependencies or configuration issues. For example, if ports are blocked:


sudo ufw allow 8443

sudo ufw reload

πŸ“€ Exporting Logs

To export logs for external analysis, compress them and send them to a remote system:


tar -czvf mineos-logs.tar.gz /var/log/mineos.log

scp mineos-logs.tar.gz user@remote-server:/path/to/logs

Backup and Restore

πŸ—‚οΈ File-Based Backups

Create backups of MineOS configuration and data directories:


tar -czvf mineos-backup.tar.gz /var/games/minecraft /etc/mineos

πŸ”„ Database Backups

If your setup includes database usage, back up the database with:


mysqldump -u username -p mineos_db > mineos-db-backup.sql

πŸ“… Automated Backup Scripts

Set up a cron job to automate backups:


crontab -e

## Add the following line:

0 3 * * * tar -czvf /backup/mineos-$(date +\%F).tar.gz /var/games/minecraft /etc/mineos

Updating and Upgrading MineOS

⬆️ Updating Docker Images

For Docker-based installations, update MineOS with:


docker-compose pull

docker-compose up -d

πŸ› οΈ Manual Updates

To update manual installations, pull the latest code and rebuild:


cd /usr/games/minecraft

git pull

npm install

sudo supervisorctl restart mineos

πŸ” Checking for Updates

Monitor the MineOS GitHub repository for release announcements or update notifications within the application.

Leveraging MineOS’s Unique Features

πŸ”§ Enabling APIs

Activate API endpoints by modifying the configuration file:


nano /usr/games/minecraft/config.json

Set "enable_api": true. Test the API with:


curl -X GET https://<your-server-ip>:8443/api/endpoint

🌟 Advanced Configurations

Explore advanced settings, such as enabling server auto-recovery:


nano /usr/games/minecraft/config.json

Set "auto_restart": true for automated recovery after crashes.

Wrapping Up

By following this guide, you’ve successfully deployed, configured, and secured MineOS for managing your Minecraft servers. Along the way, you’ve learned how to back up data, analyze logs, and take advantage of advanced features. With MineOS’s flexibility and control, you can now provide a seamless hosting experience for your Minecraft community!

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Selfhosted Ninja.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.