Follow the directions on the diagram and make two adapters. One for each end of the long run CAT5/6 cable.
Diagram:
VGA to RJ45 Diagram
Adapters:
VGA-to-RJ45 Adapters
Embedded