In person, well, you just have to learn to not be quiet. Personally, that's not an issue, apparently I'm very adequate at instigating and holding conversation. My friends' words, not mine. But you need to be able to talk if you want to get anywhere with anybody. Not like you can speak via telepathy, so learn to work that jaw. Anyway, if you've got the habit of conversing down, it's fairly simple after that. Well, not really, actually. The person you are will definitely be a variable in if you can become friends with a person. Be too friendly, and it might come of as weird. Be too solemn, and it'll come off as weird. I guess it matters what the person in question also likes. Essentially, don't act annoying is the best way to go, though even that is subjective. Anyway, keep talking, and if you really want to be friends with someone, plan ahead. You can't just be friends with someone after only talking to them once, you've gotta make that commitment. It's one of the easier commitments to make in life, I think, but the work is still there.
Online? Not very different, except everything is via text. There's more to it, and it's slightly more complex while at the same time easier (psychological stuff and whatnot) but it's definitely not impossible.