How to install Airflow on an Ubuntu machine?

How to install Airflow on an Ubuntu machine?

Install and Configure Airflow in Linux/Ubuntu

ยท

1 min read

Before performing the operation, we need to ensure that our Ubuntu webserver is up to date with the desired packages.

The code provided below will help us install the necessary packages in Linux. In addition to this, we need to install any other packages required for Airflow to function properly.

sudo apt install build-essential gcc g++ make cmake git wget curl python3 python3-pip openssh-server htop neofetch vim nano zip unzip tree
  1. Install Dependencies: First, install the necessary dependencies for Apache Airflow:

     sudo apt update
     sudo apt install python3-pip python3-dev libssl-dev libffi-dev libpq-dev libmysqlclient-dev
    

    1. Install Airflow: Next, you can install Apache Airflow using pip.

      Always recommended to install Airflow in a virtual environment to avoid conflicts with system-wide Python packages.

       sudo pip3 install apache-airflow
       After executing the commands, you will get the success message like below
      

  1. Initialize Airflow Database: After installing Airflow, you need to initialize the database where Airflow will store its metadata.

     airflow db init
    

  2. Start the Airflow Scheduler and Webserver: Finally, start the Airflow scheduler and webserver components.

  3.  airflow webserver --port 8080
     airflow scheduler
    
  4. We are now going to schedule our DAG and work on setting up our Airflow scheduler.

ย