Replication on same physical server
I'm hoping you're talking about MS-SQL Server.
In that case is the answer: Yes you can run it on the same server.
Is it a good idea, that depends on what you want to achieve with it and how many resources that you have on the server.

I would prefer, if one server is only possible, that you install 3 different MS-SQL Server instances on this server each with their own mry and own storage.
But understand, that in case the server goes off-line, all 3 instances are also off-line.

Proper evaluation is needed.