I never went to Uni, but I did recently move away from Leicester/mates/family etc to work elsewhere. So I can kind of empathise with the lonely feeling at times. The key to it is to keep yourself busy. Particularly at uni where you are still young and most likely studying with other like minded people so (in theory) it might be easier to meet them.
Whatever you do, DON'T make your lectures be the only time you leave your room. Find a hobby, play a sport, invite your course-mates round for a drink/food, read a load of books, find a bird etc... Find something to occupy your mind with to allow it to be distracted from the course and relax. Even if it involves learning a new skill like a language or something.
For me, living alone in a new town was/is difficult (I've been here 4 months). I'm lucky in that I work in a customer facing job so meet a lot of people through work but my other method is to walk into the pub, chuck a pound on the pool table and offer to play the winner. Instant conversation and the night is sorted. You have to pick your audience as you don't want to be playing the local thugs/pissheads. I'm not saying is 100% successful, or that the same would work for you but I can now go to the boozer and I know the regulars and can have a chat etc
By the way I'm no expert on this, that's just what I do.