Unlock bootloader / Enable Developer options and USB debugging

: LineageOS 14.1 (Android 7.1.2) specifically for the "espresso3g" or "GT-P5100" model. You can often find these builds on LineageOS for Samsung Galaxy Tab 2 XDA Developers Google Apps (GApps) Open GApps

opengapps.org

You can find Marshmallow ROMs on the same XDA section.

There are two primary options for updating the Samsung Tab 2 10.1 GT-P5100 to Android 7.1.2: