Software in context

Tags


How to Set Up a Home Server with an Intel NUC

19th November 2014

Intel NUC Haswell

Servers are the computers you never see, but use the most. The act of loading the average webpage on your laptop involves calls to hundreds of servers, like ad servers, web servers, and content delivery network servers. The "cloud" is a nebulous mass of servers that invisibly process and store information. The Internet itself is based on a global backbone of DNS servers. Servers may be a foreign concept, but the only consequential difference between a server computer and a desktop PC is that the former is especially set up to process—or service—network requests.

In early 2014 I put together a home server, and it's turned out to be one of the best things I've ever done for my tech-self. I've been assembling and fixing computers since I was 15 for fun and profit. But setting up a publicly accessible, secure, always-on machine to do my bidding has been challenging, educational, and intensely rewarding.

Here are some things I've done with my first machine:

  1. Serve personal websites
  2. Aggregate news feeds into a database
  3. Logged in remotely via SSH and VPN
  4. Run Docker containers
  5. Run a Continous Deployment tool
  6. Run a personal cloud with SFTP
  7. Run poorly implemented number crunchers overnight

I'm having so much fun that I now need more servers if I'm to keep doing more cool computer stuff at home. What follows is a brief tutorial on how assemble and connect a home server, using my tiny computer of choice, an Intel NUC:

1. Components

NUC Components

  1. Intel NUC — (Pictured at top.) The latest version of the Intel "Next Unit of Computing" uses the acclaimed Haswell microarchitecture, which boasts significant gains in performance and energy consumption over its Ivy Bridge predecessor. This NUC is small, very quiet, and has nifty features like an IR sensor, several USB 3.0 ports, and VESA mount compatibility. To learn more, check out this Ars Technica discussion. I ordered the barebones version without a hard drive or RAM.
  2. Crucial 8GB Memory — Be sure to get SODIMM ("notebook"-sized memory), and 1.35V voltage. I've had the misfortune of purchasing non-1.35V memory for a NUC before, resulting in a computer that fails to power on, and a long time spent debugging. You'll know there's something wrong with the memory if the NUC's blue LED flashes three times repeatedly.
  3. Kingston 60GB mSATA SSD — SSDs are so small these days! Make sure to get mSATA.
  4. Intel WiFi Card — This one is optional. The NUC has two internal mSATA ports, but one will only fit a smaller chip like this Intel card. An ethernet cord will suffice for networking, but in case I ever want to huose this NUC further from my router, it'll support Wireless AC + Bluetooth.
  5. Mini DisplayPort Cable — DisplayPort is becoming more common for HD display connections. The NUC also has a mini HDMI port, but I already had a DisplayPort to Mini DisplayPort cable I use for my MacBook.
  6. Power Cord — If you order a NUC from Amazon, be sure the select the "With Powercord" version, otherwise you'll have a complete setup without power.
  7. Keyboard, Ethernet cable, display…

NUC Peripherals

Mini DisplayPort Cable

2. Assembly

Assembling a NUC is very simple. To operate, flip it over and unscrew the four corner screws holding the bottom cover in place. This will expose all the external port housings and the internal slots for custom components. The CPU and fan will remain hidden on the other side of the motherboard.

Intel NUC Haswell opened

2.1 Install WiFi Card

The two mSATA ports are stacked, and visible as vertical barcodes at the bottom of the following image. The half-sized mSATA device, in our case the wireless card, will have to go in the lower slot, as the SSD won't fit there. When an mSATA device is inserted into its slot in the NUC, it will rest at an angle, as it's being pushed up by a spring for easy removal. There should be already be a small Phillips screw in the housing that can be removed and used to secure the card.

NUC WiFi Card Installed

2.2 Install SSD Card

Once the lower mSATA device is at home, the upper one can be installed in similar fashion. The NUC should have provided a screw for this device as well. When all is done the upper device should completely hide what's underneath.

2.3 Install Memory

The SODIMM modules will overlap, so the lower one should be inserted first. They'll have to be pushed down until the housing clicks into place. To remove them, pull the plastic side brackets apart until the module pops up.

Below, all the components have been installed. The WiFi card is completely hidden by the SSD:

NUC Memory and SSD Installed

2.4 Clean Up

It's safe to leave the cover off while you plug everything in and power up the device, just until you know that there isn't an immediate problem with the hardware. When it comes time to screw the cover back in, the soft pad on the inside of the cover is meant to sit against the upper mSATA device. I'm not sure if this pad is a heat sink, or just a cushion to protect the component.

3. OS Intallation

My operating system of choice for a home server is the latest version of Ubuntu Server, which is 14.04/Trusty at the time of writing.

3.1 Update the BIOS

You may have to update the BIOS—a computer's basic pre-installed operating system—before installing a proper OS. Intel's website recommends doing this only if necessary:

Update the BIOS on your computer only if the newer BIOS version specifically solves a problem you have. We do not recommend BIOS updates for computers that do not need it.

An example of such a problem is incompatibily with certain components in an older BIOS version. I upgraded the BIOS the first time I put a NUC together so that I could install an operating system from a USB 3.0 flash drive, and I followed the F7 Flash Update Method.

3.2 Create a Bootable USB Flash Drive

This is my method of choice for installing an OS. Bootable USB Flash drives are portable and fairly easy to create.

I followed this Ubuntu tutorial. Be sure to use rdisk instead of disk when copying the OS image to the drive, as the copy will proceed much faster. A discussion of this phenomenon is available on superuser.com.

Once the drive is created, simply plug it into the NUC and power up the system. Depending on the version of the BIOS you may have to explicitly enable booting from USB. When successful, you'll see the Ubuntu boot menu:

NUC Ubuntu Boot Screen

3.3 Install the Operating System

Follow the instructions on screen, and the installation should go off without a hitch. If you've installed an earlier version of Ubuntu, you can upgrade from the command line:

$ sudo apt-get install update-manager-core
...
$ do-release-upgrade

4. Configure SSH

Once everything is set up, I run my home server "headlessly", meaning I don't keep a display, keyboard, or mouse connected to it. Like a real-world server, it's doing computational things behind the scenes, and when I need to interact directly with it, I do so over the network via SSH. To install and run the SSH server type:

$ sudo apt-get install openssh-server
...
$ service ssh start

Before we can log in, we'll need the IP address of the new machine. To find it, type ifconfig in the terminal and look for the value after inet address in the em1 section. This IP address should follow the form 192.168.x.x, a scheme used for local networks. We'll pretend the value is 192.168.1.25.

4.1 Log in Internally

With the external IP address, we can log in to the server from another computer on the network:

$ ssh [email protected]

We can use a hosts file entry to map this address to a more attractive name, perhaps the hostname given to the server when we installed the operating system. It may also help to configure our router to assign a consistent IP address to the machine based on its MAC address.

4.2 Log in Externally

Chances are you'd like to access the server from the outside world, and the easiest way to do this is to expose the SSH server outside of your private network. The internal IP we've been working with isn't visible outside of the home network. What is visible is the public IP assigned to your modem/router by your ISP. You should be able to find this address from the router control panel.

SSH uses TCP port 22 by default. Most routers allow port fowarding, whereby a TCP connection request to the external IP and port can be forwarded to an internal IP and port. In this case we'll forward port 22 of the external IP to port 22 of the internal IP of our web server. Now you should be able to SSH into the web server from outside of the local network, using the external IP address.


Setting up a home web server for public access can be tricky, especially when it comes to dynamic IP addresses and network security. In a future post I'll cover the networking aspects of my home setup—including private VPN, dynamic DNS, and NAT loopback.

Caleb Sotelo
AUTHOR

Caleb Sotelo

I'm a Software Engineer and Director of OpenX Labs. I try to write about software in a way that helps people truly understand it. Follow me @calebds.

View Comments