AiiDA Ubuntu 一键部署脚本是一个自动化工具,用于在 Ubuntu/WSL 环境中快速部署完整的 AiiDA 计算科学工作流管理系统。该脚本自动化了 Conda 环境配置、PostgreSQL 数据库安装、RabbitMQ 消息队列配置以及 AiiDA Profile 设置等步骤。
- 一键部署:仅需一条命令即可完成所有组件的安装和配置
- 幂等性设计:支持重复运行,自动检测并跳过已完成的步骤
- 智能包管理:优先使用 pip 安装 AiiDA 包,失败时自动回退到 conda
- 自动验证:部署完成后自动检查所有服务状态
- 详细日志:完整的安装日志,方便问题排查
- Ubuntu 18.04+ 或 WSL (Windows Subsystem for Linux)
- Conda (Miniconda 或 Anaconda)
- 至少 4GB 可用内存
- 至少 10GB 可用磁盘空间
git clone https://github.com/stillfast/aiida-ubuntu-quickstart.git
cd aiida-ubuntu-quickstart编辑 config.env 文件,根据需要修改以下配置:
# Conda 环境配置
CONDA_ENV_NAME=aiida # 环境名称
CONDA_PYTHON_VERSION=3.10 # Python 版本
CONDA_PACKAGES="aiida-vasp" # 要安装的包(支持空格分隔多个包)
# 数据库配置
DB_HOST=127.0.0.1 # 数据库主机
DB_PORT=5432 # 数据库端口
DB_USERNAME=aiida_user # 数据库用户名
DB_PASSWORD=your_password # 数据库密码
DB_NAME=aiida_db # 数据库名称
DB_PATH=/home/user/data/postgresql # 数据库存储路径
# RabbitMQ 配置
RABBITMQ_VERSION=3.8.3 # RabbitMQ 版本
# 用户信息
USER_EMAIL=your@email.com # AiiDA 用户邮箱
USER_FIRSTNAME=Your # 名字
USER_LASTNAME=Name # 姓氏
USER_INSTITUTION=YourInstitution # 机构
# AiiDA Profile 配置
PROFILE_NAME=aiida_profile # Profile 名称
PROFILE_REPOSITORY_URI=file:///home/user/data/aiida_profile # 数据仓库路径bash quickstart.sh部署完成后,运行以下命令验证:
conda activate aiida
verdi status应该看到类似输出:
✔ version: AiiDA v2.8.0
✔ config: /home/user/.aiida
✔ profile: aiida_profile
✔ storage: Storage for 'aiida_profile' [open]
✔ broker: RabbitMQ v3.8.3 @ amqp://guest:guest@127.0.0.1:5672
脚本会自动执行以下步骤:
- 创建 Conda 环境 - 创建指定 Python 版本的虚拟环境
- 安装 AiiDA 包 - 优先 pip,失败则 conda
- 安装 PostgreSQL - 数据库管理系统
- 安装 RabbitMQ - 消息队列服务
- 初始化数据库 - 配置数据库存储路径和端口
- 启动 PostgreSQL - 启动数据库服务
- 创建数据库用户和数据库 - 设置数据库访问凭证
- 配置 AiiDA Profile - 创建 AiiDA 工作环境
- 验证部署 - 检查所有服务状态
原因: 数据库中保留了旧数据
解决方案:
- 使用新的数据库名称(修改
config.env中的DB_NAME) - 或删除旧数据库:
dropdb -h 127.0.0.1 -p 5432 -U aiida_user aiida_db
原因: RabbitMQ 安装时可能降级了 Python
解决方案: 脚本会自动修复,或手动执行:
conda install -n aiida python=3.10原因: 端口被占用或权限不足
解决方案:
# 检查 RabbitMQ 状态
rabbitmqctl status
# 重启 RabbitMQ
rabbitmqctl stop && rabbitmq-server -detached原因: Conda 环境未激活
解决方案:
conda activate aiidaaiida-ubuntu-quickstart/
├── README.md # 本文件
├── config.env # 配置文件
├── quickstart.sh # 主部署脚本
└── logs/ # 安装日志目录
所有安装日志都会保存在 logs/ 目录中,文件名格式为:
aiida_install_YYYYMMDD_HHMMSS.log
如需卸载 AiiDA 环境:
# 删除 Conda 环境
conda env remove -n aiida
# 删除数据目录
rm -rf /home/user/data/postgresql
rm -rf /home/user/data/aiida_profile
# 删除 AiiDA 配置
rm -rf ~/.aiida本项目采用 MIT 许可证。
欢迎提交 Issue 和 Pull Request!
AiiDA Ubuntu Quickstart is an automation tool for quickly deploying a complete AiiDA computational science workflow management system in Ubuntu/WSL environments. The script automates Conda environment setup, PostgreSQL database installation, RabbitMQ message queue configuration, and AiiDA Profile setup.
- One-command deployment: Complete installation and configuration with a single command
- Idempotent design: Supports repeated runs, automatically detects and skips completed steps
- Smart package management: Prefers pip for AiiDA packages, falls back to conda on failure
- Automatic verification: Checks all service statuses after deployment
- Detailed logging: Complete installation logs for easy troubleshooting
- Ubuntu 18.04+ or WSL (Windows Subsystem for Linux)
- Conda (Miniconda or Anaconda)
- At least 4GB available RAM
- At least 10GB available disk space
git clone https://github.com/stillfast/aiida-ubuntu-quickstart.git
cd aiida-ubuntu-quickstartEdit the config.env file to customize your setup:
# Conda Environment
CONDA_ENV_NAME=aiida # Environment name
CONDA_PYTHON_VERSION=3.10 # Python version
CONDA_PACKAGES="aiida-vasp" # Packages to install (space-separated)
# Database Configuration
DB_HOST=127.0.0.1 # Database host
DB_PORT=5432 # Database port
DB_USERNAME=aiida_user # Database username
DB_PASSWORD=your_password # Database password
DB_NAME=aiida_db # Database name
DB_PATH=/home/user/data/postgresql # Database storage path
# RabbitMQ Configuration
RABBITMQ_VERSION=3.8.3 # RabbitMQ version
# User Information
USER_EMAIL=your@email.com # AiiDA user email
USER_FIRSTNAME=Your # First name
USER_LASTNAME=Name # Last name
USER_INSTITUTION=YourInstitution # Institution
# AiiDA Profile Configuration
PROFILE_NAME=aiida_profile # Profile name
PROFILE_REPOSITORY_URI=file:///home/user/data/aiida_profile # Repository pathbash quickstart.shAfter deployment, verify with:
conda activate aiida
verdi statusYou should see output similar to:
✔ version: AiiDA v2.8.0
✔ config: /home/user/.aiida
✔ profile: aiida_profile
✔ storage: Storage for 'aiida_profile' [open]
✔ broker: RabbitMQ v3.8.3 @ amqp://guest:guest@127.0.0.1:5672
The script automatically performs these steps:
- Create Conda Environment - Create virtual environment with specified Python version
- Install AiiDA Packages - Prefer pip, fallback to conda on failure
- Install PostgreSQL - Database management system
- Install RabbitMQ - Message queue service
- Initialize Database - Configure database storage path and port
- Start PostgreSQL - Start database service
- Create Database User and Database - Set up database credentials
- Configure AiiDA Profile - Create AiiDA working environment
- Verify Deployment - Check all service statuses
Cause: Old data remains in the database
Solution:
- Use a new database name (modify
DB_NAMEinconfig.env) - Or delete the old database:
dropdb -h 127.0.0.1 -p 5432 -U aiida_user aiida_db
Cause: RabbitMQ installation may downgrade Python
Solution: Script auto-fixes, or manually:
conda install -n aiida python=3.10Cause: Port in use or insufficient permissions
Solution:
# Check RabbitMQ status
rabbitmqctl status
# Restart RabbitMQ
rabbitmqctl stop && rabbitmq-server -detachedCause: Conda environment not activated
Solution:
conda activate aiidaaiida-ubuntu-quickstart/
├── README.md # This file
├── config.env # Configuration file
├── quickstart.sh # Main deployment script
└── logs/ # Installation log directory
All installation logs are saved in the logs/ directory with filename format:
aiida_install_YYYYMMDD_HHMMSS.log
To uninstall the AiiDA environment:
# Remove Conda environment
conda env remove -n aiida
# Remove data directories
rm -rf /home/user/data/postgresql
rm -rf /home/user/data/aiida_profile
# Remove AiiDA configuration
rm -rf ~/.aiidaThis project is licensed under the MIT License.
Issues and Pull Requests are welcome!