2inch of diameter is quite good and the lenght depend on you; some people think that 5inch is enought, mine is 7.5inch. You need to keep in mind the lenght of the barrel too: if you have a 8inch barrel, the mock silencer don't have to be longer than 5inch (in my opinion). In my case, I put the mock silencer on a 16inch barrel.
1: Think of what look you want to have.

2: Cut the PVC pipe to the right lenght.
3: Find a way to fix the pipe to the barrel. (in my case, I used training hockey pucks) You can use tape to do "spacers", witch is the main idea of this step. (see picture)

4: Put foam between the two "spacers".
5: Insert the PVC pipe. It should be really tight so be patient and if it's not tight, the pipe will fall, so don't hesitate to do it tight.
This is the way I did it. Feel free to do it your own way or maybe somebody else have a better way to do it.
Hope I helped.