Group as a category
Solution 1:
Yes, you can. Define a category $M$ with just one formal object say $ob(M) = \{X\}$. Let $G$ be a group. Define $Mor(X,X)$ = underlying set of $G$, and composition of morphisms in $Mor(X,X)$ by the binary operation on $G$. The identity morphism on X is just the identity element in $G$. Then you can verify that all axioms of a category are satisfied by $M$. Since each element in $G$ has an inverse, note, moreover, that every element in $Mor(X,X)$ is an isomorphism. In fact, you can define any monoid as a category with just one formal object in this way. But, with a monoid viewed as a category with one object, it is no longer true that every morphism of that object is an isomorphism.
Solution 2:
A group is a category with some of its morphisms declared to be the same.
Roughly, a category is a collection of objects with a set of morphisms which start at one object and end at another. The objects exists merely so the morphisms can have starting and ending points and have no properties themselves. All the information in a category is contained in the morphisms. (If we are going to have any chance of thinking of a group as a special kind of category, we must think of the elements of the group as the morphisms between objects.) The morphisms satisfy three axioms:
i) If f is a morphism from A to B and g is a morphism from B to C, then there is a morphism from A to C named $f\circ g$.
iia) For each object B there is a morphism named $id_B$ with the property that $id_B \circ f$ is the same as $f$ for all morphisms $f$ from A to B for any object A.
iib)Likewise, there is a morphism $_Bid$ with the property that $h\circ_Bid$ is the same as $h$ for all morphisms $h$ from B to C for any object C.
iii) For any three morphisms $f$, $g$, and $h$ from A to B, B to C, and C to D, the morphisms named $(h \circ g) \circ f$ and $h \circ (g \circ f)$ are the same. (In other words we can refer to the morphism $h circ g circ f$ unambiguously.)
It is necessary from these axioms that $id_B$ and $_Bid$ are the same, since $id_{B} \circ _Bid$ is the same as $_Bid$ by (iia) and $id_B \circ _Bid $ is the same as $id_B$ by (iib). Therefore we only need to use the name $id_B$. It is also necessary that there is only one identity morphism per object.
A group is a category where some of the morphisms are declared to be the same. If we had a category with one object and we have some non-identity morphism f, then (i) says there is an arrow named $f\circ f$, thus there is also a morphism $f \circ f \circ f$, and $f \circ f \circ f \circ f$, and so on... We may or may not declare any of these compositions to be the same in a category.
If we did impose the relation on the category that $f \circ f \circ f \circ f \circ f$ is the same as $id$ then this category is the cyclic group with four elements. Notice the elements of the groups are the morphisms of the category $id$, $f$, $f\circ f$, $f \circ f \circ f$. If we imposed this relation on the category, the category becomes a realization of the cyclic group on 4 elements. That is we can verify the groups axioms using only the definition of a category and the additional restriction that there are exactly 4 morphisms. Associativity and identity are inherited from the definition of the category. Inverses are a necessity of the declaring $f circ f \circ f \circ f$ to be the same as the $id$. We exhibit that $f\circ f$ is its own inverse by noting that $(f \circ f)^-1$ is the same as $f\circ f$ by composing $f\circ f$ with itself. Similarly $f\circ f\circ f$ and $f$ are inverses by our declaration.
I would say a group is a category with only one object, satisfying an additional axiom.
iv) For every morphism $f$, there is a morphism named $f^{-1}$ such that $f\circ f^{-1}$ and $f^{-1} \circ f$ are both other names for $id$.
Any particular group is formed by declaring more of the morphisms to be the same. For example, $\mathbb{Z}$ is a category with one object, and a morphism $f$ and $f^{-1}$ which generate all other morphisms. $f$ can be associated with $1$ and $f^-1$ with $-1$. To say $2 - 4 = -2$ in the ordinary notation for $\mathbb{Z}$ would be saying that
$(f\circ f) \circ (f^{-1} \circ f^{-1} \circ f^{-1} \circ f^{-1})$
$= f\circ (f \circ f^{-1}) \circ f^-1 \circ f^-1 \circ f^-1$ by (iii)
$= f \circ id \circ f^{-1} \circ f^{-1} \circ f^{-1}$ by (iv)
$= f \circ f^{-1} \circ f^{-1} \circ f^{-1}$ by (ii a or b)
$= (f \circ f^{-1} \circ f^{-1} \circ f^{-1}$ by (iii)
$= id \circ f^{-1} \circ f^{-1} $ by (iv)
$= f^{-1} \circ f^{-1} $ by (ii a only)