The documentation; will answer your question: http://docs.splunk.com/Documentation/Splunk/5.0.6/Installation/HowtoupgradeSplunk
when upgrading to 5.0.x, going from 4.2.x is a supported path. Going to 6.x you have to be on 4.3+.
There is also a list of things to consider and warnings on back ups before you update. The subtopics will answer questions around upgrade order for distributed environments and/or the order of forwarder upgrades in relation to your servers.
... View more