Skip to content

Install and config a minio client

Minio client (mc) is a command line tool that allows you to manage your s3 projects. The official documentation for its installation is here

1. Install minio client binary

# get the minio client bin
curl https://dl.min.io/client/mc/release/linux-amd64/mc \
  --create-dirs \
  -o $HOME/minio-binaries/mc

# put the bin file in a folder 
chmod +x $HOME/minio-binaries/mc

# add bin file in the system path
sudo vim /etc/profile.d/minio.sh

# put the below line 
export PATH=$PATH:$HOME/minio-binaries/

# test the minio client
mc --version

Or you can use minio_client_install.sh

2. Configure minio client

You need to configure the minio client to make it to connect to a minio server. You can use below command to set up a connection alias.

# show existing alias list
mc alias list

# general form to create a new alias
mc alias set <ALIAS> <HOSTNAME> <ACCESS_KEY> <SECRET_KEY>

# you can add --insecure to accept self signed certificate
# for example:
mc --insecure alias set s3 https://minio.casd.local minio mypwd --api S3v4

# example to create a new alias
mc alias set myminio http://10.50.5.73:9000 admin changeMe

# check the detail of a alias
mc admin info myminio

3. Basic minio client commands

# list all objects in a given bucket
mc ls s3/<bucket-name>

# delete

You can find the complete minio client command list here https://min.io/docs/minio/linux/reference/minio-mc.html?ref=docs-redirect

3.6 Set anonymous connections policy.

Allowed values are [private, public, download, upload]

mc anonymous -r set download minio/casd/tools 

4. Set up an admin connection

The minio client (mc) also provide commands for performing administrative tasks on your MinIO deployments. While mc supports any S3-compatible service, mc admin only supports MinIO deployments.

You can find the official doc here

Below command will add an admin host alias

If the minio server certificate is self-signed, you can use option --insecure to ignore certificat related errors.

# the general form is:
mc config host add <ALIAS> <ENDPOINT> <ACCESS_KEY> <SECRET_KEY>

mc config host add admin-s3 http://minio.casd.local minio mypwd --api S3v4

MC Admin common commands

# displays the information of a minio server.
mc admin info admin-s3