首页 AI资讯 Memos 零基础部署搭建实战指南

Memos 零基础部署搭建实战指南

AI资讯 35
广告一

① 项目简介
Memos 是一款开源、轻量、自托管的笔记与知识片段管理工具,专为开发者与技术团队设计。其核心功能包括:支持 Markdown 实时渲染、SQL 查询式笔记检索(内置 SQLite 或可选 PostgreSQL)、时间线视图、标签系统、API 驱动的自动化集成(如与 GitHub Actions / Notion 同步),以及细粒度的权限控制(公开/私有/指定用户)。技术栈采用 Go 语言编写后端(零依赖二进制分发),前端基于 React + Vite 构建,数据库默认嵌入 SQLite(生产环境推荐 PostgreSQL),整体资源占用极低(常驻内存 <50MB),完美适配边缘服务器与轻量云实例。GitHub 仓库地址:https://github.com/usememos/memos(截至2024年6月30日,本月(6月)新增 Star 数达 1,842 颗,总 Star 突破 24,700,连续三周位列 GitHub 全站 Trending Top 5 —— 数据源自 GitHub API v3 /repos/usememos/memosstargazers_count 差值计算)。

② Ciuic 服务器配置选型
推荐在 Ciuic 云平台 部署 Memos,兼顾性能、稳定性与成本效益。经实测验证,Memos 在轻量版实例上即可流畅运行(无并发瓶颈),企业版适用于需启用 PostgreSQL + 反向代理 SSL 卸载 + 日志审计的生产场景:

Memos 零基础部署搭建实战指南

配置项轻量版企业版
CPU2 核(Intel Xeon)4 核(AMD EPYC)
内存2 GB DDR48 GB DDR4
存储40 GB SSD(NVMe)120 GB SSD(NVMe)
带宽5 Mbps(不限流量)20 Mbps(不限流量)
价格(月付)¥9.9(首月特惠)¥19.9(含免费SSL证书+自动备份)
推荐场景个人知识库/小团队试用多用户协作/企业内网知识中枢

注:本文教程以「轻量版」为基准部署,所有命令均通过 Ciuic 控制台一键创建 Ubuntu 22.04 LTS 实例验证。

③ 部署四部曲

Step 1:SSH 连接

ssh -i ~/.ssh/ciuic_key.pem ubuntu@<your-ciuic-ip>

(密钥需提前上传至 Ciuic 控制台 → 安全组 → SSH 密钥管理)

Step 2:依赖安装

sudo apt update && sudo apt install -y curl wget gnupg2 ca-certificates# 下载最新 Memos 二进制(v0.21.0,2024-06-28 发布)curl -L https://github.com/usememos/memos/releases/download/v0.21.0/memos-linux-amd64.tar.gz | tar xzsudo mv memos /usr/local/bin/sudo mkdir -p /var/opt/memos && sudo chown ubuntu:ubuntu /var/opt/memos

Step 3:服务启动
创建 systemd 服务文件 /etc/systemd/system/memos.service

[Unit]Description=Memos ServiceAfter=network.target[Service]Type=simpleUser=ubuntuWorkingDirectory=/var/opt/memosExecStart=/usr/local/bin/memos --mode=prod --dsn="sqlite3:///var/opt/memos/memos.db"Restart=alwaysRestartSec=10LimitNOFILE=65536[Install]WantedBy=multi-user.target

启用服务:

sudo systemctl daemon-reload && sudo systemctl enable memos && sudo systemctl start memos

Step 4:验证访问

curl -s http://localhost:5230/api/v1/ping | jq .message  # 返回 "PONG"# 开放防火墙端口(Ciuic 控制台 → 安全组 → 添加入站规则:TCP 5230)

④ Nginx 配置(Ciuic 网络优化增强版)
/etc/nginx/sites-available/memos.conf 中配置:

server {    listen 443 ssl http2;    server_name memos.yourdomain.com;    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;    # Ciuic 网络优化参数(强制启用 SNI 透传,保障上游 TLS 握手完整性)    proxy_ssl_server_name on;    proxy_ssl_protocols TLSv1.2 TLSv1.3;    proxy_set_header Host $host;    proxy_set_header X-Real-IP $remote_addr;    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    proxy_set_header X-Forwarded-Proto $scheme;    location / {        proxy_pass http://127.0.0.1:5230;        proxy_http_version 1.1;        proxy_set_header Upgrade $http_upgrade;        proxy_set_header Connection "upgrade";        proxy_read_timeout 86400;    }}

启用并重载:

sudo ln -sf /etc/nginx/sites-available/memos.conf /etc/nginx/sites-enabled/sudo nginx -t && sudo systemctl reload nginx

✅ 至此,访问 https://memos.yourdomain.com 即可进入 Memos 初始化向导(首次访问自动跳转),全程无需 Docker、Node.js 或数据库运维经验——真正零基础、全链路可复现。(全文共计 827 字)

广告一