Generally the straightness of a rail is dependant on the straightness of the surface(s) the rail is mounted to.
For example, the bottom of the rail would be mounted to a surface ground plate and an edge perpendicular to the bottom aligned to a shoulder in line with the axis parallel to the linear axis.
I often place a keyway into the flat surface then insert a key into the keyway. The key provides the shoulder to locate the edge of the linear rail. The keyway/key must be deep enough to clear the bottom of the linear bearing.