Life lies in tossing–PicGo+Minio+Typora picture bed construction

image-20230410132448596

I haven’t updated it for a long time. I was too busy some time ago, and it was a bit messy, so, um, I understand everything. The day before I wrote this blog, I sat in a chair for two hours, thinking about the meaning of life.

Without further ado, let’s get started.

1. Cause

Because I haven’t managed the blog for a long time, I don’t know what’s going on with the blog recently. Suddenly one day, a friend sent me a message:

image-20230410132735368

I just found out that the pictures on the blog had been dropped. I searched for the reason and found that the pictures on csdn could not be accessed from external links, which is very (ke) good (wu). I admit that I have always used csdn’s blog system as a picture bed, ahaha, I have no choice but to compromise, so I considered the picture bed.

2. Image bed selection

I have known a lot of picture beds before, so I don’t recommend them here, mainly: free if you can.

At the beginning, I chose Lychee image bed, but Typora didn’t support it, so I replaced it and didn’t use it. If Lychee image bed is built, I will write another article later.

So I chose PicGo (because Typora supports it) and Minio (docker shortcut) to work with my Typora and hexo.

3. Operating environment

Native: Macbook Air (M2) MacOS: 13.2

Local environment: configured hexo and installed PicGo and Typora.

VPS: Baidu cloud server (1 core 2g)

VPS environment: installed docker.

4. Serving

1. Configure docker and start Minio

(1) Pull the latest image from Minio

docker pull minio/minio

(2) The container starts the MinIO instance

docker run -p 9000:9000 -p 9001:9001 --name minio -d --restart=always -e "MINIO_ACCESS_KEY=xxx" -e "MINIO_SECRET_KEY=xxxxxxxx" -v /home/data:/data - v /home/config:/root/.minio minio/minio server --console-address ":9000" --address ":9001" /data

ps: Port 9000 is used by the console, port 9001 is used by API, MINIO_ACCESS_KEY=xxx sets the login user name here, MINIO_SECRET_KEY=xxxxxxxx sets the login password here, /home/data is the host mapping directory volume, /home/config is Host-mapped configuration file directory volume.

The user name must be at least 3 characters, and the password must be at least 8 characters.

(3) Configure MinIO

Now it can be accessed through ip:9000:

image-20230412121217099

Enter the account password, enter the management interface, click Buckets on the left, and create a new Bucket on the right:

image-20230412121459803

Enter the name and click Create Bucket: image-20230412121542504

Click the newly created Buckets, enter the configuration, and click Anonymous at the bottom:

image-20230412121712592

Then add a rule:

image-20230412121736787

Set a name, then change the permission bit to readwrite:

image-20230412121812123

Then return to the homepage of buckets, click private under access policy:

image-20230412121901748

Change to public, then click set:

image-20230412121925131

Next, configure the access key, click Access Keys on the left menu bar, and create a new key:

image-20230412122028599

Remember these two keys, and click create:

image-20230412122055789

2. Configure PicGo

(1) Install PicGO

I can download directly in Typora:

image-20230412122240367

(2) Install the MinIO plugin

You can search for Minio in the plug-in after science, and then install it, or install it on github:

image-20230412122327324

I have not tried github, you can refer to other tutorials.

(3) Configure PicGo

After installing the MinIO plug-in, you can see the MinIO map bed in the map bed settings, add one, and then configure: image-20230412122426569

image-20230412122537615

You can upload a picture to verify it.

3. Configure Typora

In Typora settings, click the image, select PicGo.app as the upload service, and then click the verification image upload option, and it can be used if it appears normal:

image-20230412122710133

image-20230412122725427

5. Problems encountered

If you use Hexo + Github to deploy, after the image bed is deployed, you can see that the image is displayed locally, but you cannot see it after github is deployed. The picture of minio is http service, you need to enable Minio’s HTTPS service, you need certificate settings.

I use the certificate generated by the official certgen.exe to generate two files, upload them to a directory on the server, then use docker to specify the certificate directory, then start a MinIO service, change a port, and then upload it through MinIO of the HTTP service Image, MinIO displayed blog on HTTPS service.

6. Blog URL

https://maxenton-pym.top/

image-20230412130838162

image-20230412130853856

If you have any questions, you can leave a message or send a private message.