I think you are looking at the problem the wrong way. You are asking software questions when you should be thinking hardware.
The Raspberry Pi computer (generally linux) has the GPIO, I2C and other ports you are talking about. These are not generally available on standard PC machine hardware. I have recently made myself at home in this world. Have a look at the Raspberry Pi forums
here[
^]. A helpful library can be found
here[
^].
P.S. You flagged "Ubuntu" in your message. The Raspberry Pi is linux, but not Ubuntu. I assume that is not a problem. If you were strictly searching for an Ubuntu solution, that may have limited availability of answers.