Skip to content

Instantly share code, notes, and snippets.

@mb00g
Created June 9, 2021 03:18
Show Gist options
  • Save mb00g/f54196ecbbba30af369768832c4f99fa to your computer and use it in GitHub Desktop.
Save mb00g/f54196ecbbba30af369768832c4f99fa to your computer and use it in GitHub Desktop.
wget https://dl.min.io/server/minio/release/linux-amd64/minio
mv minio /usr/local/bin

useradd -r minio-user -s /sbin/nologin
chown minio-user:minio-user /usr/local/bin/minio

mkdir -p /data/minio
chown minio-user:minio-user /data/minio

mkdir /etc/minio
chown minio-user:minio-user /etc/minio

config file /etc/default/minio

MINIO_ACCESS_KEY="minio_access_key"
MINIO_VOLUMES="/data/minio/"
MINIO_OPTS="-C /etc/minio --address :9000"
MINIO_SECRET_KEY="minio_secret_key"
MINIO_BROWSER=off

create file /etc/systemd/system/minio.service

[Unit]
Description=MinIO
Documentation=https://docs.min.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio

[Service]
WorkingDirectory=/usr/local/

User=minio-user
Group=minio-user

EnvironmentFile=/etc/default/minio
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi"

ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES

# Let systemd restart this service always
Restart=always

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=infinity
SendSIGKILL=no

[Install]
WantedBy=multi-user.target

# Built for ${project.name}-${project.version} (${project.name})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment