Note espressif32 uses esp-idf with tag v4.4.5

 

Install esp-idf into ~/esp/esp-idf

For esp-idf v4.x:  

sudo apt install -y git wget flex bison gperf python-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util python3-virtualenv

if 'which python' returns nothing:

sudo ln -s /usr/bin/python3 /usr/bin/python

./install.sh esp32 esp32s2 ...

. ~/esp/esp-idf/export.sh

Note the latter must be run following each login, so add to the end of .bashrc

cd ~/esp/esp-idf
export IDF_GITHUB_ASSETS="dl.espressif.com/github_assets"
./install.sh