- 1 year ago
Installing and running Airflow on WSL
To install and run Apache Airflow on Windows Subsystem for Linux (WSL), follow these steps:
Set up WSL: If you haven't already, install WSL on your Windows machine by following the official Microsoft documentation. Choose either WSL 1 or WSL 2, depending on your preference.
Install Ubuntu on WSL: Launch the Microsoft Store and search for "Ubuntu." Install the Ubuntu distribution of your choice, such as Ubuntu 20.04 LTS or Ubuntu 18.04 LTS.
Launch the Ubuntu distribution: Open the installed Ubuntu distribution from the Start menu or launch it from the command prompt by typing
wsl
orubuntu
.Update Ubuntu packages: In the Ubuntu terminal, run the following commands to update the package lists and upgrade the installed packages:
bashsudo apt update
sudo apt upgrade -y
Install Python: Apache Airflow requires Python. Install Python and other necessary packages by running the following commands:
bashsudo apt install python3 python3-pip python3-venv -y
Create a virtual environment: It's recommended to create a virtual environment for Airflow. Run the following commands to set up a virtual environment and activate it:
bashpython3 -m venv airflow
source airflow/bin/activate
Install Airflow: Use pip to install Apache Airflow and its dependencies:
bashpip install apache-airflow
Initialize Airflow database: Initialize the Airflow metadata database by running the following command:
bashairflow db init
Start the Airflow webserver and scheduler: Start the Airflow webserver and scheduler using the following command:
bashairflow webserver --port 8080 &
airflow scheduler &
The Airflow webserver will run on port 8080. You can access the Airflow UI by opening a web browser and visiting
http://localhost:8080
.Configure Airflow: Configure Airflow according to your requirements. Refer to the Airflow documentation for details on configuring the Airflow environment, setting up DAGs, and managing tasks.
That's it! You should now have Apache Airflow installed and running on WSL. Remember to manage your Airflow environment and DAGs within the WSL environment and ensure the required dependencies and packages are installed in the WSL Ubuntu distribution.