Skip to main content

Installation

System Requirements

  • Python: 3.8+ (recommended 3.10)

  • Memory: 4GB RAM minimum, 8GB recommended

  • Storage: 20GB minimum for artifacts

  • Database: PostgreSQL 12+ or MySQL 8+

  • OS: Linux (Ubuntu 20.04+ recommended)

Installation Steps

  1. Environment Setup
bash

# Create virtual environment
python3 -m venv mlflow-env
source mlflow-env/bin/activate
# Upgrade pip
pip install --upgrade pip setuptools wheel
  1. MLflow Installation

bash

# Install MLflow with all dependencies
pip install mlflow[extras]==3.0.1
# Install database connectors
pip install psycopg2-binary # PostgreSQL
pip install pymysql # MySQL
pip install boto3 # AWS S3
  1. Database Setup

sql

-- PostgreSQL setup
CREATE DATABASE mlflow_db;
CREATE USER mlflow_user WITH ENCRYPTED PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE mlflow_db TO mlflow_user;
  1. Directory Structure
bash
# Create MLflow directory structure
mkdir -p /opt/mlflow/{logs,artifacts,config}
mkdir -p /opt/mlflow/artifacts/{models,datasets,experiments}
# Set permissions
chown -R mlflow:mlflow /opt/mlflow
chmod -R 755 /opt/mlflow
  1. Service Installation
bash
# Create systemd service file
sudo tee /etc/systemd/system/mlflow.service > /dev/null <<EOF
[Unit]
Description=MLflow Tracking Server
After=network.target
[Service]
Type=simple
User=mlflow
Group=mlflow
WorkingDirectory=/opt/mlflow
Environment=PATH=/opt/mlflow/mlflow-env/bin
ExecStart=/opt/mlflow/mlflow-env/bin/mlflow server --config-path /opt/mlflow/config/mlflow.yaml
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
# Enable and start service
sudo systemctl daemon-reload
sudo systemctl enable mlflow
sudo systemctl start mlflow