Where is the library setup data stored?

Before removing and re-creating your server, see Why am I locked out of Server Settings and how do I get in?.

Removing the specified entries from the preferences.xml file will place your server in an unclaimed state. You should then be able to re-claim it and restore access without having to rebuild your libraries, etc.

The information is stored in the Plex database. Make sure you have Backup database every three days enabled in Settings → Server_Name → Scheduled Tasks. That will let you restore from a backup of the database. See Restore a Database Backed Up via ‘Scheduled Tasks’.

To backup the entire Plex Data Folder, see Linux TipsBackup, Restore, or Clone your PMS installation