On Ubuntu, in my experience, installing the .deb version of the CUDA toolkit pretty much "just works".