Abstract

We have talked about Linux on a desktop machine, but one of the real strengths of Linux is it’s use as a server. Servers often run headless (without a monitor, keyboard, and mouse) tucked away in a closet. Due to the stability of Linux and scheduling capabilities they make good servers.

For today lets explore what you can do with a server to enhance your home. I will assume you are running Windows on your laptop or desktop machines, although Linux has some special advantages working with a Linux server.

Where to Start

OK, you decided that you want to setup a Linux server. Now you need to decide what type of hardware and software to use.

This is easier than you think. An inexpensive desktop machine will serve just fine as a server. You should probably go for a desktop box since you might want to add additional hard disks to the box in the future. Additionally, you do not need a fancy graphics card, but you might want a little more memory. Remember that the plan is for this computer to end up in a closet where you are not working on it directly.

As far as software goes, you can choose something line Ubuntu Server LTS which is easy to install and maintain. Or you can choose something like Centos which is designed for Server use directly. Either will work for what you want to do. The biggest difference will be in keeping the system up to date.

Installing Software

Since I don’t believe in duplicating instructions, I am not going to describe how to install the Ubuntu Server. Instead I am just going to point you to Installing Ubuntu Server for general use.

Configuration for Headless Operation

To put it simply, there is none.

What I mean is that there is not really any change in the basic configuration of the server to use it headless. But, I think it makes sense to disable starting the Display manager, since it is only for the local user.

How to disable X-Windows

In the past you used to change the run level to turn off the X-Client. But with the new systemd startup you need to enable a different target. Here is a comparison of the old to the new.

   Mapping between runlevels and systemd targets
   ┌─────────┬───────────────────┐
   │Runlevel │ Target            │
   ├─────────┼───────────────────┤
   │0        │ poweroff.target   │
   ├─────────┼───────────────────┤
   │1        │ rescue.target     │
   ├─────────┼───────────────────┤
   │2, 3, 4  │ multi-user.target │
   ├─────────┼───────────────────┤
   │5        │ graphical.target  │
   ├─────────┼───────────────────┤
   │6        │ reboot.target     │
   └─────────┴───────────────────┘

So if you are using Ubuntu 16.04 I would use the following code:

sudo systemctl enable multi-user.target --force
sudo systemctl set-default multi-user.target

This resets the default startup target to command line. This does not mean you can not use Graphical programs, but since you are managing the computer remotely you don’t need the display manager running on the server.

How to find your server

One issue with a headless server, is that you need to know where it is. Later I will show you how to add a name server to your server so you can find it by name. But for now, I recommend you configure the box for a static IP address. There are instructions at Set static IP Ubuntu 16.04.

Be sure to write down the IP address. You will need it when you initially access the box.

Uses for a Home Server

Now that you have you server setup, lets discuss some of things you can use it for. This is by no means a complete list, but just something to consider.

  • Index of Information

I use a web server to store useful information and links to web sites. Yes I can bookmark a web page. But that assumes I remember whet information is on the page. Sometimes I download a useful web page and then upload it to my web site.

  • Media Server

I have a number of CDs and downloaded music that I store on my server. I have pictures that I and my wife have taken over the years. I have a media server that is accessable from any computer. I have a logitech radio which uses it’s own media server to play on a radio. Additionally I have remote audio servers in specific rooms in the house.

  • Power Controller

I have installed a series of X10 boxes around my house to turn lights and appliances on and off. These are programmed to turn on some lights around the house at dusk, and turn them off at about 1:00 AM.

  • Access to other system

I have four other boxes in my home that have web control pages. I have a link to each one so I do not need to remember how to access them.

  • Backup Server

Because I have multiple computers in my house, I use my server as the backup machine. This allows me to backup information from my laptop onto a second machine for safe keeping. I have then taken the step of backing up my server to a cloud backup service. So both my laptop data and my server data is available in case of disaster.

Index of Information

One of the first uses I made of my server is to host information I find useful. I have been playing with computers since about 1980. Which means that I am used to doing lots of typing and configuring. I learned to create web pages with and editor and a tutorial. It is fun but a lot of work, since then I have gotten better tools, but my primary tool is still an editor. I introduce my experience this way because I am going to give you much shorter ways to work with a local web server.

The most straight forward way to setup and maintain a web server is to create a LAMP (Linux, Apache, MySQL, PHP) machine. Using this LAMP machine allows you to install a Local Wiki. If you are not familiar with a Wiki have a look at Wikipedia.

The easiest way to setup the LAMP machine and Media Wiki is to follow their instructions in Manual:Running MediaWiki on Debian or Ubuntu.

Once you have this working you can go to a web browser and put in the address; http:///mediawiki to start using your wiki.

I recommend the wiki because the editing is easier and you can add or configure web pages. Here is a YouTube tutorial to get you started:

You can check out other videos if you want.

Media Server

Over the years I have collected music, legally, from different sources. I have stored the music on my Linux server and I can play it using multiple methods.

Music from the computer to your HiFi

Several years ago I gave a talk Home Network Music Server discussing how I played music from my server. Most of this is still true, but the section How to server music inside the house which used the box Extreamer is no longer available. But there is an even better way using a Raspberry PI and RuneAudio. This system is great because you can have multiple music servers in the house.

You can connect the output to your HiFi system, or to a set of computer speakers, or to a small amp and speakers. This allows you to have a distributed system of music, with only one source of music.

Media on your computer

In addition to using the runeaudio to play music in your house you can listen to music, or view pictures on any computer, even your phone. I use an application known as Universal Media Server

Universal Media Server is a media server capable of serving
videos, audio and images to any DLNA-capable device. 

It is free, regularly updated and has more features than any other
media server, including paid media servers. 

It streams to many devices including Sony PlayStation 3 (PS3) and
PlayStation 4 (PS4), Microsoft Xbox One and 360, many TVs
(Samsung, Panasonic, Sony, Vizio, LG, Philips, Sharp), smart
phones (iPhone, Android, etc.), Blu-ray players, and more. 
[Universal Media Server](http://www.universalmediaserver.com/)

One thing I do is that I download all my pictures to folders on my server. This allows me to view them from any computer, even my phone. I have scanned all my old photo’s of the kids growing up so I can view them online.

If you want a more feature filled application have a look at Plex. I did not use it because it uploads your library info to their server, and exposes it to the outside world. But if that is fine with you, be my guest.

Power Controller

Several years ago I found a system for turning things on and off by sending commands over the power lines in my house. The original system was called X10. Today X10 is still working but has been replaced by the Insteon system. I use software from MisterHouse to control the X10 devices. Note: Insteon is a dropin replacement for X10.

This allows me to schedule when lights or appliances turn on. I even have my network enabled printer switched by an X10 box. This means that from a web page for MisterHouse, I can turn on or off the power to the printer. I also set it to turn off the printer at 11:30 PM in case someone forgets to turn it off.

To learn more about Insteon have a look at Smart Hubs & Kits.

For more information on Mister House look at MisterHouse – It Knows Kung-Fu. This program runs under Perl and has an active group of users.

Access to other Systems

Several devices in my house have web interfaces. Some of them are my HP printer, my firewall, and my access point. Since these are internal devices I can manage them using the web interface. Additionally if they need logins and passwords, I can keep these on the access page. Additionally I link to a local copy of the manual so I can look up questions.

Even though the controls are web pages I find it easier to have the link to them on a web page.

Backup Server

One task that we all need to do but often put off is backing up our computers. So let me share one idea I implemented to make life easier.

I thought why not backup my laptop’s important files onto the server. For Linux I use an NFS mount (Network File System). For Windows I use a Samba server. This way I can simply copy the files from my laptop to the server. This gives me recovery for the laptop.

To setup a Samba server have a look at: Samba Server installation on Ubuntu 16.04.

For windows you can now create a batch file to mound the share point, then copy the selected folders to the Samba server.

Of course this relies on your server not failing. If you want to go to the next stage you should look at Crashplan. They have an inexpensive backup program that runs on Linux.

Connection Tips

You now have a server sitting in a closet and you can access it over the network. The question is how do you do maintenance on the server? So lets talk about remove access to your server.

Remote Access

SSH

One method we have discussed above it to use VNC. This gives you access to a graphical environment. Another method is to use SSH for remote access. I would recommend having a look at SSH/OpenSSH/Configuring. One exception I recommend to this setup is disabling Forwarding. We will see later how this will allow you to use graphics without VNC. The advantage of this is using SSH/OpenSSH/Keys. You can even combine this with a DNS server like Duck DNS, so you can access your server from outside your home. You could use a SSH login like:

ssh pi@exampledomain.duckdns.org

to access your server named exampledomain for a user named pi.

Another application you can use on windows to access the Linux server is Putty. Here is a tutorial on setting up Ubuntu to work with putty. Administer Ubuntu Server 14.04LTS remotely using Putty.

Graphical access

Since we have been talking about using Putty from windows, here is another tutorial for using Putty. But this tutorial explains how to use Xming on windows to give you a graphical interface to your Ubuntu server.

Putty and Xming

How to configure Putty & Xming (on your laptop) for a graphical interface to Ubuntu.

VNC access

Another method of access for your server from windows is to use VNC.
There are instructions at: How to Remote Access to Ubuntu 16.04 from Windows.

Cygwin and X-windows

If you use the cygwin tools on your windows machine, you can use their implementation of X-windows to get a Graphical interface. Instructions are available at: HowToCygwinX.

Examples of uses

I thought I would give you a few pictures to see what the different functions look like on a home server.

  • Information Server

Here is a save file to see how I use my home server as an information server. The Moore’s Home Reference.html.

  • Power Control

Here is the main page from MisterHouse to see how control looks.

Misterhouse
Misterhouse
  • Printer Interface

Here is the web page for my HP printer.

HP Printer
HP Printer
  • Media Server

Here is what the Universal Media server looks like. Not pretty but functional.

Media Server
Media Server

Here is what the Located Media Server looks like.

Squeezebox Radio
Squeezebox Radio

Written by John F. Moore

Last Revised: Thu May 11 12:54:46 EDT 2017

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
HTML5 Powered with CSS3 / Styling, and Semantics