you need to install nvcc for your distro (I assume you are able to do this). Then you have to export path containing bin and library. To do this in a Debian-based OS (like Ubuntu for example), if you give a standard installation, I suggest you to open a shell and type:
Anyway you can find the right code lines at the end of your nvcc installation. These cause to export to the OS information about where are both bins and libraries.
Compiling a CUDA file is the same of compile, for example, a C/C++ file. But you use nvcc instead of, for example, gcc or g++.
Anyway, to compile a file open a shell, move to the right directory (using cd) and type:
nvcc your_file.cu -o the_exe_name
Note that you can omit the option -o.
I suggest you to read nvcc help: