The best steps are:
Massage the cramped muscle
Gently stretch the muscle
Take a hot shower or bath to warm and relax the muscle
It is not well known exactly how dehydration and muscle cramping are related, but it is known that dehydration can predispose to leg cramps. Drink at least three full glasses of water each day, including one before bedtime. Also drink plenty of fluid before, during, and after exercise.