When you figure it out, let me know, okay?
Somehow I'm 30 years old and loneliness hasn't killed me yet. I'm honestly surprised and amazed by that sometimes. I often feel like "6 more months of this would destroy me," but I've felt this way for at least 20 years.
Using my loneliness as motivation, I've forced myself to go out and practice socializing. It's getting better now because I can actually make friends (not the close friends I want to have, but useful "pivots" for social networking).
Try taking classes, joining clubs, attending meetups (meetup.com isn't too bad), dating online and off, going to bars and clubs (don't expect to survive long at first - just go in, have a single beer, and then immediately leave, when you're reasonably comfortable with that, go in, have a single beer, start 1 conversation, and then leave, etc), joining sports teams (varsity teams or private groups, low-intensity sports like ultimate frisbee work if you're not comfortable with more serious engagement), joining Toastmasters, going to support groups, etc. Make a concerted effort to talk to people (you may feel hurt and rejected at first, but keep it up - "hi" or "how's it going" is a fine way to start a conversation if you're unsure of what to say).
Eventually (yes, sadly eventually is a long time) you'll start meeting people who will hang out with you and enjoy talking to you. From there you can "network" to meet other people whom you can get along with.