There is no way to prevent lightning from striking a boat. There are techniques that can be used to increase the chance that you will not be injured and the boat will not be sunk by a lightning strike. However, even using these techniques, the boat's
electronics and
electrical equipment will still be at risk of damage.
The major risk during a lightning strike is when the lightning seek a path to the sea that goes through you or the hull of your boat. This is known as a "flashover" event. Lightning will take ALL possible paths to get from ANY metal object above the waterline to the sea. To prevent "flashover"
events all metal objects aboard should be connected to a common seawater ground. This includes stays, shrouds, air terminal,
mast, poles, sail tracks,
lifelines, stanchions, anchor(s),
anchor chain(s),
tanks, through-hulls,
electrical components, electronic
equipment, RF grounding plates, engines, etc. The size of the wires making these connections depends on their length, stress, and thermodynamic characteristics. As an example, the recommended wire size for the connection from the masthead located air terminal should be #4 GA tinned copper. However, an old
stainless steel backstay would
work as good or better. For the other connections #8 GA tinned copper or equivalent should be adequate.
Some common sense is required when making these connections. If an
anchor is laying on a already grounded anchor roller then it too is grounded. However, the bitter end of the anchor chain connected to that anchor should also be taken to its own ground. That way a "flashover" event is less likely to occur between the pile of chain and seawater that includes someone in the v-berth and hull of the boat.
BTW, if you use low inductance connections to connect the above items together you will by default have a very good RF ground system. Low inductance connections can be made using copper or stainless steal tape and braid. The stainless will last longer.