File storage is essential. At present, there are many vendors that provide object storage services in the market, but these storage services are often charged or have storage space restrictions. Now you can use minio to build your own file storage server, because there are certain differences between the new version of minio and the old version, so today I will introduce how to build the new version and the old version of minio.
1. Preparations
- server
- installed docker
- SSL certificate (if you need to enable https access)
2. Old minio installation
1. docker installs the specified version minio
&emap; Run the command:
docker pull minio/minio:RELEASE.2021-06-17T00-10-46Z
2. Use docker to run minio
Run the command:
docker run -p 9000:9000 --name minio -di --restart=always \
-e "MINIO_ROOT_USER=minio" \
-e "MINIO_ROOT_PASSWORD=minio123456" \
-v /usr/local/minio/data:/data \
-v /usr/local/minio/config:/root/.minio \
minio/minio:RELEASE.2021-06-17T00-10-46Z server /data
Explanation of relevant instructions:
- MINIO_ROOT_USER: set username
- MINIO_ROOT_PASSWORD: set password
- /usr/local/minio/data: the storage address of the file
- /usr/local/minio/config: Port 9000 used here in the relevant configuration file of minio , you need to add port 9000 in the security group of the server, otherwise it cannot be accessed
After running successfully, the following interface appears:
View the docker operation log and run the command:
docker logs 运行结果id
If the above interface appears, it means that minio runs successfully
3. Browser access
- Enter the address in the browser: http://server ip:9000, if the login page appears, it means success:
- Use the login password you just set to log in. After successful login, the page is as follows:
4. Upload files to minio file service
- Upload directly on the browser, this way is very simple:
But at this time, we can't directly access the picture by entering the following address
http://服务器ip:9000/桶名/文件名
Access rules need to be set:
Click Edit policy and change to the following:
At this time, we can access pictures like this
http://服务器ip:9000/navigation/1.jpg
5. Enable https access
- Get the SSL certificate
&esmp; get the following two files:
public.crt
private.key
- Upload the certificate to the server minio directory.
The specific directory is as follows:
/usr/local/minio/config/certs
The specific path is related to running minio just now, and the uploaded folder is as follows:
- Restart the docker container
to view the container running in docker
docker ps
Restart command:
docker restart 容器id
View logs:
docker logs 运行结果id
The following interface appears, which means we can use https to access:
3. Install the new version of minio
1.docker install the latest version of minio
docker pull minio/minio
2. Use docker to run minio
docker run --name minio \
-p 9000:9000 \
-p 9090:9090\
-d --restart=always \
-e "MINIO_ROOT_USER=admin" \
-e "MINIO_ROOT_PASSWORD=admin123" \
-v /home/minio/data:/data \
-v /home/minio/config:/root/.minio \
minio/minio server /data \
--console-address '0.0.0.0:9090'
The new version of the run command is a little different from the old version of the run command. Other steps are basically the same as installing the old version, but the operation interface may be different