Dryer exhaust from 2nd floor through crawl space, out roof
If possible, you want everything rigid: the connection from the dryer to the wall, the duct in the wall, and the duct in the attic. Sometimes rigid for the connection between the dryer and the wall is difficult to get right with a rigid duct so if you have to go with flexible duct then use the smallest piece practical.

A secondary lint trap is probably not worth the effort. instead, invest you money in a dryer vent cleaning kit, which is a brush with a couple of screw-together flexible rods that you can chuck in to a drill. Clean your duct using this brush once a year.