To calibrate the accelerometer you can simply remove the Flight Controller from the vehicle. Whether it is in the vehicle or not makes no difference to calibration
To calibrate the compass you can do the same. However there may be an additional offset vector (x,y,z) caused by ferrous metal in the vehicle.
To find that offset You could try the following.
With a handheld compass and a spirit level (if you are fussy). Place your FC so that it is aligned pointing a specific direction (e.g north)
and then read the raw compass vector.
Then do the same when installed in the vehicle with the FC pointing the same direction.
The difference of the two readings needs to be added to the compass offset. The offsets can be modified by hand using the parameters tools in your GCS or from the command line (see below)
For more accuracy, just take more samples !
As to how to get at these raw compass fields, I know that you can get them via the command line but I am not sure if that is enabled in the normal firmware, however all this is possible, if not exactly simple!