Use CRC spray adhesive. I don't think NAPA or similar stores carry it, but most dealerships do through their parts departments. I bought some to redo my pickups liner a couple months ago, I think I paid like $9 for a can.
If you read the back of the cans of most spray adhesives they'll say not for use with headliners. They'll hold up a few months or a year or so at best, but they suck for long term.
Once you pull it you need to remove the old foam. If it's and older vehicle you may be lucky and be able to simply vacuum it off with a hose and brush attachment. If not a wire brush works well. After that you want to spray both the board and the fabric and let them sit apart about 5 minutes. The glue will dry enough that it won't leave handprints in the new fabric but will still get a solid hold and last years.