Home Server Build part 4 – Remote Access (Ubuntu School)

Ubuntu LogoNow that the basic server is set up and ready to go it's time to get started with the good stuff. The first thing on the priority list is making sure we know how to control the server. Being able to control and administer the server remotely is the key to being able to run the server as a headless machine. The key technology of this remote access strategy is SSH.

SSH - Secure SHell

SSH is a key technology common in all POSIX operating systems. The program provides command-line terminal access to the remote system over an encrypted connection. SSH has effectively served as a replacement for telnet which provides remote terminal services, but is not encrypted.

It is also possible to route traffic from your computer through to the remote computer using the SSH connection. These is known as SSH tunelling. One example of this is using an encrypted SSH connection to serve as a conduit for unsecured traffic like web browsing. Most of the time this isn't a major concern, but if you want to be sure that your browsing session is protected in a public location (ie unsecured WiFi) (or need to otherwise thwart a threat like FireSheep you can route all your web-browsing traffic through to your server and keep it protected from anyone on the public WiFi.

Once connected you will have the same access to the machine that you would typically have by using the local command line. You log in over SSH with the same user ID and password you created during the server setup process. Here is a quick example of what the connection process looks like

ssh kdmurray@192.168.2.11 kdmurray@192.168.2.11's password:

Once that's over with you'll get some welcome text that will look something like this...

Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

Download and install Webmin

Details originally sourced from the Debian install instructions on the Webmin site.

These are the steps required to install Webmin using APT. There are a number of other methods mentioned on the Webmin site, but APT has the added advantages of automatic dependency resolution and easy-to-use upgrades. Of course you're already familiar with some of what APT can do from reading my Ubuntu School posts.

Edit the APT sources list sudo nano /etc/apt/sources.list

Add the following lines to reference the Webmin sources

```

Sources for Webmin, current as of 2012-06-10

deb http://download.webmin.com/download/repository sarge contrib deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib ```

Once the configuration is complete you'll need to register the developer's public key with APT so that the files can be verified. This is required because the source is not one of the built-in Ubuntu update sources.

wget http://www.webmin.com/jcameron-key.asc sudo apt-key add jcameron-key.asc rm jcameron-key.asc

Once the key has been added to the system, and the temporary file removed you're finally ready to install Webmin.

sudo apt-get update sudo apt-get install webmin

Because we haven't set up DNS yet (that's coming in the next section) you will need to access your Webmin interface using the IP address of your server. The default address for your Webmin installation is https://192.168.2.11:10000. Most browsers will throw up a warning message when you first log in because the SSL certificate being used was self-signed. This is, however expected, so you can add an exception for this server and carry on through to the Webmin interface.

Home Server Build part 3 – OS Installation (Ubuntu School)

Ubuntu LogoThis is the latest in my series of articles discussing the setup of a home server using Ubuntu 12.04 server. This article will guide you through the setup process which is quite simple and easy to follow.

The System: Ubuntu 12.04 Server (LTS)

  1. At boot the system will prompt for the language to use during installation.
  2. Select the Install Ubuntu Server option from the list.
  3. Select the language to use for the system.
  4. Select the country the system is in.
  5. Select the keyboard layout. If you have a system created in North America you can skip auto-detect and take the defaults on the next two screens.
  6. The system will begin some initial configuration and load basic components.
  7. Enter the system's hostname that you chose in the prerequisite phase.
  8. Enter the full name for the first system user
  9. Enter the username (login name) for the first system user
  10. Enter and confirm the password for the first system user
  11. Choose whether or not to encrypt the user's home directory
  12. Confirm the time zone
  13. Determine how you want the OS installed on the hard drive. In most cases you'll want to use the whole disk. The default option of using the entire disk with LVM.
  14. Select the disk to install the system on.
  15. If prompted to remove existing volume data, select Yes
  16. When you're ready to wipe the drive and proceed, select Yes
  17. To use the whole disk, take the default size.
  18. Select Yes to write the final partitioning changes to the disk.
  19. The installer will start installing the base system, this will take several minutes
  20. When prompted for an HTTP proxy, enter the details if you have one. If you don't know what this is, chances are you can leave it blank.21. The system will begin initial configuration of APT which is used to install the rest of the services and packages
  21. Decide whether you want the system to perform updates automatically. My preference is to do the updates manually so that I have full control of when they occur and when the restarts will happen.
  22. Select the base server packages to install. For the purposes of this tutorial, and the initial setup of my home server I've chosen the following required bits and pieces
    • OpenSSH Server
    • DNS Server
    • LAMP Server
    • Samba Server
  23. Choose a password for the MySQL root user. This is a different password than the Ubuntu root user account.
  24. Allow the system to install the remaining packages. This will take several minutes.
  25. When prompted to install the GRUB boot loader, select Yes. (NOTE: if you're trying to boot multiple operating systems from this server and the boot loader screen didn't identify the other installations check the GRUB documentation.
  26. Eject the disk and reboot your server. The initial installation is complete.

Post-installation tasks

Once the system boots there are a few maintenance tasks that need to take place. These involve doing the initial system updates and configuring the root user. These tasks can either be performed at the console, or over SSH, whichever you prefer. These tasks can all be performed using the account you set up during the installation process. This account is a member of the sudoers group which will allow the user to perform administrative tasks using the sudo command.

The first step is to perform the system updates. This is done in two stages, first the APT package sources need to be updated, then the packages themselves can be upgraded.

``` sudo apt-get update

sudo apt-get upgrade ```

When you run the upgrade you will be notified of the names of the packages which will be upgraded, and the approximate disk space required to make the changes. Select Y to continue with the installation. In most cases, the system will not require a restart after this process is completed.

Once the installation is complete you can set up a password for the root account. This will allow you to impersonate root and perform administrative/maintenance tasks without having to continually use the sudo. NOTE: If you do this, make sure you assign a very strong password to the root account. If it's compromised you can very quickly lose control of your server. Personally I just stick with sudo but I'm including this because it's good to know how to do it.

sudo passwd root

When prompted, enter the strong password you selected for root. You can now impersonate the root user with the su command.

su root

Additional Hard Drives

If you have additional hard drives that need to be configured, and you want them to be mounted when the system boots up, you will need to configure the file system table by editing a file called fstab.

The first step in working with the second drive is to know what it's called and what file system is in use on that drive. I will be working under the assumption that the drive is formated as ext3, a common linux file system. Getting into all the guts and details of running multiple disks is beyond the scope of what I want to cover in this tutorial. If you need more information on mounting drives under ubuntu check out the Ubuntu help documentation.

To list the disks attached to the system use the fdisk command: sudo fdisk -l

``` Disk /dev/sda: 320.1 GB, 320072933376 bytes

255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000bef52

Device Boot Start End Blocks Id System

/dev/sda1 * 2048 499711 248832 83 Linux

/dev/sda2 501758 625141759 312320001 5 Extended

/dev/sda5 501760 625141759 312320000 8e Linux LVM

Disk /dev/sdb: 1000.2 GB, 1000198934016 bytes

255 heads, 63 sectors/track, 122201 cylinders, total 2007029168 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000bb05d

Device Boot Start End Blocks Id System

/dev/sdb1 2048 2007028991 1000513472 83 Linux

```

This shows that there's a 1TB data drive attached to the system called /dev/sdb1. We want to have that drive mounted to a specific location when the system boots. The beauty of this is that you can have that disk mounted anywhere in the file system. Desktop editions of Linux will mount all external media (USB sticks, portable hard drives) in the /media folder. For the purposes of this article I'll mount this drive in the same location, but you really can place it anywhere.

``` sudo mkdir /media/data

sudo nano /etc/fstab ```

Add the following lines to the bottom of the fstab file:

``` # Mounting information for 1TB data drive

/dev/sdb1 /media/data ext3 defaults 0 0 ```

Once that's done, you can mount the drive using the mount command from the command line, or reboot the system.

``` sudo mount -a

==OR==

sudo shutdown -r now ```

Home Server Build part 2 – Prerequisites (Ubuntu School)

Ubuntu LogoServers are a misunderstood breed of the computer world. Most people think of a server as a large powerful computer sitting in the basement of a corporate office. The truth is that a server is a much less specialized computing device than most people realize. It's simply a computer that provides one or more services to other computers on the network. And truthfully, even in many corporate environments today the servers have been virtualized, or deployed as blade servers which take up very little physical space and help to cut down on power and cooling costs -- but that's a topic for another day.

This section is all about the things you want to make sure you've thought about before you get started with your server project. While the process of setting up and deploying your own server is not particularly difficult, there are a few things that are made easier by giving some thought to them in advance.

What does the server need to do?

If you're wanting to set up a server in your home you probably have some idea of what you'd like that server to do for you. Some common use cases include

  • File sharing
  • Printer sharing
  • Streaming media

Some less common cases include

  • DNS
  • VPN
  • Email hosting
  • Website hosting
  • Source control

Some strange edge cases include

  • Continuous integration services
  • Windows domain controller
  • Media transcoding

In my case, the server is going to be fairly busy providing file and streaming media hosting for the whole house as well as some development tasks like source-control. I happened to have a rather large and powerful machine at my disposal for this project so it seemed silly not to use it. The machine is a 3-year old Dell desktop with lots of horsepower and 8GB of memory -- overkill for the most part.

How will it be controlled and administered

Depending how much space you have and what resources you have at your disposal you have some options for how the server gets controlled and administered. Most of the time you can plug in a keyboard, mouse and monitor and have the same basic setup that you'd have with any desktop machine. But if you don't have the space the server can also be controlled remotely. The simplest way to do that remote control is using SSH.

That said, doing the initial setup with a keyboard and monitor makes life a lot easier. There are ways to do unattended network installs, but that's beyond the scope of what I'll be getting into with this article. Even if you just borrow the keyboard and monitor from another machine, it'll get you past the installation to the point where you can do the rest of your tasks remotely.

Server (and network) device names

The last thing to consider before you get going with the server setup is the server's name. While you can always get at your machine by using its IP address, it is much nicer to be able to refer to the machine by a name. You may not always want to do this, but the more machines you have on your network, the more devices you want to access remotely, the more beneficial this type of setup becomes. To facilitate this, we'll talk later about configuring a DNS server to handle name resolution. This will allow all the computers on your network to use the friendly names for the server, and any other devices on the network.

Personally, I like to have a theme for the machines on my network. I chose some time ago to give some love to dwarf planets. Everyone knows the full-size planets, and many of their moons, but the dwarf planets always seem to get ignored -- plus as more of them continue to be discovered there are more options for future network devices.

The table below contains some suggestions for possible domain/host combinations for your network.

DomainHosts
astrostars, planets
bardShakespeare characters
droidStar Wars planets or characters
geocities, countries or geographic features

Home Server Build part 1 – Introduction (Ubuntu School)

What started life as an idea for a blog post as much for my own future reference as it was for anyone else has taken on a life of its own in what will be at least a 6-post series. It's a step by step guide to how I've configured my primary home server including all of its hardware, services and applications. I find that on occasion this server, as with all my computers, could benefit from a full OS rebuild.

I'm a bit of a junkie when it comes to computer maintenance, so undoubtedly that has something to do with it too. My Windows and Mac systems are typically not much of a challenge. The lack of customization required for me to get them back to the point at which I want them makes the task trivial. Not so with my Linux server. This series will cover, in the order I tackle them, the tasks I undertake to get the server running with all the services I use regularly.

I've outlined the plan below, it may deviate a bit from what I've listed here, but the overall topics should remain the same. I welcome any feedback, questions or comments.

Prerequisites

  • What does the server need to do
  • How will it be controlled and administered
  • Server (and network) device names

OS Install

  • Ubuntu 12.04 Server (LTS)

    *   SSH Server
    
    • LAMP Server
    • DNS Server
    • SAMBA Server
  • Additional hard disks

Access and Administration

  • SSH

    *   Tunelling
    
  • Configure APT
  • Download and install Webmin

DNS Server - BIND

  • Configure domain via Webmin
  • Configure router to use DNS
  • Set up DNS entries for home LAN devices

File Server - SAMBA

  • Set up local users
  • Set up share locations
  • Configure Samba via Webmin
  • Set up samba users
  • Share out directories
  • map share on remote machines

BitTorrent - Transmission

  • why bit torrent
  • setting up transmission

Media Server - Plex

  • purpose
  • configure apt
  • install Plex

Backup - Crashplan

  • server setup
  • no-UI operation* backup ethos

Version Control - SVN

  • Why SVN
  • setup
  • apache config

Continuous Integration - CruiseControl

  • What's CI
  • Why do I care
  • Mono
  • CruiseControl

So get ready to enjoy a whole lot of content over the next couple of weeks. It should be fun!

Penultimate – Putting Pen to Digital Paper

One of the things I really wanted to see work when I picked up the iPad was the ability for me to take the device into a meeting, scrawl a bunch of chicken scratch as if I wee using a real paper-based notepad, and then have those notes translated into text so that it could be searched later.

Alas...

As far as I know, the killer app I'm looking for doesn't quite exist. There are some apps available tht say their handwriting recognotion is second to none, but because of the way Apple has set up the App Store I would have to spend the full $10 just to find out if the tool would suit my needs. I understand that there are limitations to what can be done for trials and in-app upgrades etc, but until I know the thing is gonna work for me, I really don't want to fork over more than a buck or two just to take a flyer on some app.

What I hae found though is a compromise. Something that will allow me to do my chicken scratch and have some hope of finding what I wrote down later -- as long as my penmanship is at least at a 3rd grade level (my apologies to any 3rd graders who've actually seen my handwriting). I found Penultimate.

What is it?

The app is a digital version of your typical pen-and-paper setup. This application allows you to have a series of notebooks into which you can scrawl whatever you want. There are a number of pen sizes and colours to choose from, and they are redered beautifully on the virtual paper. The inks are all nice and dark so even the lighter oranges and yellows can be seen on the light-coloured background.

There are a number of features included in the base price of the application. A set of default papers (3), a set of downloadable papers (7) and the ability for you to upload any image you want and use that as the paper surface. I tried this out by uploading a screen shot of a template I've used in MS-Word for meeting notes. It has spaces to fill out who's attending, date/time, topics, action items etc. It was originally designed to be a more fluid type-written template, but I have printed it out on occasion and it's worked well for me when I have. The template looks great in Penultimate too.

The second piece to the puzzle comes via Penultimate's integration with Evernote. One of the coolest technologies in the Evernote aresenal is its ability to scan your images for searchable terms. By adding those terms to its database, Evernote can actually allow you to do a text search on text which appears inside your images. So by syncing my notes into my evernote notebook they will all be searchable after my meetings are done -- assuming Evernote can read my scribbles.

As I've been using the application for the past few days my writing on the tablet surface has improved. I can now get more than 15-20 characters on a line and still have them be legible. Writing with a stylus on a touch screen is a strange feeling. Though the stylus provides additional control, it still doesn't give you the same precision contact with the screen as you would have putting pen to paper. For me, the advantages outweigh the disadvantages and this application has made its way into my primary tool arsenal.