LineageOS is a free, community built, aftermarket firmware distribution of Android 8.1 (Oreo), which is designed to increase performance and reliability over stock Android for your device.
LineageOS is based on the Android Open Source Project with extra contributions from many people within the Android community. It can be used without any need to have any Google application installed. Linked below is a package that has come from another Android project that restore the Google parts. LineageOS does still include various hardware-specific code, which is also slowly being open-sourced anyway.
Download the latest build and gapps
Reboot to recovery
Flash the latest build and gapps