# how to install lineageOS on android phone specifically, I will use the lineageOS+microG version, but any should work. ## Back up you phone First, back up your phone ## Download Android platform tools to your computer You will have to have the Android Platform tools on your computer. On linux it can just be run as a binary: ``` mkdir android-platform-tools cd android-platform-tools wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip unzip platform-tools-latest-linux.zip rm platform-tools-latest-linux.zip mv platform-tools/* . rmdir platform-tools/ ``` Debian packages also exists: ``` sudo apt install android-sdk-platform-tools ``` You may need to reboot to make updated udev rules take place. Plug your phone into your computer, and enable Android debugging via ADB in your phone's developer options (if developer options aren't available, tap the "Build number" field in the "About Phone" section 7 times). Make sure `adb` sees your phone by running: ``` adb devices ``` A message may pop up on your phone asking if you want to allow your computer to permission access your phone. ## (Once per device) Unlock Bootloader Only needs to be done once per device. Probably the hardest part. Enable OEM unlock in the Developer options under device Settings, if present. Reboot into fastboot mode by running: ``` adb reboot bootloader ``` Once the device is in fastboot mode, verify your PC finds it by running: ``` fastboot devices ``` Then unlock the bootloader by running: ``` fastboot oem unlock ``` If the device doesn’t automatically reboot, reboot it. It should now be unlocked. Since the device resets completely, you will need to re-enable USB debugging to continue. ## Install Custom Recovery Download the latest image of your preferred recovery distro. The LineageOS team recommends [TWRP](https://twrp.me/Devices/). Reboot into the bootloader once again: ``` adb reboot bootloader ``` Make sure fastboot sees your phone: ``` fastboot devices ``` Flash recovery onto your device: ``` fastboot flash recovery ${recovery_filename:?}.img ``` Reboot into recovery to verify that the recovery was installed: Turn the phone off, then hold Volume Down+Power to boot into recovery. **Note**: If you've never updated your device firmware, the latest recovery version may not work. Try installing an older version. ## (Optional) Update Firmware Download the latest version of the firmware for your device: - Firmware for the OnePlus 5 is available [here](https://sourceforge.net/projects/cheeseburgerdumplings/files/16.0/cheeseburger/firmware/). - or [here](https://www.oneplus.com/global/support/softwareupgrade). Boot into recovery. In the recovery, select the "Advanced" option, and from there select "ADB Sideload". On your computer, run: ``` adb sideload ${firmware_filename:?}.zip ``` ## Install LineageOS Download the latest version of [LineageOS](https://wiki.lineageos.org/devices/), or if you prefer, [LineageOS for microG](https://download.lineage.microg.org/). Boot into recovery. Go to the Wipe menu by selecting the "Wipe" option from the main menu, and then select the "Advanced Wipe" option. From there, select the "Cache" and "System" partitions to be wiped. Optionally, you may select the "Data" partition to wipe your user data as well. Once you have selected the partitions, slide the bar on the bottom to execute the wipe. Go back to the main menu, and select "Advanced", then "ADB Sideload". On your computer, run: ``` adb sideload ${OS_filename:?}.zip ``` ## (Optional) Install GApps If you aren't using microG, you should install GApps now. The package can be downloaded from [Open GApps](https://opengapps.org). ## (Optional) Install SU/Magisk If you want to be able to run apps as root, you will need to install `SU`. Download the `SU` addon from [here](https://download.lineageos.org/extras). Then sideload it as well. Alternatively, install [Magisk](https://github.com/topjohnwu/Magisk) instead.