What is a Virtual Private Server, you ask? Basically, you can think of it as your own personal Lab46.
Why a Virtual Private Server, you ask? Because there are so many things you can do with it.
Lets face it. Lab46 is awesome. Having a centralized place to work on stuff, store things, and etc. is incredible. But, what if you wanted to go a step further? That's where a Virtual Private Server (VPS) comes in. Imagine it as your own personal Lab46, which you have complete control over. This project/guide is all about how to get a VPS, configure it, and work with it to exploit the awesomeness that it truly is!
Since I don't have the world's best internet connection at home, I've always been limited to what I can do. My internet is decent enough to handle most client sided things, but, when it comes to server related things, a .3 megabit/s upload rate just doesn't quite cut it. That's one of the main reasons why I decided to start looking into VPS's. I at first basically planned on using it in all the same ways I use Lab46, until I started reading all the wonderful extra things I could use it for. I can use it to stream my own media to wherever I am, use it to host game servers, voice chat servers, websites, and so many other things. And that just furthered my interest in it. So for this project, I'm going to be talking all about how to set up a VPS, from start to finish.
For this project, I plan to have a fully functional server set up which I can use for a multitude of things. The two main uses for the server will be for me to do my programming on, and to use as a web and FTP server for myself. It will also be able to be used for many other things, such as hosting voice chat or a Minecraft server.
The first (and probably most important step) is deciding on a host for your server. If you have a speedy internet connection, you could easily make your own server computer and host it yourself. And if so, great! Unfortunately though, since I don't, this project will focus on dedicated server hosting.
There are many choices when it comes to server hosting, from big names to little names. Some big name companies that offer VPS hosting (or equivalent) are Google (Google Compute Engine), Amazon (EC2 servers), and GoDaddy. There are many others out there, however. Some companies charge a flat monthly rate, some charge a rate per usage hour, and others still offer a combination of the two.
For my purposes and price range, I decided to go with Linode as my VPS host. Their prices are great, they have a four hour free trial (which is awesome to try it out and get an idea of what you're getting into), and in my experience so far, they've been very stable and speedy.
Once you've decided on a server host, then you need to decide on a server plan. Linode offers quite a few server plans, ranging from low end (512 MB of RAM, 24 GB of storage, and a 2 TB monthly transfer, for $19.95 per month) all the way up to very high end (20 GB of RAM, 960 GB of storage, and 20 TB month transfer rate, for a low, low $799.95 per month). I decided to start out with the low end 512 MB plan. Now, if you know anything about computers (which if you're reading this, I certainly hope you do), 512 MB might not seem like a lot. But when you're running a server, you don't use that much RAM, because you don't have memory hogs bogging it down (when idling and running htop, my server runs around 93 MB of memory). And the plus side is, you can always upgrade to a higher plan if need be later.
After you get a server, the next step is the initial configuration. The first part will vary a little by server host. With Linode, I was asked to create a root password, specify the partition size I wanted to use, and then select a Linux distribution for my server. For my server, I'm using Ubuntu 12.10 64 bit. If you choose a distro besides Debian or Ubuntu, some of things may vary from what I've written here.
After then was taken to my dashboard. From the dashboard, I could do the main things that needed to be done. My server could be started/stopped/rebooted, rebuilt, resized, cloned, backed up, and I could check the server's IP address.
Once you have your server's IP address, open up your SSH client of choice (I use the Secure Shell Google Chrome addon for Windows, and any old terminal for Linux) and connect to the server.
The first thing you might notice is that you have a very ugly hostname. This is a pretty easy fix though. The hostname is stored in the file “/etc/hostname”. You can either edit this file in your editor of choice, or simply echo your chosen host name to it.
You will also need to edit the “/etc/hosts” file and replace the name on the line starting with 127.0.1.1 with the hostname you chose.
Once you've edited the /etc/hostname file, restart your server, and you should be greeted with your new prompt with the hostname you chose.
The next step is creating a user, since you don't want to be logging in as root all the time! To do this, you can use the very handy “adduser” command, which creates the user, their home directory, and prompts you for their information.
If this user is going to be given access to the sudo command (which if it's your username, it should be), you will next need to set that up. This can be done with the “visudo” command. Running visudo will open up the /etc/sudoers file to be edited. You need to copy the line that begins with root, and replace it with your username. Then, save the file (be sure it saves as “sudoers”).
Now, you can disconnect from your server and reconnect using your own username, which you'll use to connect normally.
To check to make sure you set up sudo correctly, do a quick command with sudo to make sure it works.
Congratulations! You've completed the initial set up of your server! Now it's time to expand out and make it work exactly how YOU want it to work!
In performing this project, the following resources were referenced:
Generally, state where you got informative and useful information to help you accomplish this project when you originally worked on it (from Google, other wiki documents on the Lab46 wiki, etc.)