### Install and run NapCat Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Commands to download the NapCat installer script, run it with specific options for Docker and CLI, and then start NapCat. ```bash # 安装NapCat curl -o napcat.sh https://nclatest.znin.net/NapNeko/NapCat-Installer/main/script/install.sh sudo bash napcat.sh --docker n --cli y # 打开NapCat sudo napcat ``` -------------------------------- ### Install MaiBot-Napcat-Adapter dependencies using uv Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Commands to install dependencies for the MaiBot-Napcat-Adapter, create a virtual environment, and copy the configuration template. ```bash cd .. cd MaiBot-Napcat-Adapter uv venv uv pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple --upgrade # 复制并重命名配置文件 cp template/template_config.toml config.toml ``` -------------------------------- ### Install MaiBot-Napcat-Adapter Dependencies with uv Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_linux Installs MaiBot-Napcat-Adapter dependencies from requirements.txt using uv, specifying an Aliyun mirror. ```bash cd .. cd MaiBot-Napcat-Adapter uv venv uv pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple --upgrade ``` -------------------------------- ### Install Dependencies using Traditional Pip and uv Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_linux Installs dependencies using pip for uv and then uses uv to install the project requirements, with an Aliyun mirror. ```bash cd MaiBot pip install uv -i https://mirrors.aliyun.com/pypi/simple uv pip install -i https://mirrors.aliyun.com/pypi/simple -r requirements.txt --upgrade ``` -------------------------------- ### Install proot, Ubuntu, and essential packages Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Commands to install proot, Ubuntu, and necessary software like sudo, vim, git, Python, and screen within the ZeroTermux environment. ```bash pkg install proot-distro # 安装proot proot-distro install ubuntu # 安装Ubuntu proot-distro login ubuntu # 登录Ubuntu ``` ```bash apt update apt install sudo vim git python3-dev python3.12-venv build-essential screen curl python3-pip ``` -------------------------------- ### Install Adapter Dependencies using uv (Traditional Method) Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_linux Installs the adapter's dependencies using uv after navigating to the adapter's directory, using an Aliyun mirror. ```bash cd .. cd MaiBot-Napcat-Adapter uv pip install -i https://mirrors.aliyun.com/pypi/simple -r requirements.txt --upgrade ``` -------------------------------- ### Install uv package manager Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Instructions for installing the uv package manager using pip, which is recommended for faster dependency installation and better management. ```bash # 使用 pip 安装 uv pip3 install uv ``` -------------------------------- ### Start MaiBot Robot Source: https://docs.mai-mai.org/manual/deployment/old/manual_deploy_windows Instructions on how to start the MaiBot robot after all configurations are complete. Two methods are provided: using 'nb run' or directly executing 'python bot.py'. ```Bash # Open command line, cd to the project directory nb run ``` ```Bash # Or, cd to the project directory and run: python bot.py ``` -------------------------------- ### Install MaiBot-Napcat-Adapter Dependencies with uv Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_windows This command navigates to the MaiBot-Napcat-Adapter directory, creates a virtual environment using 'uv venv', and installs dependencies from 'requirements.txt' using 'uv pip install', specifying an Aliyun mirror and enabling upgrades. ```shell cd .. cd MaiBot-Napcat-Adapter uv venv uv pip install -r .\requirements.txt -i https://mirrors.aliyun.com/pypi/simple --upgrade ``` -------------------------------- ### Install and Run MaiBot TTS Adapter Source: https://docs.mai-mai.org/manual/adapters/tts This snippet shows the basic steps to clone the MaiBot TTS adapter repository, install its dependencies, and run the main script. It requires Git, Python, and pip. ```bash git clone https://github.com/MaiM-with-u/maimbot_tts_adapter.git cd maimbot_tts_adapter pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple --upgrade python main.py ``` -------------------------------- ### Install MaiBot Dependencies with uv Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_linux Installs MaiBot dependencies from requirements.txt using uv, specifying an Aliyun mirror for faster downloads. ```bash cd MaiBot uv venv uv pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple --upgrade ``` -------------------------------- ### Install MaiBot Dependencies with uv Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_windows This command navigates into the MaiBot directory, creates a virtual environment using 'uv venv', and then installs dependencies from 'requirements.txt' using 'uv pip install'. It specifies an Aliyun mirror for faster downloads and includes an upgrade flag. ```shell cd MaiBot uv venv uv pip install -r .\requirements.txt -i https://mirrors.aliyun.com/pypi/simple --upgrade ``` -------------------------------- ### Install MaiBot-Napcat-Adapter dependencies using pip Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Commands to install dependencies for the MaiBot-Napcat-Adapter using pip and copy the configuration template. ```bash cd .. cd MaiBot-Napcat-Adapter pip3 install -r requirements.txt # 复制并重命名配置文件 cp template/template_config.toml config.toml ``` -------------------------------- ### Install Python 3.9.13 on Windows Source: https://docs.mai-mai.org/manual/deployment/old/manual_deploy_windows Instructions for downloading and installing Python 3.9.13 on Windows, including adding it to the system's PATH. An alternative PowerShell script for automated installation is also provided. ```English 1. Visit Python official download page: https://www.python.org/downloads/release/python-3913/ 2. Download Windows installer (64-bit): `python-3.9.13-amd64.exe` 3. Run the installer, ensuring 'Add Python 3.9 to PATH' is checked. 4. Click 'Install Now'. ``` ```PowerShell # Download and install Python 3.9.13 $pythonUrl = "https://www.python.org/ftp/python/3.9.13/python-3.9.13-amd64.exe" $pythonInstaller = "$env:TEMP\python-3.9.13-amd64.exe" Invoke-WebRequest -Uri $pythonUrl -OutFile $pythonInstaller Start-Process -Wait -FilePath $pythonInstaller -ArgumentList "/quiet", "InstallAllUsers=0", "PrependPath=1" -Verb RunAs ``` -------------------------------- ### Install MaiBot-Napcat-Adapter Dependencies with pip Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_windows This command navigates to the MaiBot-Napcat-Adapter directory and installs dependencies from 'requirements.txt' using pip, specifying an Aliyun mirror and enabling upgrades. This is a traditional method. ```shell cd .. cd MaiBot-Napcat-Adapter pip install -i https://mirrors.aliyun.com/pypi/simple -r .\requirements.txt --upgrade ``` -------------------------------- ### Install Docker and Docker Compose Source: https://docs.mai-mai.org/manual/deployment/old/linux_deploy_guide_for_beginners Installs Docker and Docker Compose using a convenience script and adds the current user to the docker group for easier access. ```bash # Install Docker curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh # Install Docker Compose sudo apt install -y docker-compose # Add user to docker group sudo usermod -aG docker $USER # Re-login for changes to take effect exit ``` -------------------------------- ### Launching MaiBot-Napcat-Adapter with uv Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Starts the MaiBot-Napcat-Adapter using 'uv' within a 'screen' session. Assumes NapCat is already running. ```bash screen -R mmc-adapter cd ~/maimai/MaiBot-Napcat-Adapter uv run python3 main.py # 按 Ctrl+A 然后按 D 退出screen ``` -------------------------------- ### Install MaiBot dependencies using uv Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Commands to install MaiBot dependencies using the uv package manager, including creating a virtual environment and specifying a mirror for faster downloads. ```bash cd MaiBot uv venv uv pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple --upgrade ``` -------------------------------- ### Persistent Startup with uv Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Instructions for persistently starting MaiBot and its adapter using 'uv' within 'screen' sessions after entering an Ubuntu environment. ```bash # 进入Ubuntu环境 proot-distro login ubuntu su # 如果使用root用户完成整个流程请跳过这步 # 启动适配器 screen -r mmc-adapter cd ~/maimai/MaiBot-Napcat-Adapter uv run python3 main.py # 按 Ctrl+A 然后按 D 退出 # 启动麦麦核心 screen -r mmc cd ~/maimai/MaiBot uv run python3 bot.py # 按 Ctrl+A 然后按 D 退出 ``` -------------------------------- ### Initialize Container Environment Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_docker Starts the Docker containers, waits for 15 seconds, and then stops them to generate initial configuration files. ```Bash docker compose up -d && sleep 15 && docker compose down ``` -------------------------------- ### Install Necessary Dependencies Source: https://docs.mai-mai.org/manual/deployment/old/linux_deploy_guide_for_beginners Installs essential packages like git, curl, Python 3, pip, and venv, which are required for MaiBot deployment. ```bash sudo apt install -y git curl python3 python3-pip python3-venv ``` -------------------------------- ### Install MaiBot Dependencies with pip Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_windows This command navigates into the MaiBot directory and installs dependencies from 'requirements.txt' using pip, specifying an Aliyun mirror for faster downloads and including an upgrade flag. This is a traditional method. ```shell cd MaiBot pip install -i https://mirrors.aliyun.com/pypi/simple -r .\requirements.txt --upgrade ``` -------------------------------- ### Create Python Virtual Environment for MaiBot Source: https://docs.mai-mai.org/manual/deployment/old/manual_deploy_windows Guides on creating and activating a Python virtual environment for MaiBot using either Python's built-in 'venv' module or Conda. It also includes installing project dependencies using pip. ```Bash # --- Method 1: Using venv (built-in Python) # Create virtual environment (named 'maimbot') in the current directory # Ensure you are in the correct directory before running python -m venv maimbot # Activate the environment maimbot\Scripts\activate # Install dependencies pip install -r requirements.txt ``` ```Bash # --- Method 2: Using conda # Create a new conda environment (named 'maimbot') with Python 3.9 conda create -n maimbot python=3.9 # Activate the environment conda activate maimbot # Install dependencies pip install -r requirements.txt ``` -------------------------------- ### Launching MaiBot Core with uv Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Starts the MaiBot core application using 'uv' within a 'screen' session. Assumes NapCat is already running. ```bash screen -R mmc # 窗口会清空,别慌 cd ~/maimai/MaiBot uv run python3 bot.py # 按 Ctrl+A 然后按 D 退出screen ``` -------------------------------- ### Access NapCat Web UI and Get Token Source: https://docs.mai-mai.org/manual/deployment/old/linux_deploy_guide_for_beginners Instructions to access the NapCat web interface and retrieve the authentication token from container logs. ```bash # Access NapCat UI: http://your_server_ip:6099 # Get token from logs: docker logs -f napcat # Look for a line like: [WebUi] WebUi Local Panel Url: http://127.0.0.1:6099/webui?token=xxxx ``` -------------------------------- ### Create Configuration Files Source: https://docs.mai-mai.org/manual/deployment/old/docker_deploy Creates empty .env.prod and bot_config.toml files. These files are required before starting the Docker containers for MaiBot configuration. ```bash touch .env.prod touch bot_config.toml ``` -------------------------------- ### uv Commands Quick Reference Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_linux A quick reference table for commonly used 'uv' commands, including creating virtual environments, installing dependencies, and running the core application and adapter. ```APIDOC uv venv - Creates a Python virtual environment. uv pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple --upgrade - Installs dependency packages from requirements.txt, using a specified mirror and upgrading existing packages. uv run python3 bot.py - Runs the MaiBot core application. uv run python3 main.py - Runs the Napcat adapter. ``` -------------------------------- ### Install uv Package Manager Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_linux Installs the uv package manager using pip or the official installation script. ```bash # Using pip pip3 install uv # Using official script curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Start MaiBot Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_docker Starts all MaiBot components using Docker Compose in detached mode. ```Bash docker compose up -d ``` -------------------------------- ### Install uv Package Manager Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_windows This command installs the 'uv' package manager using pip. uv is recommended for faster package installation and better dependency management. ```shell pip install uv ``` -------------------------------- ### Install and Run GoCQ Adapter (Bash) Source: https://docs.mai-mai.org/manual/adapters/gocq Commands to clone the MaiBot GoCQ Adapter repository from GitHub, install its Python dependencies, and run the adapter. It specifies using the Aliyun mirror for faster package installation. ```bash git clone https://github.com/LOGIC-SC/MaiBot-Gocq-Adapter.git pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple --upgrade python main.py ``` -------------------------------- ### Verify Clang Installation Source: https://docs.mai-mai.org/manual/usage/compile_and_install Checks if the Clang compiler has been successfully installed on MacOS by displaying its version information. ```bash clang --version ``` -------------------------------- ### Install MaiBot Napcat Adapter Source: https://docs.mai-mai.org/manual/adapters/napcat Steps to clone the repository, install dependencies, and run the adapter. It uses pip for dependency management and python for execution. ```bash git clone https://github.com/MaiM-with-u/MaiBot-Napcat-Adapter.git pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple --upgrade python main.py ``` -------------------------------- ### Verify GCC/G++ Installation Source: https://docs.mai-mai.org/manual/usage/compile_and_install Checks if the GCC and G++ compilers have been successfully installed by displaying their version information. ```bash gcc --version g++ --version ``` -------------------------------- ### Install Clang on MacOS Source: https://docs.mai-mai.org/manual/usage/compile_and_install Installs the Clang compiler on MacOS using Homebrew or Xcode command-line tools. ```bash # Install Homebrew (if not already installed) /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Install clang brew install llvm # Or use Xcode command-line tools: xcode-select --install ``` -------------------------------- ### Persistent Startup (Traditional Method) Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Instructions for persistently starting MaiBot and its adapter using traditional Python execution within 'screen' sessions after entering an Ubuntu environment. ```bash # 进入Ubuntu环境 proot-distro login ubuntu su # 如果使用root用户完成整个流程请跳过这步 # 启动适配器 screen -r mmc-adapter cd ~/maimai/MaiBot-Napcat-Adapter source ../MaiBot/venv/bin/activate python3 main.py # 按 Ctrl+A 然后按 D 退出 # 启动麦麦核心 screen -r mmc cd ~/maimai/MaiBot source venv/bin/activate python3 bot.py # 按 Ctrl+A 然后按 D 退出 ``` -------------------------------- ### Install MaiBot dependencies using pip Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Commands to install MaiBot dependencies using the traditional pip package manager. ```bash cd MaiBot pip3 install -r requirements.txt ``` -------------------------------- ### Launching MaiBot-Napcat-Adapter (Traditional Method) Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Starts the MaiBot-Napcat-Adapter using traditional Python execution within a 'screen' session, including virtual environment activation. Assumes NapCat is already running. ```bash screen -R mmc-adapter cd ~/maimai/MaiBot-Napcat-Adapter source ../MaiBot/venv/bin/activate # 激活虚拟环境 python3 main.py # 按 Ctrl+A 然后按 D 退出screen ``` -------------------------------- ### Install Python 3.12 on Debian/Ubuntu Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_linux Instructions for installing Python 3.12 on Debian or Ubuntu systems and setting it as the default Python 3. ```bash # Install Python 3.12 sudo apt update sudo apt install python3.12 python3.12-venv # Set python3.12 as default python3 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 sudo update-alternatives --config python3 ``` -------------------------------- ### Start MaiBot using Docker Compose Source: https://docs.mai-mai.org/manual/deployment/old/linux_deploy_guide_for_beginners Starts MaiBot and its associated services in detached mode using Docker Compose. ```bash docker-compose up -d ``` -------------------------------- ### Install GCC/G++ on Debian-based Systems Source: https://docs.mai-mai.org/manual/usage/compile_and_install Installs the GCC and G++ compilers on Debian-based Linux distributions like Ubuntu and Linux Mint. ```bash # Update package index sudo apt update # Install gcc and g++: sudo apt install build-essential ``` -------------------------------- ### Install Python Dependencies Source: https://docs.mai-mai.org/manual/usage/compile_and_install Installs the necessary Python packages listed in the requirements.txt file, using a specific mirror for faster downloads. ```bash pip install -i https://mirrors.aliyun.com/pypi/simple -r requirements.txt --upgrade ``` -------------------------------- ### Initial Configuration Copying Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Copies template configuration files for the bot and environment variables, then opens the environment file for editing. ```bash cp template/bot_config_template.toml config/bot_config.toml cp template/template.env .env vim .env ``` -------------------------------- ### Copy Configuration Templates Source: https://docs.mai-mai.org/manual/deployment/old/linux_deploy_guide_for_beginners Copies the template configuration files for production environment and bot settings. ```bash # Copy template files cp template.env .env.prod cp template/bot_config_template.toml bot_config.toml ``` -------------------------------- ### Install GCC/G++ on Red Hat-based Systems Source: https://docs.mai-mai.org/manual/usage/compile_and_install Installs the GCC and G++ compilers on Red Hat-based Linux distributions like Fedora, CentOS, and RHEL. ```bash # Update package index sudo dnf check-update # Install gcc and g++ sudo dnf install gcc gcc-c++ # If using yum, replace dnf with yum ``` -------------------------------- ### Prepare Core Component Configuration Template Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_docker Downloads the template .env file for core MaiBot configuration. Provides an alternative download URL. ```Bash wget https://raw.githubusercontent.com/MaiM-with-u/MaiBot/main/template/template.env \ -O docker-config/mmc/.env ``` ```Bash wget https://github.moeyy.xyz/https://raw.githubusercontent.com/MaiM-with-u/MaiBot/main/template/template.env ``` -------------------------------- ### Configure MaiBot API Key Source: https://docs.mai-mai.org/faq/maibot/install_running This section explains how to set up the API key for MaiBot. It involves registering on the Silicon Flow API website, obtaining an API key, and updating the `.env` file in the MaiBot root directory. ```APIDOC File: `.env` Key: `SILICONFLOW_KEY=` Description: Assign your obtained API key from the Silicon Flow API website to this field. ``` -------------------------------- ### Command Reference: Basic Navigation and Editing Source: https://docs.mai-mai.org/manual/deployment/mmc_deploy_android Common commands for navigating directories and editing files using Vim. ```bash cd xxx # 进入xxx目录(若xxx为..则返回上一级目录) vim xxx # 使用vim编辑器编辑文件 ESC + :wq # 退出vim并保存 ```