Installing MinIO on Fedora: Building Your Own High-Performance S3 Storage and Fixing SELinux for Good

Fedora tutorial - IT technology blog
Fedora tutorial - IT technology blog

The Reality: When AWS S3 Drains Your Wallet

It’s 2 AM, and I’m staring at my AWS cost dashboard with a sigh. A small staging project is causing the S3 bill to climb steadily. Storage costs and GET/PUT fees for a bunch of demo images alone are costing nearly $50 a month. You need an Object Storage solution that is fully compatible with the S3 API so you don’t have to change your code, but it needs to run on your own infrastructure to save money.

I chose to set up MinIO on Fedora Server. However, reality is often harsher than theory. After installation, the service might not run, or it might throw ‘Permission Denied’ errors even after a chmod 777. If you are struggling with SELinux or Firewalld on Fedora, this solution is for you.

Why Does MinIO Often ‘Fail’ on Fedora?

Fedora is a fantastic distro but is extremely strict about security. There are three main hurdles that cause MinIO installations to fail:

  • SELinux: The default Enforcing mode will block MinIO when it attempts to write data to unrecognized folders.
  • Firewalld: Fedora locks down all ports by default. If you don’t open ports 9000 and 9001, the service is effectively ‘dead in the water’.
  • Systemd Permissions: Running MinIO as root is security suicide. However, configuring a dedicated user often leads to filesystem permission errors.

Installation Choice: Docker or Binary?

Many will suggest using Docker for speed. But if you want to maximize bare-metal performance and manage resources directly via systemd, a Binary installation is a much more sustainable choice.

Guide to Installing and Hardening MinIO on Fedora

Step 1: System Preparation

Always start by updating the system to avoid library conflicts.

sudo dnf update -y
sudo dnf install wget policycoreutils-python-utils -y

Step 2: Download and Install MinIO Binary

Instead of using an old version from the repo, grab the latest release for full security features.

wget https://dl.min.io/server/minio/release/linux-amd64/minio
sudo chmod +x minio
sudo mv minio /usr/local/bin/

Step 3: Create User and Configure Permissions

We will create a system user without login privileges to isolate the application.

sudo groupadd -r minio-user
sudo useradd -M -r -g minio-user minio-user

# Create data directory
sudo mkdir -p /mnt/minio_data
sudo chown minio-user:minio-user /mnt/minio_data

Step 4: Fixing SELinux for Good

This is the most important part. Instead of disabling SELinux (which is dangerous), teach Fedora that MinIO is a safe application. We need to assign the correct labels to the executable and the data directory.

# Label the binary and data
sudo semanage fcontext -a -t bin_t "/usr/local/bin/minio"
sudo semanage fcontext -a -t var_lib_t "/mnt/minio_data(/.*)?"
sudo restorecon -Rv /usr/local/bin/minio
sudo restorecon -Rv /mnt/minio_data

The restorecon command applies the security labels we just declared. Without this step, MinIO will report ‘Access Denied’ immediately upon startup.

Step 5: Environment Configuration

Create the file /etc/default/minio. This is where login credentials and storage paths are stored.

MINIO_VOLUMES="/mnt/minio_data"
MINIO_OPTS="--address :9000 --console-address :9001"
MINIO_ROOT_USER="admin_minio"
MINIO_ROOT_PASSWORD="ReplaceWithAStrongPassword123"

Step 6: Set Up Systemd Service

Create the file /etc/systemd/system/minio.service to manage the service easily.

[Unit]
Description=MinIO
After=network-online.target

[Service]
User=minio-user
Group=minio-user
EnvironmentFile=/etc/default/minio
ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
Restart=always
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

Step 7: Open Firewalld Ports

If you skip this step, you will encounter ‘Connection Timed Out’ errors when accessing via a browser.

sudo firewall-cmd --permanent --add-port=9000/tcp
sudo firewall-cmd --permanent --add-port=9001/tcp
sudo firewall-cmd --reload

Step 8: Start the System

Activate MinIO for the first time:

sudo systemctl daemon-reload
sudo systemctl enable --now minio

Check the status with sudo systemctl status minio. If you see the green active (running) status, you have succeeded!

Real-world Operating Experience

After running MinIO for a system processing 500GB of data per month, I have a few tips:

  1. Btrfs and CoW: Fedora uses Btrfs as the default. The Copy-on-Write (CoW) feature can slow down MinIO database write speeds. Disable it for the data directory using: sudo chattr +C /mnt/minio_data.
  2. Logs: When errors occur, don’t guess. Use journalctl -u minio -f to view real-time logs.
  3. SSL: Do not expose port 9001 to the internet without HTTPS. The best way is to use Nginx as a Reverse Proxy to handle SSL termination.

Building your own S3-compatible storage not only gives you control over your data but also saves you thousands of dollars in cloud costs annually. Good luck with your configuration!

Share: