On Linux install the 'android-tools' package.
On Windows and macOS download the command-line tools from https://developer.android.com/tools/releases/platform-tools and extract the downloaded .zip file.
NOTE: If you already have magisk installed skip to step 5.
Download the magisk app from the magisk github repo, you need 'Magisk-{version.number}.apk'.
Download the latest LineageOS OTA update. Link to current version
Once the download completes extract the downloaded .zip file.
Inside of the folder you extracted the zip file to there will be a boot.img file, move this file to your phone. If you do not know how follow steps 3.2 or 3.3.
Requirments: You have a computer running windows or linux. In 'Trust' settings 'Restrict USB' does NOT block all connections.
NOTE: macOS does not have the ability to connect to MTP storage device so follow section 3.3 instead if you use macOS.
Plug your phone into your computer.
Open the settings app. Go into Connected devices, USB. If there is no USB menu option unplug and replug your phone from your computer and if this still does not fix this use a different cable.
Set 'Use USB for' to 'File Transfer'
Your phone now should be seen as a usb storage device inside you file manager, copy your boot.img file somewhere on your phone.
NOTE: If you unplug your phone this setting will not be saved for the next time it's pluged in to a computer.
See https://github.com/localsend/localsend
Transfer boot.img to your device
Open the magisk app
To the right of the of where it has the magisk logo and says magisk press the blue install text.
Set the method to 'Select and patch a file'
A file manager window should open, find where you copied your boot.img file and tap on it
Press the blue 'LET'S GO' text.
Once the text 'All done!' is printed close the magisk app.
Copy the magisk_patched-{random_text}.img file in your phone's downloads folder to your computer.
Power off your phone.
Once you phone is fully powered off hold the power and volume down buttons until the bootloader is shown.
Connect your phone to your computer
Open a terminal window. If you don't know how see section 4.1.
(Windows, macOS): Enter the folder you extracted platfrom tools to (skip if you followed section 4.1)
NOTE: on windows instead of fastboot use .\fastboot.exe. on macOS instead of fastboot use ./fastboot.
Run fastboot devices in your teminal
If no devices are printed use a differnet cable.
(Linux): If you get a user needs to be in plugdev group error run fastboot as root.
(macOS): If you get a permission denied: ./fastboot error run chmod +x fastboot.
Type fastboot flash boot then drag your magisk_patched-{random_text}.img file into the terminal window and press enter.
Run fastboot reboot in your terminal.
Close your terminal window.
Continue to section 5.
Windows: Press the Windows and R keys at the same time, type cmd into the window that opened then press enter.
macOS: Type 'terminal' into spotlight and hit enter. If you don't know to open spotlight read this apple help page.
Inside the now open terminal window 'cd' then press the spacebar
Open a file manager window (on macOS this is finder, on windows this is explorer) go to where you extracted platform tools to and drag that folder into the terminal window then press enter.
Go back to following section 4
Download Integrity-Box from here, you need '{version}-Integrity-Box-{DD}-{MM}-{YYYY}.zip'.
Download ReZygisk from here, you need 'ReZygisk-{version}-release.zip'.
Download TEESimulator from here, you need 'TEESimulator-{version}-Release.zip'.
Open the magisk application.
Enter the modules tab by clicking on the puzzle piece icon in the bottom bar.
Press the button at the top of the screen that says 'Install from storage' it will open a file browser, open one of the downloaded zip files.
Once the restart button appears on press the back key. DO NOT PRESS RESTART.
Repeat the previous to instructions until you have installed all 3 downloaded zip files.
Reboot device.
Open the magisk app and go into the modules tab.
On the card for .Integrity Box tap the blue 'Action' text.
Press the 'Close' button once it appears
(Optional) Install the KsuWebUIStandalone app to be able to use the Intgerity box configuration ui.
In the magisk app tap on the cog icon in the top right corner
Enable 'Enfore DenyList'
(Optional) Tap 'Configure DenyList' and tap the empty sqaure for apps you want to hide magisk from. (eg. google messages, google wallet)
Set 'Superuser access' to 'Apps only'
Set 'Mount namespace mode' to 'Isolated namespace'
(Optional) Set 'Automatic respose' to 'Deny'
In magisk's 'Superuser' tab enable the toggle for apps you want to have superuser access. (eg. Key Mapper, KsuWebUI, Aurora Store, Shizuku, Droidify, etc)
NOTE: The offical F-Droid app does not support rooted/automatic app insallation so I recommend switching to the Droid-fiy client.