add some posts
This commit is contained in:
166
文章/技术类/在ARM架构的Ubuntu中使用Docker Compose部署MTPhotos.md
Normal file
166
文章/技术类/在ARM架构的Ubuntu中使用Docker Compose部署MTPhotos.md
Normal file
@@ -0,0 +1,166 @@
|
||||
# 在ARM架构的Ubuntu中使用Docker Compose部署MTPhotos
|
||||
## 前言
|
||||
之前,我总是使用1panel面板的Docker进行图形化的操作,直到有一天,我遇到了一个需要三个镜像配合的项目——MTPhotos
|
||||
为什么会使用mtphotos呢,我以前都是使用老电脑装飞牛OS当作NAS使用,但是飞牛OS哪哪都挺好,就是不支持vivo的动态图片,相册里的动态图片是一张jpg一段MP4,看得我脑阔痛;而且用X86的核显老电脑安装飞牛OS,视频转码压根跑不动,如此一来,偌大个飞牛就只用来当云相册用有点心疼电费,我就把目光投向了角落的Nanopi-R5S
|
||||
好在[友善官方](https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R5S/zh "友善官方R5S中文文档")一直在更新R5S的各种固件,有OpenWRT有Ubuntu,有Debian,甚至还有Proxmox的固件,我就准备用Ubuntu装个MTPhotos来试试
|
||||
## 准备工作
|
||||
### 将R5S刷入ubuntu-noble-core固件
|
||||
线刷方便得鸭皮,没有 USBA-A 的线材也可以使用卡刷,具体看上方友善官方文档
|
||||
### 装个m.2硬盘进去当docker的镜像盘
|
||||
mtphotos有三个镜像文件,需要七八个G
|
||||
### 安装个[Mobaxtrem汉化版](https://github.com/RipplePiam/MobaXterm-Chinese-Simplified "Mobaxtrem汉化版GitHub仓库")方便文件传输和SSH连接
|
||||
SSH用户是 pi 密码也是
|
||||
## 正式开始部署
|
||||
### 初始化Ubuntu
|
||||
首先当然是Linux初始化套路
|
||||
登录切root用户(懒得加sudo),密码是 pi
|
||||
```shell
|
||||
sudo -i
|
||||
```
|
||||
#### 改时区
|
||||
```shell
|
||||
timedatectl set-timezone Asia/Shanghai
|
||||
```
|
||||
#### 换源
|
||||
Ubuntu 24.04 换源方式有变
|
||||
```shell
|
||||
vim /etc/apt/sources.list.d/ubuntu.sources
|
||||
```
|
||||
用 # 注释掉之前的所有内容,添加如下内容
|
||||
```shell
|
||||
Types: deb
|
||||
URIs: http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/
|
||||
Suites: noble noble-updates noble-security
|
||||
Components: main restricted universe multiverse
|
||||
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
|
||||
```
|
||||
X86架构不需要添加 URIs 条目后的 -ports
|
||||
#### 更新
|
||||
```shell
|
||||
apt update && apt upgrade -y
|
||||
```
|
||||
### 挂载m.2硬盘
|
||||
安装 curl 和 fdisk
|
||||
```shell
|
||||
apt install curl fdisk -y
|
||||
```
|
||||
查看当前m.2硬盘路径
|
||||
```shell
|
||||
fdisk -l
|
||||
```
|
||||
格式化硬盘
|
||||
```shell
|
||||
mkfs.ext4 /dev/nvme0n1
|
||||
```
|
||||
/dev/nvm10n1 是上一步查看到的对应的m.2硬盘路径
|
||||
|
||||
获取硬盘UUID
|
||||
```shell
|
||||
blkid /dev/nvme0n1
|
||||
```
|
||||
创建挂载文件夹
|
||||
```shell
|
||||
mkdir /nvme
|
||||
```
|
||||
编辑自动挂载文件
|
||||
```shell
|
||||
vim /etc/fstab
|
||||
```
|
||||
格式如下
|
||||
```shell
|
||||
UUID=xxxx /nvme ext4 defaults 0 0
|
||||
```
|
||||
xxxx 为 blkid /dev/nvme0n1 命令获取的 UUID="xxxx" 的内容
|
||||
|
||||
重启
|
||||
```shell
|
||||
reboot
|
||||
```
|
||||
### 安装并启动Docker和Docker compose
|
||||
更新包管理工具
|
||||
```shell
|
||||
apt-get update
|
||||
```
|
||||
使用官方一键安装脚本配合阿里云镜像一键安装
|
||||
```shell
|
||||
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
|
||||
```
|
||||
启动并查看运行状态
|
||||
```shell
|
||||
service docker start
|
||||
docker version
|
||||
docker compose version
|
||||
systemctl status docker
|
||||
```
|
||||
### 配置Docker镜像加速和镜像存放路径
|
||||
```shell
|
||||
vim /etc/docker/daemon.json
|
||||
```
|
||||
按 I 进入编辑模式,配置如下
|
||||
```shell
|
||||
{
|
||||
"registry-mirrors": ["https://docker.xuanyuan.me","https://docker.1panel.live"],
|
||||
"data-root": "/nvme/docker"
|
||||
}
|
||||
```
|
||||
按 Esc 退出编辑模式,输入 :wq 保存并退出
|
||||
重载daemon.json文件
|
||||
```shell
|
||||
systemctl daemon-reload
|
||||
systemctl restart docker
|
||||
```
|
||||
### 如果一切顺利,那么该安装mtphotos了
|
||||
创建个目录
|
||||
```shell
|
||||
mkdir /opt/mtphotos
|
||||
```
|
||||
进入
|
||||
```shell
|
||||
cd /opt/mtphotos
|
||||
```
|
||||
创建并编辑docker-compose.yaml文件
|
||||
```shell
|
||||
vim docker-compose.yaml
|
||||
```
|
||||
按 I 进入编辑模式并填入以下内容
|
||||
```shell
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
mtphotos:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/mtphotos/mt-photos:arm-latest
|
||||
container_name: mtphotos
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
volumes:
|
||||
- /opt/mtphotos/config:/config
|
||||
- /nvme/mtphotos/upload:/upload
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- LANG=C.UTF-8
|
||||
dns:
|
||||
- 114.114.114.114
|
||||
depends_on:
|
||||
- mtphotos_ai
|
||||
- mtphotos_face_api
|
||||
mtphotos_ai:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/mtphotos/mt-photos-ai:arm-latest
|
||||
container_name: mtphotos_ai
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
environment:
|
||||
- API_AUTH_KEY=mt_photos_ai_extra
|
||||
mtphotos_face_api:
|
||||
image: crpi-gcuyquw9co62xzjn.cn-guangzhou.personal.cr.aliyuncs.com/devfox101/mt-photos-insightface-unofficial:arm-latest
|
||||
container_name: mtphotos_face_api
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
environment:
|
||||
- API_AUTH_KEY=mt_photos_ai_extra
|
||||
```
|
||||
按 Esc 退出编辑模式,输入 :wq 保存并退出
|
||||
拉取运行
|
||||
```shell
|
||||
docker compose up -d
|
||||
```
|
||||
## 如果一切顺利,那么到此结束
|
Reference in New Issue
Block a user