Fresh Install of LineageOS with MicroG

Since I flashed my phone a lot and had some corrupt partitions over time it was a good idea to wipe my whole phone clean;

Unlock your phones bootloader.
Download the official LineageOS image. (only the .zip is needed)
Follow this steps and extract all partition images.
You should get this files:

-rw-rw-r--. 1 user user    1785856  6. Dez 11:58 aboot.img
-rw-rw-r--. 1 user user   67108864  6. Dez 11:57 boot.img
-rw-r--r--. 1 user user        492  1. Jan 2009  care_map.pb
-rw-rw-r--. 1 user user     266240  6. Dez 11:58 cmnlib64.img
-rw-rw-r--. 1 user user     208896  6. Dez 11:58 cmnlib.img
-rw-rw-r--. 1 user user      40960  6. Dez 11:58 devcfg.img
-rw-rw-r--. 1 user user   16777216  6. Dez 11:58 dsp.img
-rw-rw-r--. 1 user user    8388608  6. Dez 11:57 dtbo.img
-rw-rw-r--. 1 user user     323584  6. Dez 11:58 keymaster.img
-rw-rw-r--. 1 user user      61440  6. Dez 11:58 lksecapp.img
-rw-rw-r--. 1 user user   17809408  6. Dez 11:58 mdtp.img
drwxr-xr-x. 1 user user          6  6. Dez 11:55 META-INF
-rw-rw-r--. 1 user user   92274688  6. Dez 11:58 modem.img
-rw-r--r--. 1 user user  731475324  1. Jan 2009  payload.bin
-rw-r--r--. 1 user user        155  1. Jan 2009  payload_properties.txt
-rw-rw-r--. 1 user user     176128  6. Dez 11:58 rpm.img
-rw-rw-r--. 1 user user     454656  6. Dez 11:58 sbl1.img
-rw-rw-r--. 1 user user 3221225472  6. Dez 11:58 system.img
-rw-rw-r--. 1 user user    1531904  6. Dez 11:58 tz.img
-rw-rw-r--. 1 user user       4096  6. Dez 11:58 vbmeta.img
-rw-rw-r--. 1 user user 1073741824  6. Dez 11:58 vendor.img

Now erase all partitions of your phone:

fastboot erase aboot_a
fastboot erase aboot_b
fastboot erase boot_a
fastboot erase boot_b
fastboot erase cmnlib64_a
fastboot erase cmnlib64_b
fastboot erase cmnlib_a
fastboot erase cmnlib_b
fastboot erase devcfg_a
fastboot erase devcfg_b
fastboot erase dsp_a
fastboot erase dsp_b
fastboot erase dtbo_a
fastboot erase dtbo_b
fastboot erase keymaster_a
fastboot erase keymaster_b
fastboot erase lksecapp_a
fastboot erase lksecapp_b
fastboot erase mdtp_a
fastboot erase mdtp_b
fastboot erase modem_a
fastboot erase modem_b
fastboot erase rpm_a
fastboot erase rpm_b
fastboot erase sbl1_a
fastboot erase sbl1_b
fastboot erase system_a
fastboot erase system_b
fastboot erase tz_a
fastboot erase tz_b
fastboot erase vbmeta_a
fastboot erase vbmeta_b
fastboot erase vendor_a
fastboot erase vendor_b

Re-flash the following partitions:

fastboot flash aboot_a aboot.img
fastboot flash aboot_b aboot.img
fastboot flash cmnlib64_a cmnlib64.img
fastboot flash cmnlib64_b cmnlib64.img
fastboot flash cmnlib_a cmnlib.img
fastboot flash cmnlib_b cmnlib.img
fastboot flash devcfg_a devcfg.img
fastboot flash devcfg_b devcfg.img
fastboot flash dsp_a dsp.img
fastboot flash dsp_b dsp.img
fastboot flash keymaster_a keymaster.img
fastboot flash keymaster_b keymaster.img
fastboot flash lksecapp_a lksecapp.img
fastboot flash lksecapp_b lksecapp.img
fastboot flash mdtp_a mdtp.img
fastboot flash mdtp_b mdtp.img
fastboot flash modem_a modem.img
fastboot flash modem_b modem.img
fastboot flash rpm_a rpm.img
fastboot flash rpm_b rpm.img
fastboot flash sbl1_a sbl1.img
fastboot flash sbl1_b sbl1.img
fastboot flash tz_a tz.img
fastboot flash tz_b tz.img

You can flash boot, dtbo, system, vbmeta and vendor too if you don’t want to use MicroG.
Do not forget to lock your bootloader in this case.

For LineageOS with MicroG download the second image now.
Extract the partition images again like we did before.
You now should get this files:

-rw-r--r--. 1 root root   67108864  6. Dez 01:57 boot.img
-rw-rw-r--. 1 user user        506  1. Jan 2009  care_map.pb
-rw-r--r--. 1 root root    8388608  6. Dez 01:57 dtbo.img
drwxr-xr-x. 1 user user          6  6. Dez 01:36 META-INF
-rw-rw-r--. 1 user user  728089673  1. Jan 2009  payload.bin
-rw-rw-r--. 1 user user        155  1. Jan 2009  payload_properties.txt
-rw-r--r--. 1 root root 3221225472  6. Dez 01:58 system.img
-rw-r--r--. 1 root root       4096  6. Dez 01:58 vbmeta.img
-rw-r--r--. 1 root root 1073741824  6. Dez 01:58 vendor.img

Flash the remaining files and wipe data to be sure no remaining userdata is left:

fastboot flash boot_a boot.img
fastboot flash boot_b boot.img
fastboot flash dtbo_a dtbo.img
fastboot flash dtbo_b dtbo.img
fastboot flash system_a system.img
fastboot flash system_b system.img
fastboot flash vbmeta_a vbmeta.img
fastboot flash vbmeta_b vbmeta.img
fastboot flash vendor_a vendor.img
fastboot flash vendor_b vendor.img

fastboot -w

Lock the bootloader.
You should now have a fully working and completely clean LineageOS.