Loneliness was my huge stumbling block as well. It hurts a lot, and those who haven't experienced acute loneliness don't know what it is like. What is really hard is because of social anxieties, people think you're anti-social and that your loneliness of your own design, but it isn't. The fact is that guys like you and me want the social interaction more than anyone else, but we have a hard time doing it.
You can do this. I know it doesn't feel like you can right now, and it is okay to feel like that. Relapses give us that feeling, but remember that small successes count, too. For a long time, I could only go a week at a time. Sundays were hard. The work week had enough distractions and routine that I eventually figured out how to quit for a whole week. But Sundays... extra time alone when I wish I had loved ones to spend it with, and going out and about and seeing families/couples together depressed me so much. I went for close to year of only occasionally making it through Sundays, but being okay any other day.
For social contact, small things can be really helpful. As someone else said, a simple part time job can get those muscles moving, even if the job isn't all that pleasant. Volunteer opportunities are the same. I help a shut-in lady in a neighboring apartment complex, and it forces me out at times when I might otherwise wallow. No, she isn't my dream girl, and I rarely can talk to her in any real open way, but she is good company and keeps me open to interaction. What will work for you will be particular to you, too. Yeah, I'm sure you've heard all the "find some friends, go on some websites, blah blah blah" advice... I didn't like hearing it either, because it felt like people were saying to me "I don't have time for you, find someone who does", but that isn't where I'm coming from. I'm just saying that small things help, and sometimes it is just that little edge you need to get your sea legs back.
It sounds like you're pretty far sighted. You talk about your studies, and wishing for a better life for you and your friends. Maybe gives some thought to what kind of man you'd like to be. Then, figure out which things are in your control. I find this to be a good exercise. Think along the lines of Aristotelian virtue ethics, and since it is typically related to matters of the soul, it is all stuff that can be worked on in the privacy of your own inner space. As you see progress in yourself on these things, your confidence and will power will build.
For social anxiety/loneliness the ABSOLUTE WORST thing you can do for yourself is be on social media. Looking at people's pages showing their families, good times (frankly making them look better than they seem), and progress in life. It makes you think everyone else has great lives, and yours is terrible. The fact is that this generation is having a VERY hard time socially and economically, and you are FAR from alone... those people just don't brag about it on Facebook, so they remain invisible, and you only see the ones who are happy, or are good at pretending to be happy. I don't think it is any coincidence that we are in the midst of a loneliness epidemic, and social media is wildly popular. It also is absolute poison for the soul to stir up jealousy. Trust me, going to those sites is like stabbing a wound over and over again. Get a bandage on it and let it heal. I also had to give up dating websites, because they had a similar effect on me and my depression, though it may not be the same for you. I'm sure they're a good option for some, but the constant clicking was too much like porn, and the constant not finding anyone aggravated my loneliness all the more.
You can do this. When we're rebooting, we have challenges that are physical, habitual, physiological and so on, but it seems like it is the emotional challenges that have the deepest claws. If you're hung up on it, it doesn't mean you've hit a wall. It probably means you've figured out how to cope with all the other stuff, and you're at the final challenge. You've beaten the mini-bosses, and now it is the final boss. Lately I've found great value in stopping my anxiety as soon as I realize it is kicking in. I can then ask myself "why am I nervous right now? What am I scared of?" and I realize that my anxieties are based on lies. Lies hate light. Remember that.