# Setting Up MinIO Storage Server
## Firewall-CMD
First we will open the following ports in FIrewall-CMD:
```
sudo firewall-cmd --zone=public --add-port=9000/tcp --permanent
sudo firewall-cmd --zone=public --add-port=9030/tcp --permanent
sudo firewall-cmd --reload || true
```
## Download the RPM package and install
```
wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio-20220925154453.0.0.x86_64.rpm -O minio.deb
sudo dnf install minio.rpm
```
The RPM package will create the systemd file automatically.
Edit the systemd file at location: ``` /etc/systemd/system/minio.service``` and edit the user and group to ```root```.
## Create MinIO EnvironmentFile
```
sudo nano /etc/default/minio
```
Paste below into the file
``` python=1
# Volume to be used for MinIO server.
MINIO_VOLUMES="/datapool/files/"
# Use if you want to run MinIO on a custom port.
MINIO_OPTS="--address :9000 --console-address :9030"
# Root user for the server.
MINIO_ROOT_USER=root
# Root secret for the server.
MINIO_ROOT_PASSWORD=rootpass
# set this for MinIO to reload entries with 'mc admin service restart'
MINIO_CONFIG_ENV_FILE=/etc/default/minio
```
## Reload daemon and start the service:
```
sudo systemctl daemon-reload
sudo systemctl enable minio.service
sudo ssytemctl start minio.service
```
## Using Web Console:
Now we can open the web-console using the IP and port of the server, and login as the username and password as configured in the minio environment file:

After login, the main MinIO dashboard will open, where we can create new buckets and add data to it:

Now, click on "Create Bucket" button on right side of the screen, the following page will open, enable the options as shown:

Next, click "Create Bucket" to create the bucket with the set peramenters.
## Setup MinIO Client:
If we want to use the terminal to create buckets, upload data into buckets and different managerial tasks then the MinIO client "mc" command will be very helpful.
### Manual Installation:
Download the binary and make it executable:
```
wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
sudo mv mc /usr/local/bin
```
Then open configuration file ```~/.mc/config.json```, and update the username and password in the local section of the file, and then save:

#### Make a bucket
```mb``` command creates a new bucket.
```
sudo mc mb /raid0pool/fs/quicksync
```
#### Copy Objects
```cp``` command copies data from one or more sources to a target.
```
mc cp test.txt /raid0pool/fs/quicksync
```
Links:
[MinIO Complete Guide](https://docs.min.io/docs/minio-client-complete-guide.html)