# HOW TO INSTALL MINIO ON ROCKY LINUX 8

## Prerequisites

- An Rocky Linux system.
- A user with root or sudo privileges. This user will be used for installing new packages and make changes system-wide.

## Downloading MinIO on Rocky Linux

<span style="color: #24292f; font-family: -apple-system, 'system-ui', 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">Use the following command to download a standalone MinIO server on Linux hosts running 64-bit Intel/AMD architectures. Replace </span>`/data`<span style="color: #24292f; font-family: -apple-system, 'system-ui', 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"> with the path to the drive or directory in which you want MinIO to store data.</span>

```command
dnf -y install wget
wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
mkdir /data
mv minio /usr/local/bin
```

## Create default configuration

- This file serves as input to MinIO systemd service. Use this file to add `MINIO_VOLUMES` with the correct paths, `MINIO_OPTS` to add MinIO server options like `certs-dir`, `address`. MinIO credentials can be `MINIO_ROOT_USER` and `MINIO_ROOT_PASSWORD` in this file as well.
- Run the command bellow to create the file with minio parameters.

```command
cat <<EOT >> /etc/default/minio
# Volume to be used for MinIO server.
MINIO_VOLUMES="/data"
# Use if you want to run MinIO on a custom port.
MINIO_OPTS="--address :9199"
# Root user for the server.
MINIO_ROOT_USER=spf-user
# Root secret for the server.
MINIO_ROOT_PASSWORD=spf-Password
# setting access key to access the interface web
MINIO_ACCESS_KEY="minio"
# setting secret key. Avoid using the value default from this tutorial.
MINIO_SECRET_KEY="miniostorage"

EOT
```

## Creating minio user to run the systemd

- creating the user with no shell login and change binary and data directory ownership

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

## Systemd service MinIO on Rocky Linux

- Systemd script is configured to run the binary from /usr/local/bin
- Create minio.service in /etc/systemd/system/

```command
[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})
```

<span style="color: #474b51; font-family: Tahoma, Helvetica, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"> Enable startup on boot  
</span>

```command
systemctl daemon-reload
systemctl enable minio
```

<span style="color: #474b51; font-family: Tahoma, Helvetica, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">Starting minio</span>

```command
systemctl start minio
```

[![image-1636415567865.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636415567865.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636415567865.png)

## Interface Web

[![image-1636416514806.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636416514806.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636416514806.png)

[![image-1636416589909.png](https://documentacao.scielo.org/uploads/images/gallery/2021-11/scaled-1680-/image-1636416589909.png)](https://documentacao.scielo.org/uploads/images/gallery/2021-11/image-1636416589909.png)

## Reference link

[https://www.digitalocean.com/community/tutorials/how-to-set-up-an-object-storage-server-using-minio-on-ubuntu-18-04-pt](https://www.digitalocean.com/community/tutorials/how-to-set-up-an-object-storage-server-using-minio-on-ubuntu-18-04-pt)

[https://github.com/minio/minio](https://github.com/minio/minio)