I have a squat rack in my apartment, but it is concrete floors so the floor integrity isn't an issue. I have looked into this a lot for home gyms.
What I have looked into for this for the floor is -
1. Pick a smaller room, and be closer to a wall instead of out in the middle. A room close to the kitchen (or the kitchen itself) can also benefit, the joists tend to be closer to handle all the big appliances.
2. Have the bar be perpendicular to the floor joists.
3. Put down 1" plywood, and then 1" of horse stall mats. That will protect your floor plenty from direct damage and will help distribute the weight among more joists (along and across) to prevent sagging.
4. Treat your lifting like you are in an apartment, not in a gym. You don't have to dump every deadlift or hard rack every squat. I have -ONE- loud set a week, the final big deadlift set. Nobody is going to bitch about 20 seconds of loud in the early afternoon once a week.
I would not oly lift on a second floor pretty much regardless, nor would I stack all the 45's in a corner, spread them out. There's a big difference in dynamic vs. static pressure, so while you can bring in 6 friends and test the floor you could still bow the floor over time with a loaded squat rack.
If you want to figure out if the floor can handle it, ask your landlord if you can put a big ass fish tank in your apartment. They might say no due to water risk, but if the floor can handle a substantial fish tank then you will be fine.