Introduction
Storage Thoughts
Ubuntu Installation
– Creating the bootable media
– Installing Ubuntu
Plex Media Server Installation
Samba Installation

Introduction

In a previous post I’ve described this process with Ubuntu 12.04 LTS but here I’m going to run through setting up a basic installation of Ubuntu 14.04 LTS (Long Term Support – 2019 in this case) without the GUI on an HP MicroServer N40L/N54L so it can run headless.  In addition we’ll get Plex Media Server installed and configure Samba so we can access the media libraries from a Windows PC (as a source for media files).

If you’re using Ubuntu 12.04 LTS, check out my other post here.

If you need any assistance with Ubuntu 16.04 LTS – check out my notes here.

Storage Thoughts

Plex Media Server allows you to store your Sections (the logical name given to a folder of media files) in different locations but if you want to maximise your storage space in your MicroServer it’s worth thinking in advance where you want Ubuntu installed.  For example do you want it on one of the hard disks in your system (potentially losing this disk for media) or on a USB flash drive (the HP MicroServer N40L/N54L have an internal USB2 slot – show in first image below)

DSC_0418 DSC_0417

I use an HP Microserver N40L with an internal USB flash drive (Sandisk Cruzer Fit 16GB – shown in second image above) and two 2TB disks (at the moment) in a ZFS mirror.  I’ve found the Sandisk Cruzer to be quite slow (as expected) when compared against a spinning hard disk – primarily during software updates (unpacking/installing).  Under normal operation I don’t see any sluggishness.

Another thing to consider is size of USB flash drive – my library is around 1000 TV shows and 30 or so movies and the plex metadata (install, config, background music, pictures etc) is around 450MB.  If you utilise a feature called Media Indexing (this indexes your media and allows for graphical seeking) then this could easily become much much larger (20-40x).  Of course you could move your Plex Library onto your data disks in the future if required.

I’ve written another post on installing and configuring ZFS with Ubuntu and the HP MicroServer.

Ubuntu Installation

Creating the bootable media

Download the latest ISO for Ubuntu 14.04 LTS (at time of writing this is 14.04.1 @ 572MB) from the Ubuntu Server Download page.  Ubuntu Server 14.04 LTS is 64 bit only.  There are three methods to get going:

  1. Burn the ISO to a CD if you have a CD drive in your MicroServer.
  2. Use a tool like Universal USB Installer to create a bootable USB key.  As stated above the MicroServer has an internal USB slot and supports booting from USB.
  3. Keep the ISO as is if you plan to build this out in a virtual machine (for testing).

1. and 3. are straightforward so I’ll just briefly cover 2. as this was the method I used on Windows 7 (as I had no CD/DVD drive on my HP MicroServer).

  1. Locate a USB flash drive at least 1GB in size and insert into your PC.  Note the drive letter.
  2. Download Universal USB Installer from here.
  3. Run the executable and accept the UAC warning (if prompted).  Click I Agree on the license agreement.


    usbtool-1

  4. Step 1 – Select Ubuntu Server Installer (on v1.9.5.5).
  5. Step 2 – Click Browse and if you’ve selected correctly you will only see the ISO you downloaded earlier as the program is looking for a particular prefix in the file name.  Select your ISO.
  6. Step 3 – Select your USB flash drive from the drop down list.  Select to Format the drive as well if required (NOTE: these operations will remove all contents).  Formatting the drive here is an additional step to ensure the creation will be successful as FAT32 is one of the supported formats.


    usbtool-2

  7. Click Create.
  8. Check through actions displayed and click Yes if you’re happy.
  9. The tool will run and complete the extraction and set up to the USB flash drive.
Installing Ubuntu

NOTE: Ensure the MicroServer is plugged into your network and has a connection to the internet when using the 14.04 ISO image specified above.  This is required to progress past a certain stage in the installation.

The following methods should be fairly straightforward and I won’t add further explanation:

  • CD > Local hard disk
  • CD > Local USB flash drive
  • ISO > Virtual disk (deploying to a virtual machine)
  • USB > Local hard disk

The method that’s worth an extra note is USB > Local USB flash drive.  As discussed earlier, if this is possible in your system then it’s definitely worth considering as it frees up a SATA port for a hard disk (and creates a hardware boundary between your OS and your data)  From experience I’ve found the following high level steps to work:

  1. Remove any on board USB flash drives and boot from your external USB flash drive with Ubuntu.
  2. Select your Language.
  3. Choose Install Ubuntu Server
    NOTE: If this is a new system or new memory it is also worth running the Test memory option for at least 3-5 passes – this could take significant time depending on memory size.


    ubuntu-install-1

  4. Once the Ubuntu select language screen is up, insert your onboard USB flash drive.
  5. Select your Language.
  6. Select your Location.
  7. Select whether you want to select your keyboard from a list (select No) or try and autodetect with key presses (select Yes).
  8. Additional components will be loaded.


    ubuntu-install-2

  9. Link should be detected on eth0 including link local address (depending on whether you are connected to a network)
  10. DHCP will try and obtain network configuration.  If this succeeds you will then be prompted with entering a hostname.  To use a static IP address select Go Back and move to step 12.
  11. To use a static IP address (advisable) select Configure network manually.


    ubuntu-install-3

  12. Enter a static IP address and select Continue.
  13. Enter a subnet mask and select Continue.
  14. Enter a gateway and select Continue.
  15. Enter the IP address (or multiple IP addresses separated by spaces) for your DNS servers and select Continue.
  16. Enter the hostname for the system and select Continue.
  17. If you have a local domain name enter this (e.g. foo.local, foo.com etc) and select Continue.
  18. If prompted to select a local Ubuntu mirror, choose the one closest to you based on country code.
  19. Enter the full name for your user and select Continue.
  20. Enter the username for your account and select Continue.
  21. Enter the password for your account and select Continue.
  22. Re-enter the password and select Continue.
  23. Select whether to encrypt your home directory or not. This isn’t really a necessity if it’s your media server and won’t hold personal documents etc that you might want to encrypt.
  24. The installation will then try and set the clock.  Confirm or change your time zone as required.
  25. The next thing to configure is your partitioning. For this installation I’ll be selecting Guided – use entire disk and set up LVM (as I want a simple installation but with LVM behind it).


    ubuntu-install-4

  26. Ensure the disk listed in the next screen is your onboard USB flash drive.
  27. Choose Yes to confirm you want write the changes to disk.
  28. You’ll now get offered what size of the disk you want to offer up to the guided partition. For this installation I’ll leave it at the default (all the available space) and select Continue.
  29. If prompted, confirm one last time that you’re happy with the changes being written to disk.  Select Yes.
  30. The disk partitioning and formatting will begin. Once complete the base system will be installed (this will take 10-15 minutes on a typical USB flash drive).
  31. Enter proxy information if required and select Continue.
  32. The Select and install software will now begin.  Select whether to install updates automatically or not.


    ubuntu-install-5

  33. On the Software selection screen select OpenSSH server and then select Continue.
    NOTE: We’ll install Samba separately later.


    ubuntu-install-6

  34. The rest of the system software will now be unpacked and installed then the boot loader.
  35. The device for the boot loader installation may be displayed (depending on what was on your USB flash drive previously).  If you have no other hard disks in your MicroServer and only your external USB flash drive and onboard USB flash drive (inserted later) then this will be /dev/sdb.  Select Yes to install GRUB boot loader to the master boot record.
  36. When the installation is finished remove your external USB flash drive and select Continue.

Your HP MicroServer will reboot into Ubtuntu and before long you’ll see the following:

Ubuntu 14.04.1 LTS <hostname> tty1

<hostname> login:

Enter the username and password you set during the installation so you get to the shell.

It’s now time to shut down the MicroServer and put it in its final place (headless) with a network connection.

sudo shutdown -h now

Move the MicroServer, plug it into the network and power it up.

When it’s powered up and connected to the network we need to update Ubuntu with latest packages for 14.04.

  1. SSH to your server (using a tool like PuTTY)
  2. Update the package information and then upgrade:
    sudo apt-get update


    sudo apt-get upgrade

Plex Media Server Installation

  1. Browse to the Plex Media Server Downloads page then select Computer then Linux.
  2. Right click the latest 64bit Ubuntu download link and copy it to the clipboard
  3. SSH to your server (using a tool like PuTTY)
  4. Log in with your username and password.
  5. Change to the /tmp directory:
    cd /tmp

  6. Download the latest package (paste in the link from step 2 – example below):
    wget http://downloads.plexapp.com/plex-media-server/0.9.9.14.531-7eef8c6/plexmediaserver_0.9.9.14.531-7eef8c6_amd64.deb

  7. Install two dependencies required for Plex Media Server and choose Y to confirm:
    sudo apt-get install avahi-daemon avahi-utils


  8. Install Plex Media Server using Debian package manager (example file name below):
    sudo dpkg -i plexmediaserver_0.9.9.14.531-7eef8c6_amd64.deb

  9. This will install Plex Media Server and also add a repo file called plexmediaserver.list in /etc/apt/soures.list.d/
    NOTE: at time of writing, the Plex team are having issues with this public repo and it is out of date. Repeating steps 1 to 8 (EXCLUDING step 7) when there is a new version will also upgrade your version in future if required.

  10. You’ll then see the following output from the installer:
    Selecting previously unselected package plexmediaserver.
    (Reading database … 56008 files and directories currently installed.)
    Preparing to unpack plexmediaserver_0.9.9.14.531-7eef8c6_amd64.deb …
    Unpacking plexmediaserver (0.9.9.14.531-7eef8c6) …
    Setting up plexmediaserver (0.9.9.14.531-7eef8c6) …
    OK
    plexmediaserver start/running, process 10041

Once complete open a browser and go to http://<ipaddress>:32400/web

  1. You should see the license agreement.  Click Agree.


    1404-plex-1

  2. You can then start adding libraries by clicking the + (plex) sign in the top left next to your server name.  This will display the following wizard:


    1404-plex-2

  3. You can also adjust your Plex Media Server and Plex Web options by clicking the tools icon in the top right.  The following screenshot displays the General options for the Plex Media Server including setting a Friendly name.


    1404-plex-3

Samba Installation

As mentioned at the start of this post it’s useful (if you use Windows) to be able to access your media files remotely.  Installing and configuring Samba will allow us to do this.

NOTE: This section presumes you have your storage configured (i.e. the locations where your Plex libraries will be).

  1. Let’s get the packages installed first:
    sudo apt-get install samba

  2. Create a new smb user to map to your Ubuntu user (you’ll use this to map your share):
    sudo smbpasswd -a <youruser>
    e.g. sudo smbpasswd -a joeb

  3. Ensure the password you enter is the same as your Ubuntu password.  When we create a new smb.conf file we’ll ensure that the Samba password is updated whenever your Ubuntu password is updated next time.
    NOTE: You can create a new Ubuntu user and then create an associated Samba user (it doesn’t have to be your existing one)

  4. Back up the old smb.conf file:
    $ sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.old

  5. Create a new smb.conf file:
    sudo nano /etc/samba/smb.conf

  6. Paste in the following configuration that configures a share called media:
    NOTE: Some of the options below are default (and therefore not needed but are included for completeness and to research yourself)

    [global]
            workgroup = WORKGROUP
            netbios name = PLEX
            server string = %h server (Samba %v, Ubuntu)
    
            map to guest = Bad User
            obey pam restrictions = Yes
            pam password change = Yes
            passwd program = /usr/bin/passwd %u
            passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
            unix password sync = Yes
            syslog = 0
            log file = /var/log/samba/log.%m
            max log size = 1000
            dns proxy = No
            usershare allow guests = No
            panic action = /usr/share/samba/panic-action %d
            idmap config * : backend = tdb
    
    [media]
            path = /data1/media
            comment = Plex raw media files
            writeable = yes
            valid users = joeb
            browsable = yes
            guest ok = no
    
  7. Ensure you check and/or change the following:
    • netbios name – this should ideally match the host name of the server.
    • path – I have put an example path here but yours will likely be different.
    • valid users – Only use this user account if you’ve followed the steps above otherwise use the account you specified.
  8. Save this file and exit.
  9. Restart Samba:
    sudo service smbd restart

  10. You will need to provide read/write access for your user to the path above.  Following on from my example I’d do the following:
    sudo chown joeb:joeb /data1/media

  11. You will now be able to connect from windows to your share (media).  Using the names above it would be \\plex\media, then enter the username and password you configured.
    NOTE: The key thing is that the user plex (created by the plexmediaserver application) has read access to your media files.  By default everyone should have read access to a directory outside your home  area.


    share-browse1

  12. You can now create folders (that can become Sections in Plex) and manage files in this area.
Working with remote Windows (CIFS) shares

If you’re tying to mount a Windows share onto your server using mount with the -t cifs option but get the following error ensure you have the cifs-utils package installed as this will ensure you can specify cifs as a file system type:

mount: wrong fs type, bad option, bad superblock on //<server>/<share>,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog – try
dmesg | tail or so

If required, just install with the following command and confirm the package installation:

$ sudo apt-get install cifs-utils

This has been a fairly exhaustive post that tries to remain as generic as possible while still hopefully providing the information necessary to get up and running with Ubuntu 14.04.1, Plex and Samba.  It doesn’t cover storage configuration as this could be several posts by themselves given the multiple permutations.

Please sound off in the comments for any updates/additions to this post.

 

 

Headless Ubuntu 14.04 LTS and Plex Media Server on HP MicroServer
Tweet about this on TwitterShare on Google+1Share on Facebook0Email this to someone
Tagged on:             

11 thoughts on “Headless Ubuntu 14.04 LTS and Plex Media Server on HP MicroServer

  • 14 October 2014 at 18:28
    Permalink

    Any thoughts to adding ZFS to this, and perhaps Calibre, and maybe subsonic?

    Reply
    • 15 October 2014 at 13:45
      Permalink

      Hi – There’s a line item in the article linking to a ZFS article I did that supplements the Microserver. The article is at http://www.geeklee.co.uk/2014/03/21/using-zfs-with-ubuntu-microserver/

      I haven’t looked at Calibre or Subsonic at all and if I did it would – unfortunately – be way down on “my list” – are you hosting these on your Microserver?

      Reply
  • 15 October 2014 at 16:42
    Permalink

    No, I have an older Dell Desktop with a 1TB drive, which I currently run vortexbox on it, looking to move on or upgrade…was given a 500 gig drive and ordered a 3TB drive…Calibre is great to serve all my ebooks anywhere ot my tablet or any cell phone or ipad. and Subsonic serves 2 functions for me, serves my music anywhere and gives me a built in dynamic dns without having to configure it. I’ll check out the ZFS, but I’m not too worried about redundancy, more about making the OS think it’s 1 large drive.

    Reply
    • 15 October 2014 at 18:12
      Permalink

      With mixed sized drives, you might be better off with something else.

      When I’ve got multiple services (with multiple users) running, redundancy is very important to me (especially when an entire media library is stored there)

      Reply
  • 15 October 2014 at 16:50
    Permalink

    Also, I’ve read several sites that suggest you install the OS to an actual drive as the usb key will be slow and has a tendency to fail.

    Reply
    • 15 October 2014 at 18:10
      Permalink

      On the Microserver, if you’re looking to maximise the drive bay usage with a separate array/pool for data then the USB is a good option. I mention in my article that it’s slower (and that the Plex library can live on the spinning disks).

      I’m not sure a sweeping statement like a USB key has the “tendency to fail” is completely accurate in all cases. A (pointless) anecdote … I’ve had a disk fail on me in the time I’ve had the USB key with my OS – but I don’t think that proves anything.

      If all your data is on a redundant array then your USB key with the OS failing isn’t a big deal is it? Just stick a new one in, rebuild, restore your configs and bring your array/pool online.

      Reply
  • 24 October 2015 at 21:30
    Permalink

    I’ve followed this guide step by step. It’s excellent thank you! Now I have Ubuntu Server running 14.04.3 with the Plex 0.9.12.13.
    Many Thanks.

    Reply
    • 26 October 2015 at 19:22
      Permalink

      Excellent, thanks for the feedback!

      Reply
  • 31 December 2015 at 15:35
    Permalink

    Thank you very much for this guide. it’s a great resource, one other thing would have been to add a HD to point the media at.

    Reply
  • 17 April 2016 at 21:22
    Permalink

    Fine read. Thanks a bunch.

    Reply
  • 26 January 2017 at 09:33
    Permalink

    Just wanted to echo the other commenters, this is a fantastic post! Thanks to you I have a working Plex install on Ubuntu Server 16.04.1. I am going to have to learn about LVM now, as I think I will need more space on the server. Thanks again!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *