How to build a ethernet HUB?
Purchase an Ethernet hub chip. (Actually, these are hard to find these days; switches are much more common.)
Build the circuit shown in the chip's Application Notes or Reference Design.


If you really care about the distinction between a hub and a switch, there's some useful information here.