Bird
Raised Fist0
Apache Airflowdevops~10 mins

Installing Airflow locally - Interactive Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to install Apache Airflow using pip.

Apache Airflow
pip install apache-airflow[1]
Drag options to blanks, or click blank then click option'
A--upgrade
Binstall
C==2.7.1
D--version
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'install' after 'pip install' again causes an error.
Using '-upgrade' instead of '--upgrade' is incorrect syntax.
Using '--version' shows version info, not installs.
2fill in blank
medium

Complete the command to initialize the Airflow database after installation.

Apache Airflow
airflow db [1]
Drag options to blanks, or click blank then click option'
Ainit
Bupgrade
Cinitdb
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' tries to run the scheduler or webserver, not initialize DB.
Using 'initdb' is deprecated in newer Airflow versions.
Using 'upgrade' is for database migrations, not initial setup.
3fill in blank
hard

Fix the error in the command to start the Airflow webserver on port 8080.

Apache Airflow
airflow webserver [1] 8080
Drag options to blanks, or click blank then click option'
A--host
B-p
C-d
D--port
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-p' is not recognized by Airflow webserver command.
Using '--host' sets the host, not the port.
Using '-d' is for daemon mode, not port.
4fill in blank
hard

Fill both blanks to create a virtual environment and activate it before installing Airflow.

Apache Airflow
python3 -m [1] airflow_env && source airflow_env/[2]
Drag options to blanks, or click blank then click option'
Avenv
Bbin/activate
CScripts/activate
Dvirtualenv
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'virtualenv' instead of 'venv' is valid but less recommended in Python 3.
Using 'Scripts/activate' is for Windows, not Unix-like systems.
Forgetting to activate the environment causes package installs globally.
5fill in blank
hard

Fill all three blanks to set environment variables for Airflow home, initialize the database, and start the scheduler.

Apache Airflow
export AIRFLOW_HOME=[1] && airflow db [2] && airflow [3]
Drag options to blanks, or click blank then click option'
A"~/airflow"
Binit
Cscheduler
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' instead of 'scheduler' will cause an error.
Not quoting the path can cause issues if it contains spaces.
Skipping database initialization causes scheduler to fail.

Practice

(1/5)
1. What is the first step to install Apache Airflow locally on your machine?
easy
A. Create an Airflow user
B. Start the Airflow webserver
C. Create and activate a Python virtual environment
D. Initialize the Airflow database

Solution

  1. Step 1: Set up isolated Python environment

    Creating and activating a virtual environment ensures Airflow and its dependencies do not interfere with other Python projects.
  2. Step 2: Prepare for Airflow installation

    Once the virtual environment is active, you can safely install Airflow using pip.
  3. Final Answer:

    Create and activate a Python virtual environment -> Option C
  4. Quick Check:

    First step = virtual environment setup [OK]
Hint: Always start with a virtual environment for Python projects [OK]
Common Mistakes:
  • Skipping virtual environment and installing globally
  • Trying to start Airflow before installation
  • Initializing database before installing Airflow
2. Which command correctly installs Apache Airflow with pip inside a virtual environment?
easy
A. pip install airflow
B. pip install airflow-webserver
C. pip install airflow==latest
D. pip install apache-airflow

Solution

  1. Step 1: Use the official package name

    The correct package name for Airflow on PyPI is 'apache-airflow'.
  2. Step 2: Avoid incorrect or incomplete package names

    Other options either use wrong names or non-existent packages.
  3. Final Answer:

    pip install apache-airflow -> Option D
  4. Quick Check:

    Correct package name = apache-airflow [OK]
Hint: Use 'apache-airflow' as the pip package name [OK]
Common Mistakes:
  • Using 'airflow' instead of 'apache-airflow'
  • Adding invalid version specifiers
  • Trying to install non-existent sub-packages
3. After installing Airflow, what is the output of running airflow db init?
medium
A. Initializes the Airflow metadata database
B. Creates a new Airflow user
C. Starts the Airflow webserver
D. Displays Airflow version information

Solution

  1. Step 1: Understand the command purpose

    The command 'airflow db init' sets up the metadata database needed for Airflow to track workflows and tasks.
  2. Step 2: Differentiate from other commands

    Starting the webserver, creating users, or showing version info are done with different commands.
  3. Final Answer:

    Initializes the Airflow metadata database -> Option A
  4. Quick Check:

    'airflow db init' = database initialization [OK]
Hint: Init command sets up Airflow's database, not the server [OK]
Common Mistakes:
  • Confusing db init with webserver start
  • Expecting user creation from db init
  • Thinking it shows version info
4. You run airflow webserver but get an error saying the database is not initialized. What should you do to fix this?
medium
A. Run airflow db init to initialize the database
B. Create a new Airflow user first
C. Restart the machine and try again
D. Install Airflow again using pip

Solution

  1. Step 1: Identify the cause of the error

    The error indicates the Airflow metadata database is missing or not set up.
  2. Step 2: Initialize the database

    Running 'airflow db init' creates the necessary database tables and schema.
  3. Final Answer:

    Run airflow db init to initialize the database -> Option A
  4. Quick Check:

    Database error fixed by db init command [OK]
Hint: Initialize database before starting webserver [OK]
Common Mistakes:
  • Skipping database initialization
  • Trying to create user before db init
  • Restarting machine without fixing db
5. Which sequence of commands correctly installs Airflow, initializes the database, creates an admin user, and starts the webserver and scheduler locally?
hard
A. pip install apache-airflow; airflow users create --username admin; airflow db init; airflow webserver; airflow scheduler
B. python -m venv venv; source venv/bin/activate; pip install apache-airflow; airflow db init; airflow users create --username admin --firstname Admin --lastname User --role Admin --email admin@example.com --password admin; airflow webserver & airflow scheduler
C. source venv/bin/activate; airflow db init; pip install apache-airflow; airflow webserver; airflow scheduler
D. python -m venv venv; pip install apache-airflow; airflow webserver; airflow db init; airflow scheduler

Solution

  1. Step 1: Set up virtual environment and install Airflow

    Create and activate a virtual environment, then install Airflow with pip.
  2. Step 2: Initialize database and create admin user

    Run 'airflow db init' to prepare the database, then create an admin user with the correct command.
  3. Step 3: Start Airflow services

    Start the webserver and scheduler to run Airflow locally.
  4. Final Answer:

    python -m venv venv; source venv/bin/activate; pip install apache-airflow; airflow db init; airflow users create --username admin --firstname Admin --lastname User --role Admin --email admin@example.com --password admin; airflow webserver & airflow scheduler -> Option B
  5. Quick Check:

    Correct full setup sequence = python -m venv venv; source venv/bin/activate; pip install apache-airflow; airflow db init; airflow users create --username admin --firstname Admin --lastname User --role Admin --email admin@example.com --password admin; airflow webserver & airflow scheduler [OK]
Hint: Follow install, init, user create, then start services [OK]
Common Mistakes:
  • Installing Airflow after db init
  • Starting webserver before creating user
  • Not activating virtual environment
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard