Follow the instructions at https://topjohnwu.github.io/Magisk/install.html.
===== magisk_boot.sh =====
This is for LineageOS recovery only. After updating LineageOS, you must perform the procedure again - https://topjohnwu.github.io/Magisk/install.html#patching-images
We created a quick script for it at https://github.com/TECH-SAVIOURS-ORG/magisk_boot.sh.