Installing Apache Airflow on Windows requires a few steps, as Airflow officially supports Linux and macOS more extensively. However, with the help of Windows Subsystem for Linux (WSL) or Docker, you can still get Airflow running on your Windows machine. This article will guide you through both methods.
Method 1: Install Apache Airflow Using Windows Subsystem for Linux (WSL)
Step 1: Install WSL
Open PowerShell as an administrator and run the following command to enable WSL:
This command installs WSL and sets up a default Linux distribution (usually Ubuntu).
Restart your machine when prompted, then open Ubuntu from the Start menu to complete the setup.
Step 2: Update and Install Prerequisites in WSL
Update your package lists:
Install Python and pip:
Install other necessary dependencies:
Step 3: Install Apache Airflow
Set up an Airflow environment variable to specify the version and extra packages. For example:
Install Airflow using pip:
Step 4: Initialize and Start Apache Airflow
Initialize the Airflow database:
Create an admin user:
Start the web server:
In a new terminal, start the scheduler:
You can now access Airflow at http://localhost:8080.
Method 2: Install Apache Airflow Using Docker
If you prefer to use Docker, Airflow provides an official Docker image that you can easily run on Windows.
Step 1: Install Docker Desktop
Download and install Docker Desktop for Windows from the official website and follow the installation instructions. Ensure Docker is running before proceeding.
Step 2: Get the Docker Compose File
Open PowerShell or Command Prompt and create a directory for your Airflow installation:
Download the
docker-compose.yaml
template provided by Airflow:
Step 3: Initialize and Start Apache Airflow
Set up environment variables required by Airflow:
Initialize the Airflow database:
Start the Airflow services:
Access Airflow at http://localhost:8080. The default credentials are:
- Username:
airflow
- Password:
airflow
- Username:
To stop Airflow, use
Ctrl + C
in the terminal and then:
Conclusion
Both methods will enable you to run Apache Airflow on a Windows machine, with WSL offering a more native Linux experience and Docker providing an easier setup. Choose the method that best fits your workflow, and you'll have Apache Airflow up and running on Windows in no time.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.