Following suggestion of Jacques, I’m reposting my comments above as an answer.

The ring $R[x]$ is formed by adding to $R$ a generic element $x$ commuting with $R$. If $R$ itself is commutative, this essentially amounts to taking the free algebra over one generator in the variety of commutative rings, except that we also have to ensure that the ring contains $R$, and this can be achieved by including in the axiomatization of the variety the positive (aka atomic) diagram of $R$ (as model theorists call it).

That is, we consider the signature $\sigma_0=\{+,\cdot\}\cup R$, where elements of $R$ serve as constants (nullary functions), and we take the variety $V_0$ axiomatized by the axioms of commutative rings (with $(-1)\cdot u$ playing the rôle of $-u$) and all axioms of the form $a+b=c$ or $a\cdot b=c$ that hold in $R$, where $a,b,c$ are constants from $R$. Then $R[x]$ is the free $V_0$-algebra over one generator.

Alternatively, $V_0$ is term-equivalent to the variety of unital commutative $R$-algebras: here we have unary functions $a(u)$ for $a\in R$, denoting scalar multiplication. The constant $a$ of $V_0$ is then definable as $a(1)$, and conversely, in $V_0$ we can define scalar multiplication by $a$ using the binary ring multiplication and the constant for $a$. As noted by Andrew Stacey above, commutativity of the algebras is not needed here: $R[x]$ is also the free unital $R$-algebra over one generator.

If we want $R[x]$ to be an initial algebra (= free algebra over the empty set of generators), and/or if $R$ is not commutative, we can include $x$ in the signature as a new constant: we take $\sigma_1=\sigma_0\cup\{x\}$, and $V_1$ is the variety axiomatized by the axioms of rings, the positive diagram of $R$ as in $V_0$, and the axiom $x\cdot u=u\cdot x$ (where $x$ is the nullary function from $\sigma_1$, whereas $u$ is a universally quantified variable). Then $R[x]$ is the initial algebra in $V_1$. (This is still true if we replace the last axiom with its instances $a\cdot x=x\cdot a$ for $a\in R$; this makes a larger but messier variety.)

If we want to endow $R[x]$ with composition, we can take the signature $\sigma_1\cup\{\circ\}$, and the variety axiomatized by the axioms of $V_1$ together with $(u\circ v)\circ w=u\circ(v\circ w)$, $(u+v)\circ w=(u\circ w)+(v\circ w)$, $(u\cdot v)\circ w=(u\circ w)\cdot(v\circ w)$, $a\circ u=a$ for $a\in R$, $x\circ u=u\circ x=u$. Then $R[x]$ is the initial algebra in this variety (and again, not all of these axioms are needed to obtain this property).