Info
Content

Install Minio Server

Step 1 — Installing And Configuring The Minio Server

You can install the Minio server by compiling the source code or via a binary file. In this step, we’ll install the server the easiest way—through the binary—and then we’ll configure everything afterward.

First, log into your server:

ssh sammy@your_server_ip

If you haven’t updated the package database recently, update it now:

sudo apt-get update

Next, download the Minio server’s binary file:

curl -O https://dl.minio.io/server/minio/release/linux-amd64/minio

A file named minio will be downloaded into your working directory. Make it executable:

sudo chmod +x minio

Now, move the file into the /usr/local/bin directory where Minio’s systemd startup script expects to find it:

sudo mv minio /usr/local/bin

For security reasons, we don’t want to run the Minio server as root. And, since the systemd script we’ll use in Step 2 looks for a user account and group called minio-user, let’s create them now.

sudo useradd -r minio-user -s /sbin/nologin

Change ownership of the binary to minio-user:

sudo chown minio-user:minio-user /usr/local/bin/minio

Next, we need to create a directory where Minio will store files. This will be the storage location for the buckets you’ll create in Step

sudo mkdir /usr/local/share/minio

Give ownership of that directory to minio-user:

sudo chown minio-user:minio-user /usr/local/share/minio

The /etc directory is the most common location for server configuration files, so we’ll create a place for Minio there.

sudo mkdir /etc/minio

Give ownership of that directory to minio-user, too:

sudo chown minio-user:minio-user /etc/minio

Use nano or your favorite text editor to create the environment file needed to modify the default configuration:

sudo nano /etc/default/minio

And, add the following variables:

/etc/default/minio
MINIO_VOLUMES="/usr/local/share/minio/"
MINIO_OPTS="-C /etc/minio --address your-server-ip:9000"
  • MINIO_VOLUMES: Points to the storage directory that you created earlier.

  • MINIO_OPTS: Modifies the behavior of the server. The -C flag points Minio to the configuration directory it should use, while the –address flag tells Minio the IP address and port to bind to. If the IP address is not specified, Minio will bind to every address configured on the server, including localhost and any Docker-related IP addresses, so it’s best to specify the IP address in this file explicitly. The default port is 9000, but you can choose another.

Finally, save and close the environment file when you’re finished making changes.

Minio is now installed, so, next, we’ll configure the server to run as a system service.

Step 2 — Installing the Minio Systemd Startup Script

In this step, we’ll configure the Minio server to be managed as a systemd service. First, download the Minio service descriptor file using the following command:

curl -O https://raw.githubusercontent.com/minio/minio-service/master/linux-systemd/minio.service

After the download has finished, a file named minio.service should be in your working directory.

To audit the contents of minio.service before applying it, open it in a text editor to view its contents:

nano minio.service

Once you’re comfortable with the script’s contents, close your text editor. Systemd requires that unit files be stored in the systemd configuration directory, so move minio.service there:

sudo mv minio.service /etc/systemd/system

Then, run the following command to reload all systemd units:

sudo systemctl daemon-reload

Finally, enable Minio to start on boot:

sudo systemctl enable minio

Now that the systemd script is installed and configured, let’s start the server.

Step 3 — Starting The Minio Server

In this step, you’ll start the server and modify the firewall to allow access through the browser interface.

First, start the Minio server:

sudo systemctl start minio

You can verify Minio’s status, the IP address it’s bound to, its memory usage, and more with the command:

sudo systemctl status minio

You should get output like the following:

Output
minio.service - Minio
   Loaded: loaded (/etc/systemd/system/minio.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2017-04-07 00:26:10 UTC; 11min ago
     Docs: https://docs.minio.io
  Process: 25069 ExecStartPre=/bin/bash -c [ -n "${MINIO_VOLUMES}" ] || echo "Variable MINIO_VOLUMES not set in /etc/default/minio" (code=exit
 Main PID: 25073 (minio)
    Tasks: 6
   Memory: 20.7M
      CPU: 544ms
   CGroup: /system.slice/minio.service
           └─25073 /usr/local/bin/minio server -C /etc/minio --address :9000 /usr/local/share/minio/

Apr 07 00:26:11 ashtonandgray minio[25073]: Browser Access:
Apr 07 00:26:11 ashtonandgray minio[25073]:    http://174.138.67.91:9000

Next, you need to enable access through the firewall to the Minio server on the configured port. In this tutorial, that’s port 9000.

So, first add the rule:

sudo ufw allow 9000

Then, restart the firewall:

sudo systemctl restart ufw
Back to top