Skip to content

Instantly share code, notes, and snippets.

@MKRhere
Last active August 19, 2021 12:30
Show Gist options
  • Save MKRhere/be44e9266f4b7c205c76c8606f9f8216 to your computer and use it in GitHub Desktop.
Save MKRhere/be44e9266f4b7c205c76c8606f9f8216 to your computer and use it in GitHub Desktop.
Minio installer
#!/usr/bin/env bash
# Setup user
sudo useradd -m minio
cd /home/minio
# Download minio and make it executable
wget https://dl.minio.io/server/minio/release/linux-amd64/minio
sudo chown minio:minio ./minio
chmod +x ./minio
# Configure minio store
mkdir store
mkdir config
# Create systemd unit
echo '[Unit]
Description=Minio
Documentation=https://docs.minio.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/home/minio/minio
[Service]
WorkingDirectory=/home/minio
User=minio
Group=minio
PermissionsStartOnly=true
Environment="MINIO_VOLUMES=/home/minio/store/"
Environment="MINIO_OPTS=\"-C /home/minio/config --address 127.0.0.1:2578\""
ExecStart=/home/minio/minio server $MINIO_OPTS $MINIO_VOLUMES
# Let systemd restart this service only if it has ended with the clean exit code or signal.
Restart=on-success
StandardOutput=journal
StandardError=inherit
# 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=0
# SIGTERM signal is used to stop Minio
KillSignal=SIGTERM
SendSIGKILL=no
SuccessExitStatus=0
[Install]
WantedBy=multi-user.target
' | sudo tee /etc/systemd/system/minio.service
sudo systemctl daemon-reload
sudo systemctl enable minio
# Starting minio
sudo service minio start
# Some logging to user
echo "minio is installed and started. Check status by running 'sudo service minio status'"
echo "Configure nginx to listen on port 2578"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment