How to set up and install Apache Airflow 3.*

1. Create Airflow directory

# Create directory
mkdir -p ~/airflow
# Move to directory
cd ~/airflow

Create virtual environment

# Create virtual environemnt
python3 -m venv airflow_venv
# Activate virtual environment
source airflow_venv/bin/activate

2. Install Airflow

pip install "apache-airflow=={AIRFLOW VERSION}" --constraint "<https://raw.githubusercontent.com/apache/airflow/constraints->{AIRFLOW VERSION}/constraints-{PYTHON VERSION}.txt"

3. Set Airflow working directory

export AIRFLOW_HOME=~/airflow
# Confirm installation
airflow version

4. Initialize Airflow

airflow standalone

Note: airflow standalone is only used in devolopment, to initialze a production instance, follow the steps below

1. Database Configuration

Navigate to ~/airflow/airflow.cfg and find:

[database]
sql_alchemy_conn = my_conn_string

Replace 'my_conn_string' with your preferred database's connection string. Ensure the database and user exist in the database.