qbit_manage/docs/Nix-Installation.md
bobokun 1e12a1610f
4.5.4 (#910)
# Improvements
- Support cross-platform binary builds (Linux/Windows/MacOS)
- Adds desktop app installers (Linux/Windows/MacOS)
- Container images for latest now pointed to newest version
automatically (Fixes #897)
- Enable automatic open of webUI in local installs
- Add persistence toggling for webUI scheduler

# Bug Fixes
- Fix schedule.yml not loaded upon restarting Docker container (Fixes
#906)
- Fix bug where torrents were not being paused after share limits
reached (Fixes #901)
- Fix(api): prevent path traversal vulnerability in backup restore
endpoint (Fixes CWE-22 Security Vulnerability)
- Fix scheduler to run interval jobs immediately on startup

**Full Changelog**:
https://github.com/StuffAnThings/qbit_manage/compare/v4.5.3...v4.5.4

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-08-16 22:28:26 -04:00

150 lines
4.1 KiB
Markdown

# \*Nix Installation
* Download the script
```bash
wget -O - https://github.com/StuffAnThings/qbit_manage/archive/master.tar.gz | tar xz --strip=1 "qbit_manage-master"
```
* Make it executable
```bash
chmod +x qbit_manage.py
```
* Get & Install Requirements
```bash
pip install .
```
* Create Config
**Note:** If using the standalone desktop app, it will automatically create the necessary directories and config files. For command-line usage, you have these options:
**Option 1 - Use default system location:**
```bash
# Create the config directory
mkdir -p ~/.config/qbit-manage
# Copy the sample config
cp config/config.yml.sample ~/.config/qbit-manage/config.yml
# Edit the config file
nano ~/.config/qbit-manage/config.yml
```
**Option 2 - Keep in project directory:**
```bash
cd config
cp config.yml.sample config.yml
nano -e config.yml
```
* Create the update script
```bash
nano qbm-update.sh
```
* Paste the below into the update script and update the Paths and Service Name (if using systemd)
```bash
#!/usr/bin/env bash
set -e
set -o pipefail
force_update=${1:-false}
# Constants
QBM_PATH="/opt/qbit_manage"
QBM_VENV_PATH="/opt/.venv/qbm-venv"
QBM_SERVICE_NAME="qbmanage"
QBM_UPSTREAM_GIT_REMOTE="origin"
QBM_VERSION_FILE="$QBM_PATH/VERSION"
QBM_REQUIREMENTS_FILE="$QBM_PATH/pyproject.toml"
CURRENT_UID=$(id -un)
# Check if QBM is installed and if the current user owns it
check_qbm_installation() {
if [ -d "$QBM_PATH" ]; then
qbm_repo_owner=$(stat --format='%U' "$QBM_PATH")
qbm_repo_group=$(stat --format='%G' "$QBM_PATH")
if [ "$qbm_repo_owner" != "$CURRENT_UID" ]; then
echo "You do not own the QbitManage repo. Please run this script as the user that owns the repo [$qbm_repo_owner]."
echo "use 'sudo -u $qbm_repo_owner -g $qbm_repo_group /path/to/qbm-update.sh'"
exit 1
fi
else
echo "QbitManage folder does not exist. Please install QbitManage before running this script."
exit 1
fi
}
# Update QBM if necessary
update_qbm() {
current_branch=$(git -C "$QBM_PATH" rev-parse --abbrev-ref HEAD)
echo "Current Branch: $current_branch. Checking for updates..."
git -C "$QBM_PATH" fetch
if [ "$(git -C "$QBM_PATH" rev-parse HEAD)" = "$(git -C "$QBM_PATH" rev-parse @'{u}')" ] && [ "$force_update" != true ]; then
current_version=$(cat "$QBM_VERSION_FILE")
echo "=== Already up to date $current_version on $current_branch ==="
exit 0
fi
current_requirements=$(sha1sum "$QBM_REQUIREMENTS_FILE" | awk '{print $1}')
git -C "$QBM_PATH" reset --hard "$QBM_UPSTREAM_GIT_REMOTE/$current_branch"
}
# Update virtual environment if requirements have changed
update_venv() {
new_requirements=$(sha1sum "$QBM_REQUIREMENTS_FILE" | awk '{print $1}')
if [ "$current_requirements" != "$new_requirements" ] || [ "$force_update" = true ]; then
echo "=== Requirements changed, updating venv ==="
"$QBM_VENV_PATH/bin/python" -m pip install --upgrade "$QBM_PATH"
fi
}
# Restart the QBM service
restart_service() {
echo "=== Restarting QBM Service ==="
sudo systemctl restart "$QBM_SERVICE_NAME"
new_version=$(cat "$QBM_VERSION_FILE")
echo "=== Updated to $new_version on $current_branch"
}
# Main script execution
check_qbm_installation
update_qbm
update_venv
restart_service
```
* Make the update script executable
```bash
chmod +x qbm-update.sh
```
* Run the update script
```bash
./qbm-update.sh
```
## Running qBit Manage
To run qBit Manage with the Web API and Web UI enabled, execute the `qbit_manage.py` script with the `--web-server` flag:
**If using the default config location (`~/.config/qbit-manage/config.yml`):**
```bash
python qbit_manage.py --web-server
```
**If using a custom config location:**
```bash
python qbit_manage.py --web-server --config-file /path/to/your/config.yml --log-file /path/to/your/activity.log
```
After running, you can access the Web UI in your browser, typically at `http://localhost:8080`.