MINIO安裝
一、下載二進制文件
wget https://dl.minio.org.cn/server/minio/release/linux-amd64/minio
二、授權,並移動到指定目錄
chmod +x minio
sudo mv minio /usr/local/bin/
二、創建服務文件
/usr/lib/systemd/system/minio.service
內容如下:
[Unit] Description=MinIO Documentation=https://minio.org.cn/docs/minio/linux/index.html Wants=network-online.target After=network-online.target AssertFileIsExecutable=/usr/local/bin/minio [Service] WorkingDirectory=/usr/local User=minio-user Group=minio-user ProtectProc=invisible 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 # MinIO RELEASE.2023-05-04T21-44-30Z adds support for Type=notify (https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=) # This may improve systemctl setups where other services use `After=minio.server` # Uncomment the line to enable the functionality # Type=notify # Let systemd restart this service always Restart=always # Specifies the maximum file descriptor number that can be opened by this process LimitNOFILE=65536 # Specifies the maximum number of threads this process can create TasksMax=infinity # 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})
三、創建用戶和組
minio.service 文件默認以 minio-user 用戶和組身份運行。 您可以使用 groupadd 和 useradd``命令創建用戶和組. 以下示例創建用戶、組並設置權限以訪問MinIO預定用於存儲的文件夾路徑。 這些命令通常需要管理員 (``sudo) 權限。
groupadd -r minio-user
useradd -M -r -g minio-user minio-user
創建文件存儲目錄
mkdir /home/minio
給目錄授權爲剛創建的用戶
chown minio-user:minio-user /home/minio
四、創建環境變量文件
/etc/default/minio
內容:
# MINIO_ROOT_USER and MINIO_ROOT_PASSWORD sets the root account for the MinIO server. # This user has unrestricted permissions to perform S3 and administrative API operations on any resource in the deployment. # Omit to use the default values 'minioadmin:minioadmin'. # MinIO recommends setting non-default values as a best practice, regardless of environment MINIO_ROOT_USER=minioadmin MINIO_ROOT_PASSWORD=minioadmin # MINIO_VOLUMES sets the storage volume or path to use for the MinIO server. MINIO_VOLUMES="/home/minio" # MINIO_OPTS sets any additional commandline options to pass to the MinIO server. # 例如, `--console-address :9001` sets the MinIO Console listen port MINIO_OPTS="--address :9000 --console-address :9001" # MINIO_SERVER_URL sets the hostname of the local machine for use with the MinIO Server # MinIO assumes your network control plane can correctly resolve this hostname to the local machine # Uncomment the following line and replace the value with the correct hostname for the local machine and port for the MinIO server (9000 by default). #MINIO_SERVER_URL="http://minio.example.net:9000"
五、啓動服務
sudo systemctl enable minio.service
sudo systemctl start minio.service
六、查詢服務是否正常
sudo systemctl status minio.service
journalctl -f -u minio.service