First of all, make sure you have the proper library installed on your system (e.g. BLAS, SCALAPACK, FFTW).
Then, you can follow the instructions here:
As Tianshu Jiang, you can take an existing arch file (in the arch directory) and modify for your need.
A second option, which can be easier for installing CP2K, is to use the toolchain:
Finally, you might also consider that CP2K is part of the Ubuntu packages:
Alfio