在Ubuntu上部署OpenMAIC

1. 安装WSL2

使用管理员启动PowerShell,执行启用WSL2:

# 启用WSL功能:/all -- 所有用户启用,/norestart -- 不重启系统
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
# WSL2 依赖 Windows 虚拟机功能,需要额外启用
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# 将WSL2设为默认WSL
wsl --set-default-version 2

执行完成之后,重启win10/win11。

接下来在WSL2中安装Ubuntu系统。

# 查看可用的WSL发行版本
wsl --list --online

# 安装过程中,在用户目录下如果有.wslconfig引起的错误,可用直接上这个配置文件
# 安装过程中,会提示输入用户名和密码,输入完成之后就安装完成了
wsl --install -d Ubuntu-26.04 --location D:\WSL\Ubuntu-26.04

验证命令如下:

# 退出 WSL
wsl --shutdown

# 验证安装
wsl -l -v

启动命令:

wsl -d Ubuntu-26.04

删除命令如下:

wsl --unregister Ubuntu-26.04
Remove-Item -Recurse -Force "D:\WSL\Ubuntu-26.04"

资料:

2. 安装Nodejs以及pnpm

需要安装Node.js和pnpm,安装命令如下:

# 可以使用nvm在本地安装Node.js以及npm,并选择Node.js/npm 的版本
# nvm是一个Node.js版本管理工具:https://github.com/nvm-sh/nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
nvm install 24 # 安装Node.js 24版本
nvm use 24 # 切换到Node.js 24版本
node -v # 验证Node.js版本

# 也可以管理员安装Node.js
sudo apt install nodejs npm
node -v # 验证Node.js版本
npm -v # 验证npm版本

# 安装pnpm
npm install -g pnpm

2. 部署MinerU

需要在带Nvidia GPU的服务器上部署MinerU。不带GPU的服务器,使用CPU运行MinerU,性能会非常差。

MinerU可以使用本地部署,或者使用docker部署。使用docker部署+Nvidia GPU,需要安装NVIDIA Container Toolkit

# Install the prerequisites for NVIDIA Container Toolkit
sudo apt-get update && sudo apt-get install -y --no-install-recommends ca-certificates curl gnupg2

# Configure the production repository and the GPG key
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

# Optional: use experimental packages
sudo sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list

sudo apt update

# Install the NVIDIA Container Toolkit packages
export NVIDIA_CONTAINER_TOOLKIT_VERSION=1.19.1-1
  sudo apt-get install -y \
      nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
      nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
      libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
      libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}
git clone https://github.com/opendatalab/MinerU.git



    Enjoy Reading This Article?

    Here are some more articles you might like to read next:

  • AI工具大全
  • Fast DDS入门(On-Going)
  • NVIDIA GPU 架构:SP、SM 与 LSU 工作原理详解
  • al-folio 模板定制修改总结
  • al-folio 部署记录(Ubuntu 24.04)