由他 - picgo
type: channel
link: http://758258.xyz/index.php/tag/picgo/
items: 自建minIO + Typora + picGo实现图床功能

自建minIO + Typora + picGo实现图床功能
type: item
date: 2023-11-20T14:45:00+08:00
description: 之前使用github建了仓库做图床使用，发现没有科学网络的情况下图片经常性打不开，而且很慢，影响使用，遂自建图床安装minIO#docker-compose.yml version: '3' services: minio: container_name: minio image: minio/minio:latest restart: always networks: - public # ports: # - "9001:9001" # - "9000:9000" #deploy: #resources: #limits: #cpus: '0.1' #memory: '128M' volumes: - /etc/localtime:/etc/localtime:ro - ./data:/data - ./config:/root/.minio environment: TZ: Asia/Shanghai LANG: en_US.UTF-8 MINIO_ROOT_USER: "你的账号" MINIO_ROOT_PASSWORD: "密码" command: minio server /data --address "minio:9000" --console-address "minio:9001" #command: minio server /data --console-address ":9001" #command: minio server /data networks: public: external: true访问ip:9001验证，并新建存储桶，初期设计存储桶为public方便调试，后续优化再进行权限优化安装PicGo（mac版本）https://github.com/PicGo/PicGo-Corehttps://github.com/Herbertzz/picgo-plugin-miniohttps://picgo.github.io/PicGo-Core-Doc/npm install picgo -g picgo -h #配置文件路径：~/.picgo/config.json #将插件minio下载解压并放至.picgo目录（记得改名：picgo-plugin-minio） #目录结构如下： drwxr-xr-x 2 username staff 64 Nov 14 16:16 i18n-cli -rw-r--r-- 1 username staff 19583 Nov 14 16:22 package-lock.json -rw-r--r-- 1 username staff 185 Nov 14 16:22 package.json drwxr-xr-x 53 username staff 1696 Nov 14 16:22 node_modules drwxr-xr-x@ 11 username staff 352 Nov 15 17:53 picgo-plugin-minio -rw-r--r--@ 1 username staff 537 Nov 16 11:09 config.json -rw-r--r--@ 1 username staff 15690 Nov 16 11:09 picgo.log #config.json配置如下： { "picBed": { "uploader": "minio", "minio": { "endPoint": "api.***.com", #api地址 "port": "", #端口，不写默认http 80，https 443 "useSSL": true, #是否ssl "accessKey": "用户名", #用户名 "secretKey": "密码", #密码 "bucket": "存储桶名字", #桶名字 "sameNameFileProcessingMode": "跳过", #是否跳过 "folder": "/", "customDomain": "https://api.***.com", #自定义域名 "enableDNSCache": true, "isAutoArchive": true #是否归档 按日期生成文件夹的那种 } }, "picgoPlugins": { "picgo-plugin-minio": true } }配置typora"设置" - "图像" - "上传设定为自定义"命令："/usr/local/bin/node /Users/username/.nodejs/node_global/bin/picgo u"配置完成后验证完结