According to FHS, all global settings are stored in /etc
and /usr/local/etc/
.
User data and settings are stored in /home/user_name
for regular users and /root
for root.
Service data, like web pages, may be stored in /var
or somewhere else, you better know your environment.
You have to backup up it all. Also you need to save list of software repositories and list of installed packages(this is things are specific for each linux distrib).
Install clear system. Restore repositories settings. Update avaliable package index. Install all packages from saved list. Restore settings and service data. You have completely the same system.
For example, in Debian/Ubuntu:
Save /etc/apt/sources.list
and /etc/apt/sources.list.d/*
for repositories.
Save dpkg --get-selections > packages_list
for packages list.
Install new system. Restore repositories settings.
apt-get update
apt-get dist-upgrade
dpkg --set-selections < packages_list
apt-get dselect-upgrade
Now you may restore settings and data.