minio+thumbor

minio 安装

wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
MINIO_ROOT_USER=admin MINIO_ROOT_PASSWORD=password ./minio server /data --console-address ":9001"

后台启动

sudo nohup ./minio server --address 0.0.0.0:9000 --console-address 0.0.0.0:9001 /home/data >/dev/null 2>&1 &
sudo /home/smile/minio server --address 0.0.0.0:9000 --console-address 0.0.0.0:9001 /home/data

用户名密码修改

/home/data/.minio.sys/config/config.json

mc安装

wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
./mc config host add minio http://127.0.0.1:9000 admin admin123
//查看状态
./mc admin info minio
//升级指定minio服务器
./mc admin update minio

ps -aux|grep minio

kill id


python2 安装

sudo apt install python2

python2 pip安装

wget https://bootstrap.pypa.io/pip/2.7/get-pip.py

sudo python2 get-pip.py

thumbor安装(必须root下)

** 必须 ** 依赖安装 sudo apt-get install build-essential python-dev libssl-dev libffi-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev libcurl4-openssl-dev

sudo pip install thumbor

pip 临时阿里源 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

  • 生成配置文件thumbor-config > ./thumbor.conf
  • 启动thumbor --port=7788 --conf=thumbor.conf

tc_aws扩展

sudo pip install tc_aws

安装拓展

创建 /root/.aws/credentials 这个文件,

并且填写刚才MinIO提供的AccessKey和SecretKey,授权这个服务访问MinIO

credentials文件内容如下

[default]

aws_access_key_id = minioadmin

aws_secret_access_key = minioadmin

thumbor.conf增加配置

############################# TC_AWS ##############################

*##*填写minio提供的Region(时区) 默认即为us-east-1

TC_AWS_REGION=‘us-east-1’

*##*将默认的Amazon S3地址换成minio运行地址

TC_AWS_ENDPOINT=‘http://127.0.0.1:9000’

*##*将Thumbor的loader换成tc_aws.loaders.s3_loader

LOADER = ‘tc_aws.loaders.s3_loader’

#################################################################

重新启动Thumbor,就可以在浏览器中通过Thumbor直接访问MinIO中的图片了

刚才那张图片。访问地址就可以变为 :

http://192.168.8.88:7788/unsafe/100x100/oss/51.png

只需要MinIO的bucket(存储桶)名称和图片名称即可

至此整合MinIO和Thumbor完成


开机自启

/usr/sbin/XX.sh

chmod +x /usr/sbin/XX.sh

/etc/systemd/system/XX.service

[Unit]
Description=XXX
After=network.target
[Service]
Type=forking
ExecStart=/usr/sbin/XX.sh   //自定义脚本路径
[Install]
WantedBy=multi-user.target

systemctl daemon-reload

systemctl enable XX.service

你可能感兴趣的:(开发记录,vue.js,javascript,前端)