Many individuals and businesses rely on hosting companies to keep their website and files stored and accessible. This is often a very easy and cost-effective way keep your files and webpage online, all of the time. For those of us who don’t want to pay more for a dedicated host or want to simply skip the middle man and do self-hosting, you’ll need to build your own server to house those files and allow others to connect to them. If that’s your goal, then this guide is going to help you do that.
Setting up your own web server may appear to be a daunting task, but with a little know-how, it’s something that almost anyone can accomplish. Here’s what you’ll need to have/do:
- Obtain a Dedicated Machine
- Set up the Operating System
- Configure the OS for Web Hosting
- Set Up Your Self-Hosted Domain (optional)
- Install Monitoring Tools (optional)
Step 1: Decide What Kind of Server You Need
Depending on what you are planning on using your server for, you may be able to run it on a pretty average machine. For hosting personal files for yourself and family members, and even for self-hosting a personal blog or website, you should be fine using a computer with similar (and sometimes far worse) specs to my budget machine model.
If you are a business that wants to do self-hosting, or you need something that can run 24/7 with 99.9% uptime, for example: for hosting internal/external files for clients or employees. Or if you are a die-hard gamer who wants to host all of your friends and other interested gamers, you will want to get a better, more stable machine to run your server, but for this guide, we will assume that you either already have a machine to use, or you will be using something similar to the one provided below:
Budget Server Build: $776.92 + Shipping
- CPU - Intel Xeon E3-1220 $199.99
- 3.1 GHz Quad-Core
- 8 MB L3 Cache
- LGA1150 Socket
- LGA1150 Processor Socket
- Intel Z97 Express Bridge
- ATX Form Factor
- 3200 MHz unbuffered
- DDR3 Supported Memory (4 slots, up to 32 GB)
- ECC - Crucial Server Memory Module (8 GB) $109.99
- 1600 MHz
- 1333 MHz PC3-10600
- 7200 RPM
- 64 MB cache
- SATA III 6 Gbit/s
- 3.5” Internal
Step 2: Assemble the Server
- Make sure that your body is grounded so that static buildup doesn’t affect the computer parts. This is easily done by wearing rubber-soled shoes or standing on something other than carpet.
- Open the boxes that your parts came in and lay out the components on a hard surface.
- We’ll start with the motherboard. This is the skeleton of the computer that connects all of the other components. Open the latch on the processor socket, match up the pins, and insert the processor. Close the latch, and install the heat-sink/processor fan over the processor. This should hook straight into the motherboard.
- Open the memory (RAM) slots and insert the memory, pushing down until the latches click into place around the memory.
- Put the computer case on its side and install the power supply if it is not already securely fastened to the case.
- Insert the motherboard into the case. Screw it in place by the corners and then make sure to get the extra screw or two on the middle of the motherboard.
- Insert the optical (DVD) drive into the case as well as the internal hard drive. The optical drive is pretty intuitive if you’ve used a computer before, the hard drive goes in the slot below the optical drive spaces. Make sure to secure these with at least two screws each so they won’t slip around in the case.
- Connect the cables from the optical drive and hard drive to the motherboard. Refer to the motherboard manual if necessary.
- Secure the large power cable from the power supply unit to the motherboard as well as the small power cord from the processor heat-sink/fan. This one is a bit tedious as it is so small, but you should be able to do it!
- Once everything is connected, make sure to double check each part before firing up the machine.
- Close the case, but don’t screw it shut just yet just in case, and connect your new server to a power outlet. Also make sure to plug in your monitor, keyboard, and mouse - simple, I know, but it’s been forgotten before.
- It’s time to boot up!
Step 3: Install the Operating System
- Insert the operating system disc that you chose. For the purposes of this guide, we’ll be going with Ubuntu.
- Press a key when the message “Press any key to boot from the DVD” appears on the screen. If you are using a fresh hard drive, it should automatically load the default menu.
- Choose your language and then select “Basic Server Install” or “Install Ubuntu Server.”
- After the files load and unpack, you’ll be prompted to “Configure the Network”. Name your server whatever you want.
- You will then be prompted to set up a username and password. Write these down.
- When prompted to encrypt your home directory or not, I’d go with no for now. This makes it easier to recover files, if necessary.
- The installation will them ask you to partition your disks. This is just setting up your hard drive. I’d go with the “Guided - use entire disk and set up LVM” option. Write the changes to disks.
- You won’t need to configure a proxy, so just leave it blank and click continue.
- When prompted to turn on updates, choose “Install security updates automatically.”
- Under software selection, choose manual package selection.
- Choose yes to install grub to the Master Boot Record.
- Finish the installation.
Some additional items after the reboot:
- You may want to setup the “Firewall” package to protect the server. After doing this, activate SELinux.
- Make sure that Apache, PHP, and MySQL are installed. If you feel like installing Perl & Python, that may be helpful as well.
Step 4: Additional Server Setup
The server is now built and ready to be setup for your own personal hosting. To do this, you’ll need a few more steps. This will be different for everyone, but I’ll try to guide you through a few things:
- Setup a Static IP
- By setting up a static IP your server will stay at the same address instead of receiving a new IP address every so often. To do this, follow this guide.
- Load the files onto your computer and setup the database. If you are looking to host a website, you’ll need to setup the database in MySQL and load the files on your server.
- Point your domain to your server
- Now that you have the files loaded on your server, make sure to go into the cPanel provided by your domain registrar and point the domain name to your server. You will need to know your DNS servers and potentially your static IP.
Now that your server is mostly set up, and should be accessible outside of your network, it’s time to install a few tools to help you monitor your server. Many of these tools cost money, but there are a few websites that offer either trial versions or totally free options. Solarwinds provides a great, free Network Analyzer & Bandwidth Monitoring bundle. They also offer a ton of other tools that may be helpful. SQLManager also offers a few free, limited versions of their database management software.