Solution (source code)

= Solution

With unit error variance, the <Gaussian likelihood> has log-likelihood
$$
\ell(\beta)
=-\frac n2\log(2\pi)-\frac12\|Y-X\beta\|_2^2.
$$
Full column rank gives $\widehat\beta=(X^TX)^{-1}X^TY$ and the least-squares identity
$$
\|Y-X\beta\|_2^2
=\|Y-X\widehat\beta\|_2^2
+(\beta-\widehat\beta)^TX^TX(\beta-\widehat\beta).
$$
Multiplying the likelihood by $\prod_j\phi(\beta_j)$ and absorbing all terms independent of $\beta$ into $C$ gives
$$
\pi(\beta\mid Y)
=C\exp\left[
-\frac12(\beta-\widehat\beta)^TX^TX(\beta-\widehat\beta)
+\sum_{j=1}^p\log\phi(\beta_j)
\right].
$$