The rough process of the most important steps is:
- Backup the data you want to keep
- Install an open Android OS like Replicant or LineageOS according to the respective guide for your phone
- Install the F-Droid app store
I have some older iPhones and would be interested in reusing them, say, as dedicated webcam servers or similar. It will be a great day when someone comes up with a way of flashing an iPhone with another operating system.
I saw a link for Replicant in an email newsletter today. I don’t have a supported device, but it looks interesting.