Find out What's Going On
Ever wanted to have a place where you could keep your files and access them anywhere you get an Internet connection? Say you wanted to have your music library available in case you wanted to give a song to one of your friends, or maybe you wanted to let your relatives download your entire library of vacation photos, or maybe you need a place to host programs you write or maps you make. How about a Web page? Ever wanted to have your own Web page? All of these can be accomplished with a home Web server...and more!
It's actually really simple to set up a Web server at home. I'm going to use this while I'm away at college to host game servers, have an offsite file backup, and share files with friends. Since the PC hosting the server will be at my house and I will be in my dorm room, obviously I can't just walk over and start changing system settings, so we'll need some kind of remote access.
Also, obviously, you'll need a dedicated PC, one you can leave running and leave connected at all times. What good is a server that goes down all the time? This PC doesn't have to be great, but remember, the more you run on it, the faster the PC needs to be to not lag (duh).
This step may be easy for some and hard for others. I already had a PC that I wasn't really using (it originally was my parents old PC, but then it died and I rebuilt it with cheap parts, but since I already had a PC I didn't really use it much).
AMD Sempron 64 2600+ (overclocked to 1.85 GHz)
1.5GB DDR RAM
nVidia GeForce4 MX420 64MB (GPU really not important, servers don't need good video cards, even integrated is plenty)
60GB hard drive (IDE) (not that good for a server, but good enough, I didn't want to spend any money on this)
DVD and CD drive (you'll need at least a CD drive to install the OS, other than that, not necessary)
3 Ethernet cards (you'll need at least 1)
This system performs very well as a server, so anything over this would perform even better. This PC cost about $100 to rebuild (already had RAM, case, optical drives, and hard drive though) and that was late 2007 that I rebuilt it.
For my server, I'm using Ubuntu Linux 8.04. Linux is a great server OS and is one of the major OS'es behind professional Web servers (like Google, if I remember right, Google uses Linux servers). However, Linux can be confusing for new users, so I'm going to use the desktop version instead of the server version. The desktop version has a graphical user interface (GUI) so you won't have to configure your server using all terminal commands. Just because it isn't the "server edition" doesn't mean it can't run a great server, though!
If you have a 64 bit PC, you'll want the 64 bit version of Linux. These are 64 bit chipsets:
-AMD Athlon64 X2
-AMD Turion64 X2
-AMD Sempron64 (not officially marked Sempron64, but will have the AMD 64 logo on the packaging)
-Intel Core 2
-Intel Core 2 Duo
-Intel Core 2 Quad
If you have a 32 bit PC, you can't use the 64 bit edition, so get the 32 bit (x86) version. These are common 32 bit CPU's:
-Intel Pentium 1/2/3/4/M/D
-Intel Celeron (some new ones may be 64 bit compatible though)
Download Ubuntu at www.ubuntu.com
I recommend using BitTorrent to download.
After you get the ISO image of whatever version you're going to use, burn the .iso file to a blank CD using your CD burning program of choice.
Put the CD in your PC and turn it on. With any luck, it will come up to the Ubuntu CD screen. Pick your language and then select the first option on the menu (not Install, I think it's Test or LiveCD or something like that). It will proceed to load and you'll soon see Ubuntu's Desktop.
Now, if you want to dual boot (have both Windows and Linux on the same PC), go to System->Administration->Partition Editor. You can use this to resize your Windows (FAT32 or NTFS) partition and leave some empty space to install Linux on. After resizing and applying, or if you're just going to install Linux on its own, double click the "Install" icon on your Desktop. Follow through the guided setup, selecting "Use largest continuous free space" as the location to install to.
After it's done installing, reboot your PC. You should get GRUB (the bootloader, a black screen with a menu listing all the installed operating systems on your PC). Pick Ubuntu from the list and hit Enter.
After it boots up, login using the name and password you entered during the install process. You should now see the Ubuntu Desktop. Now you're ready to serve!
Well, now that you have your operating system installed, you'll want to enable some sort of remote access. With remote access, you'll be able to connect to your server using another PC and see the server's screen. You'll also be able to use the mouse and keyboard on the remote PC to control the server's own mouse and keyboard, meaning you can use the server from anywhere on the Internet.
To set up remote desktop access, go to System->Preferences->Remote Desktop. Check these:
"Allow other users to view your desktop"
"Allow other users to control your desktop"
"Require the user to enter this password:"
Then type a password in the Password field. There's a character limit on it, so your password must be fairly short. This password will need to be entered on the remote PC before you will see the server's Desktop.
Now you can access your PC from another PC, but I'll get to how to use this feature later. First, let's finish the basic setup of our server.
FTP (File Transfer Protocol) is a system used to upload and download files to and from a server. Basically, it's like having a folder on the Internet, you can have multiple folders that you copy files to. You can even use Windows Explorer to access your online folder and drag your files to it to upload them. Then you can give your friends an account and they can upload and download too, eliminating the need to cram files into emails.
For this, I'm going to use Pro FTP Daemon (proftpd), a Linux program that runs a FTP server on your computer. I'm also going to use gproftpd, a graphical frontend (GUI) that allows you to set up proftpd without having to edit text files or use terminal codes. I know this may sound confusing, but in reality it is very easy.
Start off by opening a terminal (Applications->Accessories->Terminal). There are other ways to install programs (if you absolutely can't stand terminal), but personally I think it's faster just to use terminal if you know what you're looking for.
Once it's open, type:
sudo apt-get install proftpd
and hit ENTER. It will say "password:", enter your password (the one you setup during installation) and then press ENTER again. It won't put asterisks or dots as you type your password, so don't worry if you don't see any indication that you've typed your password.
Then it will run through a bunch of stuff, possibly asking you to press Y or N (Yes or No) to the install, obviously press Y.
Then after it's done with that (will be back to the @ line), type:
sudo apt-get install gproftpd
and hit ENTER. It shouldn't ask you for your password this time since you've already entered it, but should it ask, just repeat the above.
Once that command is done, you're ready to configure.
Now for the fun part. Go to System -> Administration -> GPROFTPD and enter your password if it asks for it. You should be faced with the GPROFTPD window. Your server probably won't be activated, nor will it be set up, so we must go through and configure it first.
First, go to the Users tab. This is where you'll create an account for yourself. It's fairly self-explanatory, but here's the information you need to fill in:
Username: just put in whatever you want your username to be on your server. You'll use this to login. It can't have capital letters or non-standard characters, just lowercase letters and numbers.
Password: self explanatory, again, lowercase letters and numbers. Note that it won't mask your password, so if you're entering a private password, don't let your friends see your screen!
Group: Not too sure about this, just enter a group name. I'd put "administrators" because you're an admin, then for friends put "users" (unless they're really special and you want to classify them as administrators too :P ) Again, lowercase letters and numbers only.
Comment: Put who the account really is ("me" works for yourself, or put your friends' real names here). Again, lowercase letters and numbers only.
Shell: just leave it as it is, /dev/null. I don't know what it's for, but it works fine if you leave it at that.
Check both "Require password" and "Show user in statistics" (if you want a hidden user, uncheck "Show user in statistics")
Maximum logins: Set how many simultaneous connections the user is allowed to open. For you, I'd set it higher, for other people, set it lower. Chances are, you'll be the one uploading most of the files, so that's why you get more connections.
Allow logins from: all, just leave it at that.
For the bottom part, put the user's home directory. For mine, I put /home/adam/ftp. Since I wanted to access my home directory from my account (/home/adam), I put everyone else's account set to a subdirectory of my home (/home/adam/ftp). That way the FTP directory is within my user account's home, and my FTP account can access the FTP home as well as my personal home directory. I recommend using /home// for YOUR home directory, with all permissions checked, and /home//ftp for your friends (check permissions as you see fit). Permissions are self-explanatory, to allow a user to perform a certain action on a file or folder, check the box.
After you set up your user, click the "Add" button to add the user to the list. Repeat this step for as many users as you want.
Now is the fun part. You actually get to put your FTP server out there on your network, and it will eventually be on the Internet.
Go back to the first tab, the "Servers" tab. It is pretty much set up already, but here are some options you may want to change.
The servers IP-address or hostname: I'd recommend leaving this at 0.0.0.0, that means it will automatically detect its location and configure itself accordingly
Alternative server identity: You can use this to give your server a name. It's optional, and if you want to give it a name, change the box to "On"
Configure NAT routing: Set this to your router's IP, but it doesn't seem necessary, it works without turning it on, so no big deal, just leave it off and only use it if you have problems
The administrators email address: You are the administrator, put your e-mail here.
Use identity/reverse lookups: No clue what these do, but Off/Off works fine
Time standard: Keep it at Local, chances are the people using your FTP know what time zone you live in.
Port: Leave this at 21, that's the standard FTP port. Should you desire to change it, and know what you're doing, go ahead, but if you don't know what this is, leave it at 21.
Passive port range: I don't know, leave at default and you should be fine
Maximum Connections: This is how many total (from all users) connections your server will allow. Default is fine here.
Maximum login tries: I guess this is for bad password tries. I prefer to set this higher, because I know people can mess up their password. Just because you mess up your password doesn't mean you're a hacker, so I allow 40 tries on my server.
Upload speed: Set this higher than the maximum network speed connected to the server, it will ensure that your server doesn't slow down unnecessarily. If you're using both LAN and Internet to transfer, set this over 1000, because LAN can transfer much faster and LAN transfers will be slowed down for no reason. Internet will simply not reach the maximum speed, but that's obvious.
Download speed: Same as above, I set it high (1000) to prevent slow LAN transfers.
Automatically remove aborted uploads: I turn this ON. That way, if someone cancels an upload, you won't get half a file on your server (half a file is pretty useless and it wastes space).
OK! Now you've configured. Click "Apply" to apply the settings changes. Now for the big one, click the "Activate" button and your server's status will change to "Activated". That means you're now ONLINE! (well, not really, your server is up but only on your LAN, more on this later).
Thought FTP was a bit hard (or at least long?), no need to fear. Setting up HTTP support is downright simple.
Type this in Terminal:
sudo apt-get install apache2
and hit Enter, typing your password if necessary, and hitting Y if necessary.
Now, sit back and relax, HTTP server is up and running!
(by the way, your web page's home directory is /var/www, you put your html files there)
I'm not going into a lot of detail on this one, as all games are different, and everyone plays different games. However, if you want to, you can use your new server to run a video game server.
PROBLEM! Most video games are written for WINDOWS...but our server isn't running that :(
The answer? Wine. Wine is a program that lets you run Windows programs in Linux. 3d support isn't perfect, so the games themselves often have glitches or graphics issues, but dedicated server programs for those games usually work flawlessly.
Again, use Terminal to install Wine with the easy command:
sudo apt-get install wine
By now you should know how to use this.
After Wine installs, you'll have a folder /home//.wine/drive_c/ (you have to click Show Hidden Files in the file browser to see .wine, because anything with a period in front is considered hidden in Linux). This is the equivalent of your Windows C: drive. Any programs that you'd have in your C: drive go in this folder, as Wine sees this folder as your virtual C: drive.
In my case,
/home/adam/.wine/drive_c/gmodserver/orangebox/srcds.exe is the location of the program I need.
You can make a launcher on your Desktop to start your server (assuming Source Dedicated Server here).
Type - Application
Name - Garry's Mod Server
Command - wine C:/gmodserver/orangebox/srcds.exe -game garrysmod
Comment - Start a Garry's Mod Server
Now you should get a nice icon on your Desktop, you can use this to run your server. Have fun gaming :)
What? Forward ports? What's that?
Port Forwarding is an option available in almost all home routers. Because your server PC is likely behind a router (your home network is a Local Area Network [LAN] with a router connecting it to the Internet), your PC's IP address (the number that other PC's use to talk to the server PC) only works within your local network (all the PC's connected to your router). In order for the outside world (Internet) to talk directly to your server, your router needs to let the two communicate. Normally, the outside world (Internet) would talk to your router, and your router would relay that message to your PC. This works great for browsing, but not for serving.
To open this communication channel, we need to look at ports. Ports are "channels" that different programs use to talk on. Some common ports:
21 - FTP
80 - HTTP
5900 - VNC
29070 - Jedi Academy (used to host a JKA server)
There's tons more (like 65 thousand of them lol) but that's not the point. The point is, you need the port on your Internet IP address to be connected directly to the port on your server's local IP address.
To do this, open your router's settings page (you'll need to know the admin username and password for it). The router's page is usually at http://192.168.1.1 , though some can be at http://192.168.0.1 , http://192.168.2.1 , or other addresses. If you can't connect, consult your router's instruction manual or Google search it.
Once in, you need to find Port Forwarding. My Netgear has it right on the side column, not sure about other brands. From here you can go to work. You'll need to know the local IP of the server PC (you can find this by right clicking on the networking icon at the top-right corner of the screen, the icon with two PC's, and selecting Connection Information, it's the "IP Address" field).
Now, add the following setups:
(format: "name" - TCP/UDP - start port - end port - 192.168.x.x (replace with that of your server))
"VNC" - TCP - 5800 - 5900 - 192.168.x.x
"FTP" - TCP/UDP - 21 - 21 - 192.168.x.x
"HTTP" - TCP - 80 - 80 - 192.168.x.x
"Gmod" - TCP/UDP - 27015 - 27015 - 192.168.x.x (replace with the settings for your game obviously)
Once you apply this, you should really be ONLINE.
Ok, so you have a server. Do you really think all your friends are going to be so eager to sign on to http://75.185.355.1337 (obviously not a real IP, but most of your friends won't know that) to get the latest? NO! Remembering your long, boring, ever-changing IP is hard even for those who understand it. This is the Internet, yet you're telling them something resembling a long phone number.
You need a domain! A domain name is a mask for your IP address. Just like any other site, Google's servers have an IP address. However, you don't know their IP address, all you know is www.google.com. So, how come you can connect to them without knowing their IP? Because, the domain www.google.com links to Google's server's IP address and sends requests to it.
The problem with domain names is that they cost money to register. However, if you're willing to sacrifice, you can get free domains at www.no-ip.com. The downside is that your domain will be <yoursite>.servegame.com or something similar. They have a bunch of domains you can choose to be at (servegame, servehttp, serveftp just to name a few) but you can't get your completely customized domain. (For example, I can get [and have already gotten] http://calc.servegame.com , but not http://calcprogrammer1.com [which would cost money to register])
Other than the name thing, no-ip domains are great. Free ones only last 60 days, but when it's about to expire they send you an e-mail that you can extend your use of the domain for free.
You'll need to know your Internet IP address, which can be found simply by googling "What is my IP" (you'll get a ton of sites that will tell you your IP). Use your Internet IP in your no-ip setup.
Now comes the fun part. Everything should be set up and ready to go, all you have to do is test.
Start out by testing http, since that's the easiest. Simply open your browser and type "http://<your no-ip domain>.com" and hit Enter. With any luck, "It Works!" should appear (the test message from apache2, you can change the file in /var/www after you know it does indeed work). If it doesn't, try "http://<your Internet IP> [no www. or .com, just the IP number]". This SHOULD work, if it doesn't, your port forwarding isn't working. If neither of those work, as a last resort, try http://<your LOCAL IP> (again, no www. or .com, just number). This SHOULD work, if THIS doesn't work, it means your server isn't working.
Then test FTP. Open up Windows Explorer and type "ftp://<your no-ip domain>.com". You should be prompted for username and password, type your FTP username and password and you should see all your folders. Try uploading a file. It should work, if it doesn't accept the file, go play around with GPROFTPD's user page. Again, if it doesn't work, try the above URL's except with ftp://
Next, test VNC. You'll need a VNC viewer. TightVNC and UltraVNC both are great VNC Viewers for Windows. For the VNC address, simply put your no-ip domain and .com (for example, calc.servegame.com, no http://, no www., and no ftp://). You should be prompted for password. Put whatever password you entered for VNC. If all goes well, you'll see your server's screen on your Windows PC's screen.
Last, test games. If you're hosting a game server, log on and see if you can join.
If all goes well, you now have a server! Now go learn how to make a web page, upload some files to share, and go play some games! Having your own server can be a great help in college or anywhere else they limit Internet connections (namely P2P) because you can run P2P applications on your server at home and then download the finished downloads via FTP or HTTP. Have fun!