You have to assume a couple of things, but first you have to analyze the the system in terms of the phase space. Firts divide the phase space of your system in $k$ cells. Let us assume that your system consist in $N$ particles, where $k\ll N$. We're going to say that a microstate of the system is given by the positions of every single particle.
Now, we're gonig to say that the mesostate of the system is given by $\{n_{\alpha}(t)\}\equiv(n_1(t),...,n_N(t))$, where $n_i(t)$ is the average number of particles in the $i$-th cell. And the last thing is this: we are gonig to call the number $W(\{n_{\alpha}(t)\})$ as the number of microsates compatible with the mesostate $\{n_{\alpha}(t)\}$.
Now if $P(\{n_{\alpha}(t)\})$ is the probability of finding the system in the mesostate $\{n_{\alpha}(t)\}$, then we will have
$$P(\{n_{\alpha}(t)\})=W(\{n_{\alpha}(t)\})\cdot p$$
where $p $ is the probability of finding the system un a given microstate.
And now, there are 5 hypotheses that Boltzman assumed to be true:
- All the microstates are equally likely, i.e.
$$p=\frac{1}{k^{N}}$$
2. The system evolves from mesostates of lower probability to mesostates of higher probability.
$$P(\{n_{\alpha}(t+\tau)\})\geq P(\{n_{\alpha}(t)\}),\qquad \forall\tau>0$$
3. The The thermodynamic equilibrium state corresponds to the most probable mesostate. If $\{\tilde n_{\alpha}(t)\}$is the most probable mesostate, then $P(\{\tilde n_{\alpha}(t)\})>P(\{n_{\alpha}(t)\}),\qquad\forall\alpha$.
4 There is a relationship between the entropy of the system and the probability of mesostates.
$$S=S(W\{n_{\alpha}(t)\})$$
That's all what you need, for derive that relation.