No need to root the phone at this step,
update the firmware (with heimdall OR odin)
allow bootloader to be unlocked (in dev options),
allow USB android adb debugging, (in dev options)
boot to download mode (with volume down + home + power buttons)
unlock the bootloader (with heimdall, no need with odin) using the command “heimdall print pit” automatically use the pit file included in the phone’s rom (stock firmware, CSC part) ,
re-allow USB android adb debugging (in dev options),
flash TWRP (with heimdall OR odin),
turn off the phone (hold volume down + power buttons)
reboot to recovery (hold volume up + home + power buttons)
wipe the needed partitions (with TWRP)
now you can install /e/ (with TWRP)
after that, if you need root permission for some apps, you could install magisk (with TWRP).