MeTube 是 youtube-dl / yt-dlp 的網頁前端,可透過瀏覽器下載影音。本文記錄在 Ubuntu 上由原始碼建置並以 systemd 部署的步驟。
建置前端與後端、處理影音時需要這些套件。
apt update && apt install -y git nodejs npm curl ffmpeg
從 GitHub 取得原始碼。
git clone https://github.com/alexta69/metube.git
安裝前端相依套件並建置 Angular 前端。
cd ~/metube/ui && npm install && node_modules/.bin/ng build
安裝 uv(Python 套件管理工具)並同步後端相依套件。
cd ~/metube && curl -LsSf https://astral.sh/uv/install.sh | sh && uv sync
將 uv 加入環境變數。
echo 'source $HOME/.local/bin/env' >> ~/.bashrc && source ~/.bashrc
手動執行測試是否正常。
uv run python3 app/main.py
以 systemd 管理服務,可開機自動啟動、崩潰時自動重啟。先建立服務設定檔。
nano /etc/systemd/system/metube.service
服務檔內容如下:
[Unit] Description=MeTube [Service] Type=simple WorkingDirectory=/root/metube ExecStart=/root/.local/bin/uv run python3 app/main.py Restart=always User=root [Install] WantedBy=multi-user.target
重新載入 systemd 設定、設為開機自動啟動並啟動服務。
systemctl daemon-reload && systemctl enable metube.service && systemctl start metube.service
Deleting the wiki page "Service:MeTube" cannot be undone. Continue?