How do I castling correctly?

According to the rules of chess, move the king first, then the rook.